fix cmake error (part)

This commit is contained in:
yyc12345 2023-09-24 23:27:20 +08:00
parent b2d0b743cb
commit 8083633a7b
4 changed files with 72 additions and 7 deletions

26
IronPad/CMakeLists.txt Normal file
View File

@ -0,0 +1,26 @@
cmake_minimum_required(VERSION 3.12)
project(IronPad LANGUAGES CXX)
# set standard
set(CMAKE_CXX_STANDARD 20)
# add libcmo
add_subdirectory("../LibCmo" "LibCmo.out")
# setup sources
set(ironpad_headers ".")
set(ironpad_src IronPad.cpp)
# create static library
add_library(IronPad
STATIC
${ironpad_src}
)
target_link_libraries(IronPad
PRIVATE
LibCmo
)
target_include_directories(IronPad
PUBLIC
${ironpad_headers}
)

View File

@ -5,6 +5,14 @@ project(LibCmo LANGUAGES CXX)
find_package(ZLIB REQUIRED)
find_package(Iconv REQUIRED)
# 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)
@ -13,25 +21,42 @@ set(libcmo_headers ".")
set(libcmo_vt_src
VTUtils.cpp
VTEncoding.cpp
VTImage.cpp
)
set(libcmo_ck2_src
CK2/CKBitmapData.cpp
CK2/CKContext.cpp
CK2/CKFileOthers.cpp
CK2/CKFileReader.cpp
CK2/CKFileWriter.cpp
CK2/CKGlobals.cpp
CK2/CKStateChunk.cpp
CK2/CKStateChunkOthers.cpp
CK2/CKStateChunkReader.cpp
CK2/CKStateChunkWriter.cpp
)
set(libcmo_ck2_dh_src
CK2/DataHandlers/CKBitmapHandler.cpp
)
set(libcmo_ck2_mgr_src
CK2/MgrImpls/CKBaseManager.cpp
CK2/MgrImpls/CKObjectManager.cpp
CK2/MgrImpls/CKPathManager.cpp
)
set(libcmo_ck2_obj_src
CK2/ObjImpls/CK3dEntity.cpp
CK2/ObjImpls/CKBeObject.cpp
CK2/ObjImpls/CKGroup.cpp
CK2/ObjImpls/CKMaterial.cpp
CK2/ObjImpls/CKMesh.cpp
CK2/ObjImpls/CKObject.cpp
CK2/ObjImpls/CKTexture.cpp
)
set(libcmo_vxmath_src
VxMath/VxMemoryMappedFile.cpp
VxMath/VxMath.cpp
)
set(libcmo_xcontainer_src
XContainer/XTypes.cpp
)
# create static library
@ -39,6 +64,7 @@ add_library(LibCmo
STATIC
${libcmo_vt_src}
${libcmo_ck2_src}
${libcmo_ck2_dh_src}
${libcmo_ck2_mgr_src}
${libcmo_ck2_obj_src}
${libcmo_vxmath_src}
@ -53,7 +79,17 @@ target_include_directories(LibCmo
PUBLIC
${libcmo_headers}
PRIVATE
${STB_IMAGE_PATH}
${ZLIB_INCLUDE_DIRS}
${Iconv_INCLUDE_DIRS}
)
# 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>
)

View File

@ -129,15 +129,15 @@ namespace LibCmo::VxMath {
namespace NSVxVector {
float LibCmo::VxMath::NSVxVector::DotProduct(const VxVector2& lhs, const VxVector2& rhs) {
float DotProduct(const VxVector2& lhs, const VxVector2& rhs) {
return lhs * rhs;
}
float LibCmo::VxMath::NSVxVector::DotProduct(const VxVector3& lhs, const VxVector3& rhs) {
float DotProduct(const VxVector3& lhs, const VxVector3& rhs) {
return lhs * rhs;
}
float LibCmo::VxMath::NSVxVector::DotProduct(const VxVector4& lhs, const VxVector4& rhs) {
float DotProduct(const VxVector4& lhs, const VxVector4& rhs) {
return lhs * rhs;
}

View File

@ -1,8 +1,13 @@
cmake_minimum_required(VERSION 3.12)
project(Unvirt LANGUAGES CXX)
# set languages
set(CMAKE_CXX_STANDARD 20)
# add libcmo
add_subdirectory("../LibCmo" "LibCmo.out")
# add ironpad
#add_subdirectory("../IronPad" "IronPad.out")
# setup sources
set(unvirt_sources
@ -15,13 +20,11 @@ set(unvirt_sources
Unvirt.cpp
)
# set languages
set(CMAKE_CXX_STANDARD 20)
# generate program
add_executable(Unvirt ${unvirt_sources})
target_link_libraries(Unvirt
PRIVATE
LibCmo
IronPad
)