libcmo21/LibCmo/CMakeLists.txt

96 lines
2.1 KiB
CMake
Raw Normal View History

cmake_minimum_required(VERSION 3.12)
project(LibCmo LANGUAGES CXX)
# find packages
find_package(ZLIB REQUIRED)
find_package(Iconv REQUIRED)
2023-09-24 23:27:20 +08:00
# manually check stb image path
if (NOT STB_IMAGE_PATH)
message(FATAL_ERROR "You must assign your stb_image library root path to STB_IMAGE_PATH when compiling this project.")
endif ()
if ((NOT EXISTS "${STB_IMAGE_PATH}/stb_image.h") OR (NOT EXISTS "${STB_IMAGE_PATH}/stb_image_resize.h") OR (NOT EXISTS "${STB_IMAGE_PATH}/stb_image_write.h"))
message(FATAL_ERROR "Invalid stb_image library path.")
endif ()
# set standard
set(CMAKE_CXX_STANDARD 20)
set(libcmo_headers ".")
2023-08-31 10:20:10 +08:00
set(libcmo_vt_src
VTUtils.cpp
2023-08-31 10:20:10 +08:00
VTEncoding.cpp
2023-09-24 23:27:20 +08:00
VTImage.cpp
2023-08-31 10:20:10 +08:00
)
set(libcmo_ck2_src
2023-09-24 23:27:20 +08:00
CK2/CKBitmapData.cpp
2023-08-31 10:20:10 +08:00
CK2/CKContext.cpp
CK2/CKFileOthers.cpp
CK2/CKFileReader.cpp
CK2/CKFileWriter.cpp
CK2/CKGlobals.cpp
2023-09-24 23:27:20 +08:00
CK2/CKStateChunkOthers.cpp
CK2/CKStateChunkReader.cpp
CK2/CKStateChunkWriter.cpp
)
set(libcmo_ck2_dh_src
CK2/DataHandlers/CKBitmapHandler.cpp
2023-08-31 10:20:10 +08:00
)
set(libcmo_ck2_mgr_src
CK2/MgrImpls/CKBaseManager.cpp
2023-09-24 23:27:20 +08:00
CK2/MgrImpls/CKObjectManager.cpp
CK2/MgrImpls/CKPathManager.cpp
2023-08-31 10:20:10 +08:00
)
set(libcmo_ck2_obj_src
2023-09-24 23:27:20 +08:00
CK2/ObjImpls/CK3dEntity.cpp
CK2/ObjImpls/CKBeObject.cpp
CK2/ObjImpls/CKGroup.cpp
CK2/ObjImpls/CKMaterial.cpp
CK2/ObjImpls/CKMesh.cpp
2023-08-31 10:20:10 +08:00
CK2/ObjImpls/CKObject.cpp
2023-09-24 23:27:20 +08:00
CK2/ObjImpls/CKTexture.cpp
)
2023-08-31 10:20:10 +08:00
set(libcmo_vxmath_src
VxMath/VxMemoryMappedFile.cpp
2023-09-24 23:27:20 +08:00
VxMath/VxMath.cpp
)
2023-08-31 10:20:10 +08:00
set(libcmo_xcontainer_src
2023-09-24 23:27:20 +08:00
XContainer/XTypes.cpp
)
# create static library
add_library(LibCmo
STATIC
2023-08-31 10:20:10 +08:00
${libcmo_vt_src}
${libcmo_ck2_src}
2023-09-24 23:27:20 +08:00
${libcmo_ck2_dh_src}
2023-08-31 10:20:10 +08:00
${libcmo_ck2_mgr_src}
${libcmo_ck2_obj_src}
${libcmo_vxmath_src}
${libcmo_xcontainer_src}
)
target_link_libraries(LibCmo
PRIVATE
${ZLIB_LIBRARIES}
${Iconv_LIBRARIES}
)
target_include_directories(LibCmo
PUBLIC
${libcmo_headers}
PRIVATE
2023-09-24 23:27:20 +08:00
${STB_IMAGE_PATH}
${ZLIB_INCLUDE_DIRS}
${Iconv_INCLUDE_DIRS}
)
2023-09-24 23:27:20 +08:00
# add essential build macro
target_compile_definitions(LibCmo
PUBLIC
$<$<CONFIG:Debug>:LIBCMO_BUILD_DEBUG>
$<$<CONFIG:Release>:LIBCMO_BUILD_RELEASE>
$<$<CONFIG:RelWithDebInfo>:LIBCMO_BUILD_RELEASE>
$<$<CONFIG:MinSizeRel>:LIBCMO_BUILD_RELEASE>
)