chore: switch to CMake build system instead of native Visual Studio project
This commit is contained in:
7
CMake/LibCmoConfig.cmake.in
Normal file
7
CMake/LibCmoConfig.cmake.in
Normal file
@ -0,0 +1,7 @@
|
||||
|
||||
@PACKAGE_INIT@
|
||||
|
||||
# Include targets file
|
||||
include("${CMAKE_CURRENT_LIST_DIR}/LibCmoTargets.cmake")
|
||||
|
||||
check_required_components(LibCmo)
|
9
CMake/custom_import_iconv.cmake
Normal file
9
CMake/custom_import_iconv.cmake
Normal file
@ -0,0 +1,9 @@
|
||||
if (WIN32)
|
||||
# In Windows, we should not import Iconv.
|
||||
# Send a notice to programmer.
|
||||
message("Windows environment detected, skip finding Iconv!")
|
||||
else ()
|
||||
# In non-Windows, we simply import Iconv from CMake preset.
|
||||
# It will produce Iconv::Iconv target for including and linking.
|
||||
find_package(Iconv REQUIRED)
|
||||
endif ()
|
14
CMake/custom_import_stb.cmake
Normal file
14
CMake/custom_import_stb.cmake
Normal file
@ -0,0 +1,14 @@
|
||||
# Check stb path variable
|
||||
if (NOT DEFINED STB_IMAGE_PATH)
|
||||
message(FATAL_ERROR "You must set STB_IMAGE_PATH variable to the root directory of std-image repository.")
|
||||
endif()
|
||||
|
||||
# Add library
|
||||
add_library(stb-image INTERFACE IMPORTED)
|
||||
# Add alias for it
|
||||
add_library(stb::stb-image ALIAS stb-image)
|
||||
# Setup header files
|
||||
set_target_properties(stb-image PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES
|
||||
"${STB_IMAGE_PATH}"
|
||||
)
|
11
CMake/custom_import_yycc.cmake
Normal file
11
CMake/custom_import_yycc.cmake
Normal file
@ -0,0 +1,11 @@
|
||||
|
||||
# Check YYCC path environment variable
|
||||
if (NOT DEFINED YYCC_PATH)
|
||||
message(FATAL_ERROR "You must set YYCC_PATH variable to one of YYCC CMake distribution installation path.")
|
||||
endif()
|
||||
|
||||
# Find YYCC library
|
||||
# It will produce YYCC::YYCCommonplace target for including and linking.
|
||||
find_package(YYCCommonplace REQUIRED
|
||||
HINTS ${YYCC_PATH} NO_DEFAULT_PATH
|
||||
)
|
34
CMake/custom_import_zlib.cmake
Normal file
34
CMake/custom_import_zlib.cmake
Normal file
@ -0,0 +1,34 @@
|
||||
if (WIN32)
|
||||
# In Windows, we use custom way to import ZLib.
|
||||
# Before using this CMake file in Windows, you should do following steps first.
|
||||
# 1. Get ZLib repository: https://github.com/madler/zlib
|
||||
# 2. Navigate to `contrib/vstudio` and choose a proper Visual Studio project according to your environment.
|
||||
# 3. Open project file and build. Then you will get the built binary.
|
||||
# 4. The directory binary located is the argument you should passed to ZLIB_BINARY_PATH, for example: `contrib/vstudio/vc14/x64/ZlibDllRelease`
|
||||
|
||||
# Check ZLib path variable
|
||||
if (NOT DEFINED ZLIB_HEADER_PATH)
|
||||
message(FATAL_ERROR "You must set ZLIB_HEADER_PATH to the root directory of ZLib repository.")
|
||||
endif()
|
||||
if (NOT DEFINED ZLIB_BINARY_PATH)
|
||||
message(FATAL_ERROR "You must set ZLIB_BINARY_PATH to the directory where include binary built by contributed Visual Studio project.")
|
||||
endif()
|
||||
# Add imported library
|
||||
add_library(ZLIB INTERFACE IMPORTED)
|
||||
# Add alias for it to let it has the same behavior with CMake imported ZLib.
|
||||
add_library(ZLIB::ZLIB ALIAS ZLIB)
|
||||
# Setup header files
|
||||
set_target_properties(ZLIB PROPERTIES
|
||||
INTERFACE_INCLUDE_DIRECTORIES
|
||||
"${ZLIB_HEADER_PATH}"
|
||||
)
|
||||
# Setup lib files
|
||||
set_target_properties(ZLIB PROPERTIES
|
||||
INTERFACE_LINK_LIBRARIES
|
||||
"${ZLIB_BINARY_PATH}/zlibwapi.lib"
|
||||
)
|
||||
else ()
|
||||
# In non-Windows, we simply import ZLib from CMake preset.
|
||||
# It will produce ZLIB::ZLIB target for including and linking.
|
||||
find_package(ZLIB REQUIRED)
|
||||
endif ()
|
Reference in New Issue
Block a user