From 9f0bf65f5fd1933638b563f1b531e06b441a843c Mon Sep 17 00:00:00 2001 From: Osyotr <Osyotr@users.noreply.github.com> Date: Sun, 17 Mar 2024 21:11:37 +0300 Subject: [PATCH 01/14] Link with Qt6::Network on windows Signed-off-by: Osyotr <Osyotr@users.noreply.github.com> --- platform/CMakeLists.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/platform/CMakeLists.txt b/platform/CMakeLists.txt index 374d916871..bcc086bda3 100644 --- a/platform/CMakeLists.txt +++ b/platform/CMakeLists.txt @@ -183,7 +183,7 @@ if (APPLE) target_compile_options(${PROJECT_NAME} PRIVATE "-fobjc-arc") endif() -if (PLATFORM_LINUX) +if (PLATFORM_LINUX OR PLATFORM_WIN) set_target_properties(${PROJECT_NAME} PROPERTIES AUTOMOC ON) endif() @@ -192,6 +192,7 @@ target_link_libraries(${PROJECT_NAME} coding $<$<BOOL:${PLATFORM_DESKTOP}>:Qt6::Core> $<$<BOOL:${PLATFORM_LINUX}>:Qt6::Network> + $<$<BOOL:${PLATFORM_WIN}>:Qt6::Network> $<$<BOOL:${QT_POSITIONING}>:Qt6::Positioning> $<$<BOOL:${PLATFORM_MAC}>: -framework\ Foundation -- 2.45.3 From f7850f1414ce487c958f4c06524a3ada3f0ce791 Mon Sep 17 00:00:00 2001 From: Osyotr <Osyotr@users.noreply.github.com> Date: Sun, 17 Mar 2024 21:12:58 +0300 Subject: [PATCH 02/14] Make find_program(BASH) REQUIRED to prevent build-time errors Signed-off-by: Osyotr <Osyotr@users.noreply.github.com> --- platform/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/CMakeLists.txt b/platform/CMakeLists.txt index bcc086bda3..44ef48e9fa 100644 --- a/platform/CMakeLists.txt +++ b/platform/CMakeLists.txt @@ -101,7 +101,7 @@ elseif(${PLATFORM_ANDROID}) ) else() # neither iPhone nor Android # Find bash first, on Windows it can be either in Git or in WSL - find_program(BASH bash) + find_program(BASH bash REQUIRED) # Generate version header file. execute_process(COMMAND "${BASH}" tools/unix/version.sh qt_version WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} -- 2.45.3 From ae04ac3d41dd3af989c248dff14de7d2e6eee20f Mon Sep 17 00:00:00 2001 From: Osyotr <Osyotr@users.noreply.github.com> Date: Mon, 18 Mar 2024 01:24:35 +0300 Subject: [PATCH 03/14] Link more targets explicitly to pickup transitive dependencies Signed-off-by: Osyotr <Osyotr@users.noreply.github.com> --- cppjansson/CMakeLists.txt | 4 +++- ge0/CMakeLists.txt | 8 ++++++++ routing/CMakeLists.txt | 1 + routing/routing_quality/api/CMakeLists.txt | 5 ++++- routing_common/CMakeLists.txt | 6 ++++++ tracking/CMakeLists.txt | 11 +++++++++++ transit/CMakeLists.txt | 9 ++++++++- 7 files changed, 41 insertions(+), 3 deletions(-) diff --git a/cppjansson/CMakeLists.txt b/cppjansson/CMakeLists.txt index 7fc9b37fa0..8c41b62d56 100644 --- a/cppjansson/CMakeLists.txt +++ b/cppjansson/CMakeLists.txt @@ -7,5 +7,7 @@ set(SRC ) omim_add_library(${PROJECT_NAME} ${SRC}) target_link_libraries(${PROJECT_NAME} - jansson + PUBLIC + base + jansson ) diff --git a/ge0/CMakeLists.txt b/ge0/CMakeLists.txt index a652851899..c8c996004e 100644 --- a/ge0/CMakeLists.txt +++ b/ge0/CMakeLists.txt @@ -10,5 +10,13 @@ set(SRC ) omim_add_library(${PROJECT_NAME} ${SRC}) +target_link_libraries(${PROJECT_NAME} + PUBLIC + coding + + PRIVATE + base + geometry +) omim_add_test_subdirectory(ge0_tests) diff --git a/routing/CMakeLists.txt b/routing/CMakeLists.txt index 5dd2df78d0..8954ec70f9 100644 --- a/routing/CMakeLists.txt +++ b/routing/CMakeLists.txt @@ -185,6 +185,7 @@ set(SRC omim_add_library(${PROJECT_NAME} ${SRC}) target_link_libraries(${PROJECT_NAME} + base routing_common platform traffic diff --git a/routing/routing_quality/api/CMakeLists.txt b/routing/routing_quality/api/CMakeLists.txt index 79b9b473bb..772ca00f60 100644 --- a/routing/routing_quality/api/CMakeLists.txt +++ b/routing/routing_quality/api/CMakeLists.txt @@ -15,5 +15,8 @@ set(SRC omim_add_library(${PROJECT_NAME} ${SRC}) target_link_libraries(${PROJECT_NAME} - jansson # serdes_json.hpp is in coding + PUBLIC + coding + geometry + routing ) diff --git a/routing_common/CMakeLists.txt b/routing_common/CMakeLists.txt index 5d11fdb427..f03636b2d7 100644 --- a/routing_common/CMakeLists.txt +++ b/routing_common/CMakeLists.txt @@ -16,5 +16,11 @@ set(SRC ) omim_add_library(${PROJECT_NAME} ${SRC}) +target_link_libraries(${PROJECT_NAME} + PUBLIC + base + indexer + platform +) omim_add_test_subdirectory(routing_common_tests) diff --git a/tracking/CMakeLists.txt b/tracking/CMakeLists.txt index 75b2fd859b..335f6d899b 100644 --- a/tracking/CMakeLists.txt +++ b/tracking/CMakeLists.txt @@ -19,6 +19,17 @@ set( ) omim_add_library(${PROJECT_NAME} ${SRC}) +target_link_libraries(${PROJECT_NAME} + PUBLIC + routing + traffic + + PRIVATE + base + coding + geometry + platform +) omim_add_test_subdirectory(tracking_tests) diff --git a/transit/CMakeLists.txt b/transit/CMakeLists.txt index 8eebc2b7b2..f74e8898e4 100644 --- a/transit/CMakeLists.txt +++ b/transit/CMakeLists.txt @@ -20,7 +20,14 @@ set(SRC omim_add_library(${PROJECT_NAME} ${SRC}) -target_link_libraries(${PROJECT_NAME} PUBLIC jansson) +target_link_libraries(${PROJECT_NAME} + PUBLIC + base + condig + cppjansson + geometry + indexer +) if (PLATFORM_DESKTOP) add_subdirectory(world_feed) -- 2.45.3 From d825eb46955862dc78e725a2667fc5f75a0b879a Mon Sep 17 00:00:00 2001 From: Osyotr <Osyotr@users.noreply.github.com> Date: Mon, 18 Mar 2024 01:49:06 +0300 Subject: [PATCH 04/14] Don't add unsupported flags on MSVC Drive-by: use add_compile_options instead of add_definitions to set -fno-omit-frame-pointer Signed-off-by: Osyotr <Osyotr@users.noreply.github.com> --- CMakeLists.txt | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 71ecbe2e28..0583e57623 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -103,7 +103,13 @@ if (NOT CMAKE_BUILD_TYPE) endif() # Global compile options for all configurations. -add_compile_options(-ffast-math) +if (MSVC) + add_compile_options(/utf-8) + add_link_options(/INCREMENTAL:NO) + add_link_options(/DEBUG:FULL) +else() + add_compile_options(-ffast-math) +endif() if (PLATFORM_WIN) add_definitions( @@ -114,10 +120,15 @@ endif() # Built-in CMake configurations: Debug, Release, RelWithDebInfo, MinSizeRel if (${CMAKE_BUILD_TYPE} STREQUAL "Debug") - add_definitions(-DDEBUG -fno-omit-frame-pointer) + add_definitions(-DDEBUG) + if (NOT MSVC) + add_compile_options(-fno-omit-frame-pointer) + endif() elseif (${CMAKE_BUILD_TYPE} MATCHES "Rel") add_definitions(-DRELEASE) - add_compile_options(-Ofast) # Also enables -ffast-math + if (NOT MSVC) + add_compile_options(-Ofast) # Also enables -ffast-math + endif() else() message(FATAL_ERROR "Unknown build type: " ${CMAKE_BUILD_TYPE}) endif() -- 2.45.3 From bef0ae874f3e36bab545b69f7d6f308fc00ad53e Mon Sep 17 00:00:00 2001 From: Osyotr <Osyotr@users.noreply.github.com> Date: Sat, 6 Apr 2024 16:14:42 +0300 Subject: [PATCH 05/14] Move find_package(gflags) out of 3party GLOBAL flag for find_package has been added in CMake 3.24 Signed-off-by: Osyotr <Osyotr@users.noreply.github.com> --- 3party/CMakeLists.txt | 5 +---- CMakeLists.txt | 5 +++++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/3party/CMakeLists.txt b/3party/CMakeLists.txt index 7007dcf323..47887932ed 100644 --- a/3party/CMakeLists.txt +++ b/3party/CMakeLists.txt @@ -2,10 +2,7 @@ # Compatibility with CMake < 3.5 will be removed from a future version of CMake. set(CMAKE_WARN_DEPRECATED OFF CACHE BOOL "" FORCE) -if (WITH_SYSTEM_PROVIDED_3PARTY) - set(GFLAGS_USE_TARGET_NAMESPACE ON) - find_package(gflags REQUIRED GLOBAL) -else() +if (NOT WITH_SYSTEM_PROVIDED_3PARTY) # Suppress "Policy CMP0077 is not set: option() honors normal variables" # for the freetype, expat and jansson options. set(CMAKE_POLICY_DEFAULT_CMP0077 NEW) diff --git a/CMakeLists.txt b/CMakeLists.txt index 0583e57623..9465e67549 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -319,6 +319,11 @@ if (PLATFORM_LINUX) find_package(harfbuzz REQUIRED) endif() +if (WITH_SYSTEM_PROVIDED_3PARTY) + set(GFLAGS_USE_TARGET_NAMESPACE ON) + find_package(gflags REQUIRED) +endif() + # Include 3party dependencies. add_subdirectory(3party) -- 2.45.3 From 13a8601641ff017b79b614fb60f3a3fa87256de4 Mon Sep 17 00:00:00 2001 From: Osyotr <Osyotr@users.noreply.github.com> Date: Sat, 6 Apr 2024 16:22:59 +0300 Subject: [PATCH 06/14] Don't hardcode paths to 3party/utfcpp Signed-off-by: Osyotr <Osyotr@users.noreply.github.com> --- 3party/CMakeLists.txt | 4 ++++ 3party/utf8cpp/include/utf8cpp | 1 - CMakeLists.txt | 1 + base/CMakeLists.txt | 1 + base/internal/message.cpp | 2 +- base/string_utils.hpp | 2 +- cmake/OmimConfig.cmake | 2 +- coding/coding_tests/string_utf8_multilang_tests.cpp | 2 +- indexer/search_string_utils.cpp | 2 +- shaders/CMakeLists.txt | 2 +- 10 files changed, 12 insertions(+), 7 deletions(-) delete mode 120000 3party/utf8cpp/include/utf8cpp diff --git a/3party/CMakeLists.txt b/3party/CMakeLists.txt index 47887932ed..92cd3bcb2d 100644 --- a/3party/CMakeLists.txt +++ b/3party/CMakeLists.txt @@ -41,6 +41,10 @@ if (NOT WITH_SYSTEM_PROVIDED_3PARTY) # Add protobuf library. add_subdirectory(protobuf) + + add_library(utf8cpp INTERFACE) + add_library(utf8cpp::utf8cpp ALIAS utf8cpp) + target_include_directories(utf8cpp INTERFACE "${OMIM_ROOT}/3party/utfcpp/source") endif() add_subdirectory(agg) diff --git a/3party/utf8cpp/include/utf8cpp b/3party/utf8cpp/include/utf8cpp deleted file mode 120000 index 43119b90b3..0000000000 --- a/3party/utf8cpp/include/utf8cpp +++ /dev/null @@ -1 +0,0 @@ -../../utfcpp/source \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index 9465e67549..271b0a76bd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -322,6 +322,7 @@ endif() if (WITH_SYSTEM_PROVIDED_3PARTY) set(GFLAGS_USE_TARGET_NAMESPACE ON) find_package(gflags REQUIRED) + find_package(utf8cpp REQUIRED) endif() # Include 3party dependencies. diff --git a/base/CMakeLists.txt b/base/CMakeLists.txt index 69e16cc18c..b2c0f07ed8 100644 --- a/base/CMakeLists.txt +++ b/base/CMakeLists.txt @@ -109,6 +109,7 @@ omim_add_library(${PROJECT_NAME} ${SRC}) set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) target_link_libraries(${PROJECT_NAME} INTERFACE Threads::Threads) +target_link_libraries(${PROJECT_NAME} PUBLIC utf8cpp::utf8cpp) if (NOT WITH_SYSTEM_PROVIDED_3PARTY) target_include_directories(${PROJECT_NAME} PRIVATE "${OMIM_ROOT}/3party/fast_double_parser/include") diff --git a/base/internal/message.cpp b/base/internal/message.cpp index 5b656e1b73..d58cfe62c7 100644 --- a/base/internal/message.cpp +++ b/base/internal/message.cpp @@ -2,7 +2,7 @@ #include "std/target_os.hpp" -#include <utf8cpp/utf8/unchecked.h> +#include <utf8/unchecked.h> std::string DebugPrint(std::string const & t) { diff --git a/base/string_utils.hpp b/base/string_utils.hpp index 211fd930c5..178576a0f1 100644 --- a/base/string_utils.hpp +++ b/base/string_utils.hpp @@ -18,7 +18,7 @@ #include <string_view> #include <type_traits> -#include <utf8cpp/utf8/unchecked.h> +#include <utf8/unchecked.h> /// All methods work with strings in utf-8 format namespace strings diff --git a/cmake/OmimConfig.cmake b/cmake/OmimConfig.cmake index d0aac124ed..a8e04c1de9 100644 --- a/cmake/OmimConfig.cmake +++ b/cmake/OmimConfig.cmake @@ -3,6 +3,6 @@ set(OMIM_WARNING_FLAGS $<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wall -Wextra -Wpedantic> $<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wno-unused-parameter> # We have a lot of functions with unused parameters ) -set(3PARTY_INCLUDE_DIRS "${OMIM_ROOT}/3party/boost" "${OMIM_ROOT}/3party/utf8cpp/include") +set(3PARTY_INCLUDE_DIRS "${OMIM_ROOT}/3party/boost") set(OMIM_DATA_DIR "${OMIM_ROOT}/data") set(OMIM_USER_RESOURCES_DIR "${OMIM_ROOT}/data") diff --git a/coding/coding_tests/string_utf8_multilang_tests.cpp b/coding/coding_tests/string_utf8_multilang_tests.cpp index a1d963f258..12d1945a94 100644 --- a/coding/coding_tests/string_utf8_multilang_tests.cpp +++ b/coding/coding_tests/string_utf8_multilang_tests.cpp @@ -4,7 +4,7 @@ #include "base/control_flow.hpp" -#include <utf8cpp/utf8.h> +#include <utf8.h> #include <cstddef> #include <string> diff --git a/indexer/search_string_utils.cpp b/indexer/search_string_utils.cpp index 9cbc306ab1..09835ae800 100644 --- a/indexer/search_string_utils.cpp +++ b/indexer/search_string_utils.cpp @@ -12,7 +12,7 @@ #include <queue> #include <vector> -#include <utf8cpp/utf8/unchecked.h> +#include <utf8/unchecked.h> namespace search { diff --git a/shaders/CMakeLists.txt b/shaders/CMakeLists.txt index 24680dfef3..11da795e91 100644 --- a/shaders/CMakeLists.txt +++ b/shaders/CMakeLists.txt @@ -143,7 +143,7 @@ if (PLATFORM_IPHONE) endif() # Do not include glm's CMakeLists.txt, because it's outdated and not necessary. -target_include_directories(${PROJECT_NAME} PUBLIC ${OMIM_ROOT}/3party/glm ${OMIM_ROOT}/3party/utf8cpp/include) +target_include_directories(${PROJECT_NAME} PUBLIC "${OMIM_ROOT}/3party/glm") target_link_libraries(${PROJECT_NAME} drape) -- 2.45.3 From b5a73528d0e8873f9904c76032c71433e88e08e2 Mon Sep 17 00:00:00 2001 From: Osyotr <Osyotr@users.noreply.github.com> Date: Sat, 6 Apr 2024 16:27:46 +0300 Subject: [PATCH 07/14] Use system expat explicitly if needed Signed-off-by: Osyotr <Osyotr@users.noreply.github.com> --- 3party/CMakeLists.txt | 1 + CMakeLists.txt | 2 ++ coding/CMakeLists.txt | 2 +- coding/internal/xmlparser.hpp | 2 ++ drape/CMakeLists.txt | 2 +- generator/CMakeLists.txt | 2 +- generator/pygen/CMakeLists.txt | 2 +- kml/pykmlib/CMakeLists.txt | 2 +- track_generator/CMakeLists.txt | 2 +- 9 files changed, 11 insertions(+), 6 deletions(-) diff --git a/3party/CMakeLists.txt b/3party/CMakeLists.txt index 92cd3bcb2d..5d5dc8b2fb 100644 --- a/3party/CMakeLists.txt +++ b/3party/CMakeLists.txt @@ -22,6 +22,7 @@ if (NOT WITH_SYSTEM_PROVIDED_3PARTY) set(EXPAT_DTD OFF) set(EXPAT_NS ON) add_subdirectory(expat/expat) + add_library(expat::expat ALIAS expat) # Configure Jansson library. set(JANSSON_BUILD_DOCS OFF) diff --git a/CMakeLists.txt b/CMakeLists.txt index 271b0a76bd..a0cc1da416 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -322,6 +322,8 @@ endif() if (WITH_SYSTEM_PROVIDED_3PARTY) set(GFLAGS_USE_TARGET_NAMESPACE ON) find_package(gflags REQUIRED) + + find_package(expat CONFIG REQUIRED) find_package(utf8cpp REQUIRED) endif() diff --git a/coding/CMakeLists.txt b/coding/CMakeLists.txt index b4d945351e..301612bce3 100644 --- a/coding/CMakeLists.txt +++ b/coding/CMakeLists.txt @@ -95,7 +95,7 @@ omim_add_library(${PROJECT_NAME} ${SRC}) target_link_libraries(${PROJECT_NAME} base - expat + expat::expat cppjansson succinct ICU::uc diff --git a/coding/internal/xmlparser.hpp b/coding/internal/xmlparser.hpp index f270cd6de1..0d8ca68b05 100644 --- a/coding/internal/xmlparser.hpp +++ b/coding/internal/xmlparser.hpp @@ -12,7 +12,9 @@ #include <sstream> #include <string> +#ifndef XML_STATIC #define XML_STATIC +#endif #include <expat.h> #if defined(__clang__) diff --git a/drape/CMakeLists.txt b/drape/CMakeLists.txt index 061decbaed..9720c8d5eb 100644 --- a/drape/CMakeLists.txt +++ b/drape/CMakeLists.txt @@ -175,7 +175,7 @@ target_link_libraries(${PROJECT_NAME} sdf_image harfbuzz ICU::i18n - expat + expat::expat $<$<BOOL:${PLATFORM_MAC}>:-framework\ OpenGL> $<$<BOOL:${PLATFORM_LINUX}>:OpenGL::GL> ) diff --git a/generator/CMakeLists.txt b/generator/CMakeLists.txt index a669096cd0..5beba476f9 100644 --- a/generator/CMakeLists.txt +++ b/generator/CMakeLists.txt @@ -248,7 +248,7 @@ target_link_libraries(${PROJECT_NAME} descriptions indexer cppjansson - expat + expat::expat tess2 $<$<BOOL:CMAKE_DL_LIBS>:${CMAKE_DL_LIBS}> # dladdr from boost::stacktrace ) diff --git a/generator/pygen/CMakeLists.txt b/generator/pygen/CMakeLists.txt index d8142a7fc9..48f8284ebe 100644 --- a/generator/pygen/CMakeLists.txt +++ b/generator/pygen/CMakeLists.txt @@ -28,7 +28,7 @@ omim_link_libraries( base opening_hours freetype - expat + expat::expat ICU::i18n cppjansson protobuf diff --git a/kml/pykmlib/CMakeLists.txt b/kml/pykmlib/CMakeLists.txt index b9dc934b5f..52f2bfb193 100644 --- a/kml/pykmlib/CMakeLists.txt +++ b/kml/pykmlib/CMakeLists.txt @@ -24,7 +24,7 @@ omim_link_libraries( oauthcpp protobuf pugixml - expat + expat::expat succinct ) diff --git a/track_generator/CMakeLists.txt b/track_generator/CMakeLists.txt index e0d2af7f33..8b387b0520 100644 --- a/track_generator/CMakeLists.txt +++ b/track_generator/CMakeLists.txt @@ -13,6 +13,6 @@ target_link_libraries(${PROJECT_NAME} routing kml coding - expat + expat::expat gflags::gflags ) -- 2.45.3 From 90241c0fb74320541b74e115cbbbb7bce0bee0de Mon Sep 17 00:00:00 2001 From: Osyotr <Osyotr@users.noreply.github.com> Date: Sat, 6 Apr 2024 16:34:04 +0300 Subject: [PATCH 08/14] Use system jansson explicitly if needed Signed-off-by: Osyotr <Osyotr@users.noreply.github.com> --- 3party/CMakeLists.txt | 1 + CMakeLists.txt | 1 + cppjansson/CMakeLists.txt | 2 +- 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/3party/CMakeLists.txt b/3party/CMakeLists.txt index 5d5dc8b2fb..47a10ab892 100644 --- a/3party/CMakeLists.txt +++ b/3party/CMakeLists.txt @@ -32,6 +32,7 @@ if (NOT WITH_SYSTEM_PROVIDED_3PARTY) set(JANSSON_WITHOUT_TESTS ON) add_subdirectory(jansson/jansson/) target_include_directories(jansson INTERFACE "${PROJECT_BINARY_DIR}/3party/jansson/jansson/include") + add_library(jansson::jansson ALIAS jansson) # Add gflags library. add_subdirectory(gflags) diff --git a/CMakeLists.txt b/CMakeLists.txt index a0cc1da416..76e975129f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -324,6 +324,7 @@ if (WITH_SYSTEM_PROVIDED_3PARTY) find_package(gflags REQUIRED) find_package(expat CONFIG REQUIRED) + find_package(jansson CONFIG REQUIRED) find_package(utf8cpp REQUIRED) endif() diff --git a/cppjansson/CMakeLists.txt b/cppjansson/CMakeLists.txt index 8c41b62d56..3996d3c657 100644 --- a/cppjansson/CMakeLists.txt +++ b/cppjansson/CMakeLists.txt @@ -9,5 +9,5 @@ omim_add_library(${PROJECT_NAME} ${SRC}) target_link_libraries(${PROJECT_NAME} PUBLIC base - jansson + jansson::jansson ) -- 2.45.3 From d49d554d10aacd2f2b9220d0f3eb96cf8430ce2d Mon Sep 17 00:00:00 2001 From: Osyotr <Osyotr@users.noreply.github.com> Date: Sat, 6 Apr 2024 16:37:49 +0300 Subject: [PATCH 09/14] Use find_package(ZLIB) to find zlib Signed-off-by: Osyotr <Osyotr@users.noreply.github.com> --- CMakeLists.txt | 7 ++----- coding/CMakeLists.txt | 2 +- generator/pygen/CMakeLists.txt | 2 +- search/pysearch/CMakeLists.txt | 2 +- traffic/pytraffic/CMakeLists.txt | 2 +- 5 files changed, 6 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 76e975129f..b7a9b35905 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -273,11 +273,6 @@ if (NOT PLATFORM_IPHONE AND NOT PLATFORM_ANDROID) find_package(Qt6 COMPONENTS REQUIRED ${qt_components} PATHS $ENV{QT_PATH} /opt/homebrew/opt/qt@6 /usr/local/opt/qt@6 /usr/lib/x86_64-linux-gnu/qt6) endif() -find_library(LIBZ NAMES z) -if (LIBZ STREQUAL "LIBZ-NOTFOUND") - message(FATAL_ERROR "Failed to find libz library.") -endif() - # To allow #include "base/file_name.hpp" in all sources. include_directories(${CMAKE_HOME_DIRECTORY}) @@ -328,6 +323,8 @@ if (WITH_SYSTEM_PROVIDED_3PARTY) find_package(utf8cpp REQUIRED) endif() +find_package(ZLIB REQUIRED) + # Include 3party dependencies. add_subdirectory(3party) diff --git a/coding/CMakeLists.txt b/coding/CMakeLists.txt index 301612bce3..b9972aa0a5 100644 --- a/coding/CMakeLists.txt +++ b/coding/CMakeLists.txt @@ -102,7 +102,7 @@ target_link_libraries(${PROJECT_NAME} ICU::i18n # For transliteration. oauthcpp # For base64_encode and base64_decode minizip - ${LIBZ} + ZLIB::ZLIB ) omim_add_test_subdirectory(coding_tests) diff --git a/generator/pygen/CMakeLists.txt b/generator/pygen/CMakeLists.txt index 48f8284ebe..3583d44913 100644 --- a/generator/pygen/CMakeLists.txt +++ b/generator/pygen/CMakeLists.txt @@ -40,7 +40,7 @@ omim_link_libraries( oauthcpp sqlite3 ${CMAKE_DL_LIBS} - ${LIBZ} + ZLIB::ZLIB ${Boost_LIBRARIES} ) diff --git a/search/pysearch/CMakeLists.txt b/search/pysearch/CMakeLists.txt index afa2e0d0f7..38badf2900 100644 --- a/search/pysearch/CMakeLists.txt +++ b/search/pysearch/CMakeLists.txt @@ -32,7 +32,7 @@ omim_link_libraries( pugixml succinct ${Boost_LIBRARIES} - ${LIBZ} + ZLIB::ZLIB ) link_qt5_core(${PROJECT_NAME}) diff --git a/traffic/pytraffic/CMakeLists.txt b/traffic/pytraffic/CMakeLists.txt index c51e2d52aa..0dd0c16d96 100644 --- a/traffic/pytraffic/CMakeLists.txt +++ b/traffic/pytraffic/CMakeLists.txt @@ -44,7 +44,7 @@ omim_link_libraries( succinct ICU::i18n ${Boost_LIBRARIES} - ${LIBZ} + ZLIB::ZLIB ) set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "") -- 2.45.3 From 616cde39677ef6a4a489dd41e0dff1818e3ac7c5 Mon Sep 17 00:00:00 2001 From: Osyotr <Osyotr@users.noreply.github.com> Date: Sat, 6 Apr 2024 16:41:30 +0300 Subject: [PATCH 10/14] Don't use vendored Freetype, ICU and HarfBuzz when WITH_SYSTEM_PROVIDED_3PARTY is set Signed-off-by: Osyotr <Osyotr@users.noreply.github.com> --- 3party/CMakeLists.txt | 13 ++++++------- CMakeLists.txt | 2 +- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/3party/CMakeLists.txt b/3party/CMakeLists.txt index 47a10ab892..d4996e302d 100644 --- a/3party/CMakeLists.txt +++ b/3party/CMakeLists.txt @@ -44,6 +44,12 @@ if (NOT WITH_SYSTEM_PROVIDED_3PARTY) # Add protobuf library. add_subdirectory(protobuf) + if (NOT PLATFORM_LINUX) + add_subdirectory(freetype) + add_subdirectory(icu) + add_subdirectory(harfbuzz) + endif() + add_library(utf8cpp INTERFACE) add_library(utf8cpp::utf8cpp ALIAS utf8cpp) target_include_directories(utf8cpp INTERFACE "${OMIM_ROOT}/3party/utfcpp/source") @@ -51,13 +57,6 @@ endif() add_subdirectory(agg) add_subdirectory(bsdiff-courgette) - -if (NOT PLATFORM_LINUX) - add_subdirectory(freetype) - add_subdirectory(icu) - add_subdirectory(harfbuzz) -endif() - add_subdirectory(liboauthcpp) add_subdirectory(minizip) add_subdirectory(open-location-code) diff --git a/CMakeLists.txt b/CMakeLists.txt index b7a9b35905..6ce62b958e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -308,7 +308,7 @@ if (USE_PCH) endif() # Should be on the root level, not in 3party, so tests can get these dependencies. -if (PLATFORM_LINUX) +if (PLATFORM_LINUX OR PLATFORM_WIN) find_package(ICU COMPONENTS uc i18n data REQUIRED) find_package(Freetype REQUIRED) find_package(harfbuzz REQUIRED) -- 2.45.3 From c4dccc61358a31c0fdc1c227292d382666c68927 Mon Sep 17 00:00:00 2001 From: Osyotr <Osyotr@users.noreply.github.com> Date: Sat, 6 Apr 2024 16:44:46 +0300 Subject: [PATCH 11/14] Find pugixml explicitly Signed-off-by: Osyotr <Osyotr@users.noreply.github.com> --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6ce62b958e..d54a936fab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -320,6 +320,7 @@ if (WITH_SYSTEM_PROVIDED_3PARTY) find_package(expat CONFIG REQUIRED) find_package(jansson CONFIG REQUIRED) + find_package(pugixml REQUIRED) find_package(utf8cpp REQUIRED) endif() -- 2.45.3 From 3fc33f3840623dd4c1cc7c0f7953c867678de038 Mon Sep 17 00:00:00 2001 From: Osyotr <Osyotr@users.noreply.github.com> Date: Sat, 6 Apr 2024 17:06:51 +0300 Subject: [PATCH 12/14] Fix typo in target name Signed-off-by: Osyotr <Osyotr@users.noreply.github.com> --- transit/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/transit/CMakeLists.txt b/transit/CMakeLists.txt index f74e8898e4..2a7067ddcf 100644 --- a/transit/CMakeLists.txt +++ b/transit/CMakeLists.txt @@ -23,7 +23,7 @@ omim_add_library(${PROJECT_NAME} ${SRC}) target_link_libraries(${PROJECT_NAME} PUBLIC base - condig + coding cppjansson geometry indexer -- 2.45.3 From 21b6b7ac828900360efdac65b636feec29167b78 Mon Sep 17 00:00:00 2001 From: Osyotr <Osyotr@users.noreply.github.com> Date: Sat, 6 Apr 2024 17:40:43 +0300 Subject: [PATCH 13/14] Update utfcpp include path Signed-off-by: Osyotr <Osyotr@users.noreply.github.com> --- xcode/common.xcconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xcode/common.xcconfig b/xcode/common.xcconfig index 722a8b6337..95ba151e16 100644 --- a/xcode/common.xcconfig +++ b/xcode/common.xcconfig @@ -5,7 +5,7 @@ QT_PATH[arch=arm64] = /opt/homebrew/opt/qt@6 BOOST_ROOT = $(OMIM_ROOT)/3party/boost // jansson is included in many libs, and is also used in headers (leaks to other libs) -HEADER_SEARCH_PATHS = $(inherited) $(OMIM_ROOT) $(BOOST_ROOT) $(OMIM_ROOT)/3party/jansson $(OMIM_ROOT)/3party/jansson/jansson/src $(OMIM_ROOT)/3party/utf8cpp/include +HEADER_SEARCH_PATHS = $(inherited) $(OMIM_ROOT) $(BOOST_ROOT) $(OMIM_ROOT)/3party/jansson $(OMIM_ROOT)/3party/jansson/jansson/src $(OMIM_ROOT)/3party/utfcpp/source FRAMEWORK_SEARCH_PATHS[sdk=macosx*] = $(QT_PATH)/lib // Deployment target -- 2.45.3 From 207e9b1401d8126e51ac9435a4d9e84e4fb23395 Mon Sep 17 00:00:00 2001 From: Osyotr <Osyotr@users.noreply.github.com> Date: Sat, 6 Apr 2024 20:14:08 +0300 Subject: [PATCH 14/14] Let CMake handle /DEBUG flag for MSVC Signed-off-by: Osyotr <Osyotr@users.noreply.github.com> --- CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d54a936fab..602c0d81a3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -106,7 +106,6 @@ endif() if (MSVC) add_compile_options(/utf-8) add_link_options(/INCREMENTAL:NO) - add_link_options(/DEBUG:FULL) else() add_compile_options(-ffast-math) endif() -- 2.45.3