| 1 | Unbundles fmt, re2, expected, libplum dependencies.
|
| 2 |
|
| 3 | patch by Lilah Tascheter <[email protected]> and bdunahu <[email protected]>.
|
| 4 |
|
| 5 | diff --git a/3rdparty/CMakeLists.txt b/3rdparty/CMakeLists.txt
|
| 6 | index 46c0c26e1..dcebb5326 100644
|
| 7 | |
| 8 | |
| 9 | @@ -20,13 +20,13 @@ endif()
|
| 10 | add_subdirectory(launchinfo EXCLUDE_FROM_ALL)
|
| 11 | set_property(TARGET launchinfo PROPERTY FOLDER "3rdparty")
|
| 12 |
|
| 13 | -SET(FMT_INSTALL OFF CACHE BOOL "Generate the install target" FORCE)
|
| 14 | -SET(FMT_SYSTEM_HEADERS ON CACHE BOOL "Expose headers with marking them as system." FORCE)
|
| 15 | -add_subdirectory(fmt EXCLUDE_FROM_ALL)
|
| 16 | -set_property(TARGET fmt PROPERTY FOLDER "3rdparty")
|
| 17 | -# Define a custom inline namespace for the fmt used by WZ, to prevent ODR violations if static linking to any libraries that themselves embed (a different version of) fmt
|
| 18 | -target_compile_definitions(fmt PUBLIC "FMT_BEGIN_NAMESPACE=namespace fmt { inline namespace v12_wz2100 {")
|
| 19 | -target_compile_definitions(fmt PUBLIC "FMT_END_NAMESPACE=}}")
|
| 20 | +pkg_check_modules(FMT REQUIRED fmt)
|
| 21 | +add_library(fmt UNKNOWN IMPORTED)
|
| 22 | +set_target_properties(fmt PROPERTIES
|
| 23 | + IMPORTED_LOCATION ${FMT_LIBRARIES}
|
| 24 | + INTERFACE_INCLUDE_DIRECTORIES ${FMT_INCLUDE_DIRS}
|
| 25 | + INTERFACE_LINK_LIBRARIES ${FMT_LINK_LIBRARIES}
|
| 26 | +)
|
| 27 |
|
| 28 |
|
| 29 | # inih library
|
| 30 | @@ -44,15 +44,13 @@ target_compile_definitions(inih PRIVATE
|
| 31 | )
|
| 32 |
|
| 33 | # re2
|
| 34 | -SET(RE2_BUILD_TESTING OFF CACHE BOOL "enable testing for RE2" FORCE)
|
| 35 | -add_subdirectory(re2 EXCLUDE_FROM_ALL)
|
| 36 | -target_include_directories(re2 PUBLIC
|
| 37 | - $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/re2>
|
| 38 | +pkg_check_modules(RE2 REQUIRED re2)
|
| 39 | +add_library(re2 UNKNOWN IMPORTED)
|
| 40 | +set_target_properties(re2 PROPERTIES
|
| 41 | + IMPORTED_LOCATION ${RE2_LIBRARIES}
|
| 42 | + INTERFACE_INCLUDE_DIRECTORIES ${RE2_INCLUDE_DIRS}
|
| 43 | + INTERFACE_LINK_LIBRARIES ${RE2_LINK_LIBRARIES}
|
| 44 | )
|
| 45 | -set_property(TARGET re2 PROPERTY FOLDER "3rdparty")
|
| 46 | -set_property(TARGET re2 PROPERTY XCODE_ATTRIBUTE_GCC_WARN_ABOUT_MISSING_FIELD_INITIALIZERS NO) # -Wmissing-field-initializers
|
| 47 | -set_property(TARGET re2 PROPERTY XCODE_ATTRIBUTE_GCC_WARN_SHADOW NO) # -Wshadow
|
| 48 | -set_property(TARGET re2 PROPERTY XCODE_ATTRIBUTE_WARNING_CFLAGS "-Wno-missing-field-initializers -Wno-shadow")
|
| 49 |
|
| 50 | add_subdirectory(EmbeddedJSONSignature EXCLUDE_FROM_ALL)
|
| 51 | set_property(TARGET EmbeddedJSONSignature PROPERTY FOLDER "3rdparty")
|
| 52 | @@ -268,35 +266,6 @@ if (WZ_PROFILING_NVTX)
|
| 53 |
|
| 54 | endif ()
|
| 55 |
|
| 56 | -set(PLUM_NO_EXAMPLE ON CACHE BOOL "Disable example build" FORCE)
|
| 57 | -add_subdirectory(libplum EXCLUDE_FROM_ALL)
|
| 58 | -set_target_properties(plum plum-static PROPERTIES FOLDER "3rdparty")
|
| 59 | -if(NOT MSVC)
|
| 60 | - set(_supported_libplum_c_compiler_flags "")
|
| 61 | -
|
| 62 | - # -Wshadow
|
| 63 | - check_compiler_flags_output("-Werror -Wno-shadow -Wno-error=cpp" COMPILER_TYPE C OUTPUT_FLAGS "-Wno-shadow" OUTPUT_VARIABLE _supported_libplum_c_compiler_flags APPEND)
|
| 64 | -
|
| 65 | - if (NOT _supported_libplum_c_compiler_flags STREQUAL "")
|
| 66 | - string(REPLACE " " ";" _supported_libplum_c_compiler_flags "${_supported_libplum_c_compiler_flags}")
|
| 67 | - target_compile_options(plum PRIVATE ${_supported_libplum_c_compiler_flags})
|
| 68 | - target_compile_options(plum-static PRIVATE ${_supported_libplum_c_compiler_flags})
|
| 69 | - endif()
|
| 70 | -endif()
|
| 71 | -
|
| 72 | -set(EXPECTED_BUILD_TESTS OFF)
|
| 73 | -add_subdirectory(expected EXCLUDE_FROM_ALL)
|
| 74 | -# There isn't any release note or established CMake policy about this behavior,
|
| 75 | -# but looks like prior to CMake 3.19 only a handful of `INTERFACE_*` properties
|
| 76 | -# were allowed for INTERFACE libraries (which is our case). This restriction
|
| 77 | -# seems to be lifted in CMake 3.19 and later.
|
| 78 | -#
|
| 79 | -# See https://discourse.cmake.org/t/how-to-find-current-interface-library-property-whitelist/4784/2
|
| 80 | -# for some clarification about this.
|
| 81 | -if (CMAKE_VERSION VERSION_GREATER "3.18")
|
| 82 | - set_target_properties(expected PROPERTIES FOLDER "3rdparty")
|
| 83 | -endif()
|
| 84 | -
|
| 85 | set(_default_enable_gns_network_backend_value ON)
|
| 86 | if(CMAKE_SYSTEM_NAME MATCHES "Emscripten")
|
| 87 | set(_default_enable_gns_network_backend_value OFF)
|
| 88 | diff --git a/lib/ivis_opengl/CMakeLists.txt b/lib/ivis_opengl/CMakeLists.txt
|
| 89 | index fd2d62a2c..72e9c7544 100644
|
| 90 | |
| 91 | |
| 92 | @@ -90,7 +90,7 @@ set_property(TARGET ivis-opengl PROPERTY FOLDER "lib")
|
| 93 | include(WZTargetConfiguration)
|
| 94 | WZ_TARGET_CONFIGURATION(ivis-opengl)
|
| 95 |
|
| 96 | -target_link_libraries(ivis-opengl PRIVATE framework launchinfo fmt::fmt)
|
| 97 | +target_link_libraries(ivis-opengl PRIVATE framework launchinfo fmt)
|
| 98 | if(CMAKE_SYSTEM_NAME MATCHES "Emscripten")
|
| 99 | # We should be using the Emscripten port linker flags for FreeType & Harfbuzz
|
| 100 | else()
|
| 101 | diff --git a/lib/netplay/CMakeLists.txt b/lib/netplay/CMakeLists.txt
|
| 102 | index 511ac7b89..82efbe6f4 100644
|
| 103 | |
| 104 | |
| 105 | @@ -84,6 +84,8 @@ if(MSVC AND CMAKE_VERSION VERSION_GREATER 3.7)
|
| 106 | source_group(TREE "${CMAKE_CURRENT_LIST_DIR}" PREFIX "Headers" FILES ${HEADERS})
|
| 107 | endif()
|
| 108 |
|
| 109 | +find_package (tl-expected REQUIRED)
|
| 110 | +find_package (LibPlum REQUIRED)
|
| 111 | find_package (Threads REQUIRED)
|
| 112 | find_package (ZLIB REQUIRED)
|
| 113 |
|
| 114 | @@ -113,7 +115,7 @@ set_property(TARGET netplay PROPERTY FOLDER "lib")
|
| 115 | include(WZTargetConfiguration)
|
| 116 | WZ_TARGET_CONFIGURATION(netplay)
|
| 117 | target_link_libraries(netplay
|
| 118 | - PRIVATE framework re2::re2 nlohmann_json plum-static Threads::Threads ZLIB::ZLIB fmt::fmt
|
| 119 | + PRIVATE framework re2 nlohmann_json plum Threads::Threads ZLIB::ZLIB fmt
|
| 120 | PUBLIC tl::expected)
|
| 121 |
|
| 122 | if(WZ_USE_IMPORTED_MINIUPNPC)
|
| 123 | diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
|
| 124 | index 4f07f0edb..4fe645425 100644
|
| 125 | |
| 126 | |
| 127 | @@ -130,7 +130,7 @@ endif()
|
| 128 |
|
| 129 | target_link_libraries(warzone2100 exception-handler gamelib wzmaplib ZipIOProvider ivis-opengl netplay sdl-backend framework sequence sound widget)
|
| 130 | target_link_libraries(warzone2100 launchinfo EmbeddedJSONSignature)
|
| 131 | -target_link_libraries(warzone2100 fmt::fmt)
|
| 132 | +target_link_libraries(warzone2100 fmt)
|
| 133 | if(ENABLE_NLS)
|
| 134 | target_link_libraries(warzone2100 ${Intl_LIBRARIES})
|
| 135 | endif()
|
| 136 | @@ -146,7 +146,7 @@ else()
|
| 137 | include(IncludeFindCurl)
|
| 138 | target_link_libraries(warzone2100 CURL::libcurl)
|
| 139 | endif()
|
| 140 | -target_link_libraries(warzone2100 re2::re2)
|
| 141 | +target_link_libraries(warzone2100 re2)
|
| 142 |
|
| 143 | find_package(SQLite3 3.14 REQUIRED)
|
| 144 | target_link_libraries(warzone2100 SQLite::SQLite3)
|