diff --git a/IronPad/CMakeLists.txt b/IronPad/CMakeLists.txt new file mode 100644 index 0000000..5452976 --- /dev/null +++ b/IronPad/CMakeLists.txt @@ -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} +) diff --git a/LibCmo/CMakeLists.txt b/LibCmo/CMakeLists.txt index 925d7e1..d0beebe 100644 --- a/LibCmo/CMakeLists.txt +++ b/LibCmo/CMakeLists.txt @@ -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 + $<$:LIBCMO_BUILD_DEBUG> + $<$:LIBCMO_BUILD_RELEASE> + $<$:LIBCMO_BUILD_RELEASE> + $<$:LIBCMO_BUILD_RELEASE> +) + diff --git a/LibCmo/VxMath/VxMath.cpp b/LibCmo/VxMath/VxMath.cpp index d60f59f..064195d 100644 --- a/LibCmo/VxMath/VxMath.cpp +++ b/LibCmo/VxMath/VxMath.cpp @@ -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; } diff --git a/Unvirt/CMakeLists.txt b/Unvirt/CMakeLists.txt index f484941..c3ba74a 100644 --- a/Unvirt/CMakeLists.txt +++ b/Unvirt/CMakeLists.txt @@ -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 )