From 00e00aa299eceb89c967786dc55f8eba82e795af Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Wed, 26 Aug 2020 23:38:58 -0400 Subject: [PATCH 1/3] Add `target_include_directories` for the library. --- Python/CMakeLists.txt | 1 - Tools/CMakeLists.txt | 2 -- core/CMakeLists.txt | 4 ++++ net/CMakeLists.txt | 4 ++++ 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/Python/CMakeLists.txt b/Python/CMakeLists.txt index d50dfc5a8..03fe40c3a 100644 --- a/Python/CMakeLists.txt +++ b/Python/CMakeLists.txt @@ -22,7 +22,6 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) endif() endif() -include_directories(${PROJECT_SOURCE_DIR}/core) include_directories(${PYTHON_INCLUDE_DIRS}) include_directories(./) diff --git a/Tools/CMakeLists.txt b/Tools/CMakeLists.txt index 0edb5b2ac..b90852064 100644 --- a/Tools/CMakeLists.txt +++ b/Tools/CMakeLists.txt @@ -1,5 +1,3 @@ -include_directories(${PROJECT_SOURCE_DIR}/core) - try_compile(DIRENT_IS_CONST ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR}/cmake/check_dirent.cpp OUTPUT_VARIABLE OUTPUT) diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index 9c74384cd..346e1a66e 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -806,6 +806,10 @@ if(PHYSX_FOUND AND ENABLE_PHYSX) target_link_libraries(HSPlasma ${PHYSX_COOKING_LIBRARY}) endif(PHYSX_FOUND AND ENABLE_PHYSX) +target_include_directories(HSPlasma PUBLIC + $ + $) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libhsplasma.pc.in.cmake ${CMAKE_CURRENT_BINARY_DIR}/libhsplasma.pc @ONLY) # Package Installation diff --git a/net/CMakeLists.txt b/net/CMakeLists.txt index 271b01098..3e95d1238 100644 --- a/net/CMakeLists.txt +++ b/net/CMakeLists.txt @@ -104,6 +104,10 @@ if(WIN32) target_link_libraries(HSPlasmaNet ws2_32) endif(WIN32) +target_include_directories(HSPlasmaNet PUBLIC + $ + $) + configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libhsplasmanet.pc.in.cmake ${CMAKE_CURRENT_BINARY_DIR}/libhsplasmanet.pc @ONLY) # Package installation From 286108d70ab7ea2b18ddb313969972b74c8ac4aa Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Thu, 27 Aug 2020 00:19:53 -0400 Subject: [PATCH 2/3] Make CMake config relocatable. While this should be functionally the same as before, it utlizes built-in CMake functionality so tools that depend on kludges like string replacement can more easily match what we're doing. --- core/CMakeLists.txt | 9 ++++++++- core/HSPlasmaConfig.cmake | 3 --- core/HSPlasmaConfig.cmake.in | 5 +++++ net/CMakeLists.txt | 9 ++++++++- net/HSPlasmaNetConfig.cmake | 5 ----- net/HSPlasmaNetConfig.cmake.in | 8 ++++++++ 6 files changed, 29 insertions(+), 10 deletions(-) delete mode 100644 core/HSPlasmaConfig.cmake create mode 100644 core/HSPlasmaConfig.cmake.in delete mode 100644 net/HSPlasmaNetConfig.cmake create mode 100644 net/HSPlasmaNetConfig.cmake.in diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index 346e1a66e..03724c436 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -819,7 +819,14 @@ install(TARGETS HSPlasma LIBRARY DESTINATION lib ARCHIVE DESTINATION lib ) -install(FILES HSPlasmaConfig.cmake DESTINATION share/cmake/HSPlasma) + +include(CMakePackageConfigHelpers) +configure_package_config_file(HSPlasmaConfig.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/HSPlasmaConfig.cmake + INSTALL_DESTINATION ${CMAKE_INSTALL_PREFIX}/share/cmake/HSPlasma) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/HSPlasmaConfig.cmake + DESTINATION ${CMAKE_INSTALL_PREFIX}/share/cmake/HSPlasma) + install(FILES ${DEBUG_HEADERS} DESTINATION include/HSPlasma/Debug) install(FILES ${MATH_HEADERS} DESTINATION include/HSPlasma/Math) install(FILES ${PRP_ANIM_HEADERS} DESTINATION include/HSPlasma/PRP/Animation) diff --git a/core/HSPlasmaConfig.cmake b/core/HSPlasmaConfig.cmake deleted file mode 100644 index 48fe3e4fe..000000000 --- a/core/HSPlasmaConfig.cmake +++ /dev/null @@ -1,3 +0,0 @@ -get_filename_component(SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) -include(${SELF_DIR}/HSPlasma-targets.cmake) -get_filename_component(HSPlasma_INCLUDE_DIRS "${SELF_DIR}/../../../include/HSPlasma" ABSOLUTE) diff --git a/core/HSPlasmaConfig.cmake.in b/core/HSPlasmaConfig.cmake.in new file mode 100644 index 000000000..0169e4f11 --- /dev/null +++ b/core/HSPlasmaConfig.cmake.in @@ -0,0 +1,5 @@ +include(${CMAKE_CURRENT_LIST_DIR}/HSPlasma-targets.cmake) + +@PACKAGE_INIT@ + +set_and_check(HSPlasma_INCLUDE_DIRS "${PACKAGE_PREFIX_DIR}/include/HSPlasma") diff --git a/net/CMakeLists.txt b/net/CMakeLists.txt index 3e95d1238..8a02fc4fd 100644 --- a/net/CMakeLists.txt +++ b/net/CMakeLists.txt @@ -117,7 +117,14 @@ install(TARGETS HSPlasmaNet LIBRARY DESTINATION lib ARCHIVE DESTINATION lib ) -install(FILES HSPlasmaNetConfig.cmake DESTINATION share/cmake/HSPlasmaNet) + +include(CMakePackageConfigHelpers) +configure_package_config_file(HSPlasmaNetConfig.cmake.in + ${CMAKE_CURRENT_BINARY_DIR}/HSPlasmaNetConfig.cmake + INSTALL_DESTINATION ${CMAKE_INSTALL_PREFIX}/share/cmake/HSPlasmaNet) +install(FILES ${CMAKE_CURRENT_BINARY_DIR}/HSPlasmaNetConfig.cmake + DESTINATION ${CMAKE_INSTALL_PREFIX}/share/cmake/HSPlasmaNet) + install(FILES ${PN_AUTH_HEADERS} DESTINATION include/HSPlasmaNet/auth) install(FILES ${PN_CRYPT_HEADERS} DESTINATION include/HSPlasmaNet/crypt) install(FILES ${PN_FILE_HEADERS} DESTINATION include/HSPlasmaNet/file) diff --git a/net/HSPlasmaNetConfig.cmake b/net/HSPlasmaNetConfig.cmake deleted file mode 100644 index 539fdb815..000000000 --- a/net/HSPlasmaNetConfig.cmake +++ /dev/null @@ -1,5 +0,0 @@ -find_package(HSPlasma) -get_filename_component(SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) -get_filename_component(HSPlasmaNet_INCLUDE_DIR "${SELF_DIR}/../../../include/HSPlasmaNet" ABSOLUTE) -set(HSPlasmaNet_INCLUDE_DIRS ${HSPlasmaNet_INCLUDE_DIR} ${HSPlasma_INCLUDE_DIRS}) -set(HSPlasmaNet_LIBRARIES HSPlasmaNet HSPlasma) \ No newline at end of file diff --git a/net/HSPlasmaNetConfig.cmake.in b/net/HSPlasmaNetConfig.cmake.in new file mode 100644 index 000000000..cb39db0fa --- /dev/null +++ b/net/HSPlasmaNetConfig.cmake.in @@ -0,0 +1,8 @@ +include(${CMAKE_CURRENT_LIST_DIR}/HSPlasmaNet-targets.cmake) + +@PACKAGE_INIT@ + +find_package(HSPlasma) +set_and_check(HSPlasmaNet_INCLUDE_DIR "${PACKAGE_PREFIX_DIR}/include/HSPlasmaNet") +set(HSPlasmaNet_INCLUDE_DIRS ${HSPlasmaNet_INCLUDE_DIR} ${HSPlasma_INCLUDE_DIRS}) +set(HSPlasmaNet_LIBRARIES HSPlasmaNet HSPlasma) From 1d88c0d90eeb18d93a82af28f16e624518cd5e02 Mon Sep 17 00:00:00 2001 From: Adam Johnson Date: Thu, 27 Aug 2020 02:34:00 -0400 Subject: [PATCH 3/3] Use `/bigobj` on MSVC due to plFactory. --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cd91ef04c..a6d97f7aa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,7 +30,7 @@ endif() if(MSVC) add_definitions("-D_CRT_SECURE_NO_WARNINGS") - set(CMAKE_CXX_FLAGS "/wd4996 /wd4244 /wd4251 /wd4351 ${CMAKE_CXX_FLAGS}") + set(CMAKE_CXX_FLAGS "/bigobj /wd4996 /wd4244 /wd4251 /wd4351 ${CMAKE_CXX_FLAGS}") set(CMAKE_C_FLAGS "/wd4996 /wd4244 /wd4251 /wd4351 ${CMAKE_C_FLAGS}") endif()