From c892f7fc46909578d9392f86b7371bf7e72a5c81 Mon Sep 17 00:00:00 2001 From: tooomm Date: Sun, 6 Sep 2026 19:00:47 +0200 Subject: [PATCH 1/2] fix Qt variable name --- cmake/FindQtRuntime.cmake | 32 +++++++++---------- cockatrice/CMakeLists.txt | 2 +- libcockatrice_network/CMakeLists.txt | 2 +- .../network/client/CMakeLists.txt | 2 +- .../network/client/abstract/CMakeLists.txt | 5 ++- .../network/client/local/CMakeLists.txt | 5 ++- .../network/client/remote/CMakeLists.txt | 4 +-- .../network/server/CMakeLists.txt | 2 +- .../network/server/local/CMakeLists.txt | 2 +- .../network/server/remote/CMakeLists.txt | 2 +- libcockatrice_utility/CMakeLists.txt | 2 -- oracle/CMakeLists.txt | 2 +- servatrice/CMakeLists.txt | 4 +-- tests/CMakeLists.txt | 29 ++++++++--------- tests/carddatabase/CMakeLists.txt | 6 ++-- tests/deck_list_model/CMakeLists.txt | 4 +-- tests/deck_list_zones/CMakeLists.txt | 2 +- tests/loading_from_clipboard/CMakeLists.txt | 2 +- tests/movecard_tests/CMakeLists.txt | 2 +- tests/oracle/CMakeLists.txt | 6 ++-- tests/settings/CMakeLists.txt | 6 ++-- 21 files changed, 59 insertions(+), 64 deletions(-) diff --git a/cmake/FindQtRuntime.cmake b/cmake/FindQtRuntime.cmake index 68f53c7ca..45bb8200e 100644 --- a/cmake/FindQtRuntime.cmake +++ b/cmake/FindQtRuntime.cmake @@ -41,37 +41,40 @@ set(QT_COMPONENTS_ORACLE Concurrent Network Svg Widgets) set(QT_COMPONENTS_SERVATRICE Network Sql WebSockets) +# Union of Qt modules required across all test targets (independent of application targets). +# When adding a new test that needs additional Qt modules, add them here instead to tests/CMakeLists.txt. set(QT_COMPONENTS_TEST Concurrent Network Svg Widgets) # --------------------------------------------------------------------------- # Determine which Qt components are required for this build # --------------------------------------------------------------------------- -set(REQUIRED_QT_COMPONENTS Core) +set(QT_COMPONENTS_REQUIRED Core) if(WITH_CLIENT) - list(APPEND REQUIRED_QT_COMPONENTS ${QT_COMPONENTS_COCKATRICE}) + list(APPEND QT_COMPONENTS_REQUIRED ${QT_COMPONENTS_COCKATRICE}) endif() if(WITH_ORACLE) - list(APPEND REQUIRED_QT_COMPONENTS ${QT_COMPONENTS_ORACLE}) + list(APPEND QT_COMPONENTS_REQUIRED ${QT_COMPONENTS_ORACLE}) endif() if(WITH_SERVER) - list(APPEND REQUIRED_QT_COMPONENTS ${QT_COMPONENTS_SERVATRICE}) + list(APPEND QT_COMPONENTS_REQUIRED ${QT_COMPONENTS_SERVATRICE}) endif() if(TEST) - list(APPEND REQUIRED_QT_COMPONENTS ${QT_COMPONENTS_TEST}) + list(APPEND QT_COMPONENTS_REQUIRED ${QT_COMPONENTS_TEST}) endif() -list(REMOVE_DUPLICATES REQUIRED_QT_COMPONENTS) +list(REMOVE_DUPLICATES QT_COMPONENTS_REQUIRED) # --------------------------------------------------------------------------- # Find Qt and define minimum version centrally # --------------------------------------------------------------------------- -find_package(Qt6 6.4 REQUIRED COMPONENTS ${REQUIRED_QT_COMPONENTS} LinguistTools) +# Add Qt Linguist as required component unrelated of build target +find_package(Qt6 6.4 REQUIRED COMPONENTS ${QT_COMPONENTS_REQUIRED} LinguistTools) set(QT_MAIN_VERSION_STRING Qt6) @@ -92,10 +95,11 @@ else() endif() # --------------------------------------------------------------------------- -# Convert components list, e.g.: Network;Sql;WebSockets -# into Qt modules: Qt6::Network;Qt6::Sql;Qt6::WebSockets +# Export Qt target lists for individual targets # --------------------------------------------------------------------------- +# Convert components list into Qt modules, e.g. +# Network;Sql;WebSockets --> Qt6::Network;Qt6::Sql;Qt6::WebSockets function(_qt_components_to_targets COMPONENTS OUTPUT_VARIABLE) set(TARGETS) @@ -109,10 +113,6 @@ function(_qt_components_to_targets COMPONENTS OUTPUT_VARIABLE) ) endfunction() -# --------------------------------------------------------------------------- -# Export Qt target lists for the individual targets -# --------------------------------------------------------------------------- - if(WITH_CLIENT) _qt_components_to_targets("${QT_COMPONENTS_COCKATRICE}" QT_MODULES_COCKATRICE) endif() @@ -133,7 +133,7 @@ endif() set(QT_CORE_MODULE "${QT_MAIN_VERSION_STRING}::Core") # --------------------------------------------------------------------------- -# Qt runtime/plugin paths +# Qt runtime library & plugin paths # --------------------------------------------------------------------------- if(NOT TARGET "${QT_CORE_MODULE}") @@ -146,7 +146,7 @@ get_filename_component(QT_LIBRARY_DIR "${QT_LIBRARY_DIR}/../../.." ABSOLUTE) get_filename_component(QT_PLUGINS_DIR "${Qt6Core_DIR}/../../../${QT6_INSTALL_PLUGINS}" ABSOLUTE) if(UNIX AND APPLE) - # macOS needs a bit more help finding all necessary components. + # macOS needs a bit more help finding all necessary components list(APPEND QT_LIBRARY_DIR "/usr/local/lib") endif() @@ -155,7 +155,7 @@ endif() # --------------------------------------------------------------------------- message(STATUS "Found Qt: ${Qt6_DIR} (found version \"${Qt6_VERSION}\")") -message(STATUS "REQUIRED_QT_COMPONENTS = ${REQUIRED_QT_COMPONENTS}") +message(STATUS "QT_COMPONENTS_REQUIRED = ${QT_COMPONENTS_REQUIRED}") if(WITH_CLIENT) message(STATUS "QT_MODULES_COCKATRICE = ${QT_MODULES_COCKATRICE}") endif() diff --git a/cockatrice/CMakeLists.txt b/cockatrice/CMakeLists.txt index 61bfedf88..57116c364 100644 --- a/cockatrice/CMakeLists.txt +++ b/cockatrice/CMakeLists.txt @@ -551,7 +551,7 @@ target_link_libraries( libcockatrice_models libcockatrice_rng libcockatrice_settings - ${COCKATRICE_QT_MODULES} + ${QT_MODULES_COCKATRICE} ) if(UNIX) diff --git a/libcockatrice_network/CMakeLists.txt b/libcockatrice_network/CMakeLists.txt index 3069c0db4..98871d974 100644 --- a/libcockatrice_network/CMakeLists.txt +++ b/libcockatrice_network/CMakeLists.txt @@ -10,5 +10,5 @@ add_library(libcockatrice_network INTERFACE) target_include_directories(libcockatrice_network INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) target_link_libraries( - libcockatrice_network INTERFACE ${COCKATRICE_QT_MODULES} libcockatrice_network_client libcockatrice_network_server + libcockatrice_network INTERFACE ${QT_MODULES_COCKATRICE} libcockatrice_network_client libcockatrice_network_server ) diff --git a/libcockatrice_network/libcockatrice/network/client/CMakeLists.txt b/libcockatrice_network/libcockatrice/network/client/CMakeLists.txt index bcf62463c..d6ce8648d 100644 --- a/libcockatrice_network/libcockatrice/network/client/CMakeLists.txt +++ b/libcockatrice_network/libcockatrice/network/client/CMakeLists.txt @@ -12,7 +12,7 @@ target_include_directories(libcockatrice_network_client INTERFACE .) target_link_libraries( libcockatrice_network_client - INTERFACE ${COCKATRICE_QT_VERSION_NAME}::Network ${COCKATRICE_QT_VERSION_NAME}::WebSockets + INTERFACE ${QT_MAIN_VERSION_STRING}::Network ${QT_MAIN_VERSION_STRING}::WebSockets libcockatrice_network_client_abstract libcockatrice_network_client_local libcockatrice_network_client_remote ) diff --git a/libcockatrice_network/libcockatrice/network/client/abstract/CMakeLists.txt b/libcockatrice_network/libcockatrice/network/client/abstract/CMakeLists.txt index 6fba8d629..85cd6fc2c 100644 --- a/libcockatrice_network/libcockatrice/network/client/abstract/CMakeLists.txt +++ b/libcockatrice_network/libcockatrice/network/client/abstract/CMakeLists.txt @@ -15,7 +15,6 @@ add_dependencies(libcockatrice_network_client_abstract libcockatrice_protocol li target_include_directories(libcockatrice_network_client_abstract PUBLIC .) target_link_libraries( - libcockatrice_network_client_abstract - PUBLIC ${COCKATRICE_QT_VERSION_NAME}::Network ${COCKATRICE_QT_VERSION_NAME}::WebSockets libcockatrice_protocol - libcockatrice_network_server_remote + libcockatrice_network_client_abstract PUBLIC ${QT_MAIN_VERSION_STRING}::Network ${QT_MAIN_VERSION_STRING}::WebSockets + libcockatrice_protocol libcockatrice_network_server_remote ) diff --git a/libcockatrice_network/libcockatrice/network/client/local/CMakeLists.txt b/libcockatrice_network/libcockatrice/network/client/local/CMakeLists.txt index 2ac12e1fe..50938e372 100644 --- a/libcockatrice_network/libcockatrice/network/client/local/CMakeLists.txt +++ b/libcockatrice_network/libcockatrice/network/client/local/CMakeLists.txt @@ -15,7 +15,6 @@ add_dependencies(libcockatrice_network_client_local libcockatrice_network_client target_include_directories(libcockatrice_network_client_local PUBLIC .) target_link_libraries( - libcockatrice_network_client_local - PUBLIC ${COCKATRICE_QT_VERSION_NAME}::Network ${COCKATRICE_QT_VERSION_NAME}::WebSockets - libcockatrice_network_client_abstract + libcockatrice_network_client_local PUBLIC ${QT_MAIN_VERSION_STRING}::Network ${QT_MAIN_VERSION_STRING}::WebSockets + libcockatrice_network_client_abstract ) diff --git a/libcockatrice_network/libcockatrice/network/client/remote/CMakeLists.txt b/libcockatrice_network/libcockatrice/network/client/remote/CMakeLists.txt index cb68d0c37..fe6eff583 100644 --- a/libcockatrice_network/libcockatrice/network/client/remote/CMakeLists.txt +++ b/libcockatrice_network/libcockatrice/network/client/remote/CMakeLists.txt @@ -16,6 +16,6 @@ target_include_directories(libcockatrice_network_client_remote PUBLIC .) target_link_libraries( libcockatrice_network_client_remote - PUBLIC ${COCKATRICE_QT_VERSION_NAME}::Network ${COCKATRICE_QT_VERSION_NAME}::WebSockets - libcockatrice_network_client_abstract libcockatrice_interfaces libcockatrice_utility libcockatrice_protocol + PUBLIC ${QT_MAIN_VERSION_STRING}::Network ${QT_MAIN_VERSION_STRING}::WebSockets libcockatrice_network_client_abstract + libcockatrice_interfaces libcockatrice_utility libcockatrice_protocol ) diff --git a/libcockatrice_network/libcockatrice/network/server/CMakeLists.txt b/libcockatrice_network/libcockatrice/network/server/CMakeLists.txt index cbb717ad8..cdfc8fb65 100644 --- a/libcockatrice_network/libcockatrice/network/server/CMakeLists.txt +++ b/libcockatrice_network/libcockatrice/network/server/CMakeLists.txt @@ -10,6 +10,6 @@ add_library(libcockatrice_network_server INTERFACE) target_include_directories(libcockatrice_network_server INTERFACE .) target_link_libraries( - libcockatrice_network_server INTERFACE ${COCKATRICE_QT_MODULES} libcockatrice_network_server_local + libcockatrice_network_server INTERFACE ${QT_MODULES_COCKATRICE} libcockatrice_network_server_local libcockatrice_network_server_remote ) diff --git a/libcockatrice_network/libcockatrice/network/server/local/CMakeLists.txt b/libcockatrice_network/libcockatrice/network/server/local/CMakeLists.txt index 494ae1294..9a9b19206 100644 --- a/libcockatrice_network/libcockatrice/network/server/local/CMakeLists.txt +++ b/libcockatrice_network/libcockatrice/network/server/local/CMakeLists.txt @@ -14,4 +14,4 @@ add_dependencies(libcockatrice_network_server_local libcockatrice_protocol) target_include_directories(libcockatrice_network_server_local PUBLIC .) -target_link_libraries(libcockatrice_network_server_local PUBLIC ${COCKATRICE_QT_MODULES} libcockatrice_protocol) +target_link_libraries(libcockatrice_network_server_local PUBLIC ${QT_MODULES_COCKATRICE} libcockatrice_protocol) diff --git a/libcockatrice_network/libcockatrice/network/server/remote/CMakeLists.txt b/libcockatrice_network/libcockatrice/network/server/remote/CMakeLists.txt index e11a962d1..bb23ad40a 100644 --- a/libcockatrice_network/libcockatrice/network/server/remote/CMakeLists.txt +++ b/libcockatrice_network/libcockatrice/network/server/remote/CMakeLists.txt @@ -60,5 +60,5 @@ target_include_directories(libcockatrice_network_server_remote PUBLIC .) # Make cockatrice_server depend on cockatrice_protocol target_link_libraries( libcockatrice_network_server_remote PUBLIC libcockatrice_protocol libcockatrice_utility libcockatrice_rng - libcockatrice_deck_list ${COCKATRICE_QT_MODULES} + libcockatrice_deck_list ${QT_MODULES_COCKATRICE} ) diff --git a/libcockatrice_utility/CMakeLists.txt b/libcockatrice_utility/CMakeLists.txt index db23f7951..f5c7f8345 100644 --- a/libcockatrice_utility/CMakeLists.txt +++ b/libcockatrice_utility/CMakeLists.txt @@ -39,5 +39,3 @@ find_package(OpenSSL REQUIRED) target_link_libraries(libcockatrice_utility PUBLIC libcockatrice_rng OpenSSL::Crypto ${QT_CORE_MODULE}) set(ORACLE_LIBS) - -include_directories(${${COCKATRICE_QT_VERSION_NAME}Core_INCLUDE_DIRS}) diff --git a/oracle/CMakeLists.txt b/oracle/CMakeLists.txt index ef2bdb9f3..c94d92028 100644 --- a/oracle/CMakeLists.txt +++ b/oracle/CMakeLists.txt @@ -122,7 +122,7 @@ target_link_libraries( PUBLIC libcockatrice_card PUBLIC libcockatrice_settings PUBLIC libcockatrice_network - PUBLIC ${ORACLE_QT_MODULES} + PUBLIC ${QT_MODULES_ORACLE} ) if(ZLIB_FOUND) diff --git a/servatrice/CMakeLists.txt b/servatrice/CMakeLists.txt index a7e24d585..cc707f02c 100644 --- a/servatrice/CMakeLists.txt +++ b/servatrice/CMakeLists.txt @@ -99,12 +99,12 @@ target_precompile_headers(servatrice PRIVATE "${CMAKE_SOURCE_DIR}/cmake/pch/qtco if(CMAKE_HOST_SYSTEM MATCHES "FreeBSD") target_link_libraries( - servatrice libcockatrice_deck_list libcockatrice_network_server_remote Threads::Threads ${SERVATRICE_QT_MODULES} + servatrice libcockatrice_deck_list libcockatrice_network_server_remote Threads::Threads ${QT_MODULES_SERVATRICE} ${LIBEXECINFO_LIBRARY} ) else() target_link_libraries( - servatrice libcockatrice_deck_list libcockatrice_network_server_remote Threads::Threads ${SERVATRICE_QT_MODULES} + servatrice libcockatrice_deck_list libcockatrice_network_server_remote Threads::Threads ${QT_MODULES_SERVATRICE} ) endif() diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 18ab60d06..f89bbd219 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,4 +1,4 @@ -# NOTE: Qt modules for tests are defined centrally in cmake/FindQtRuntime.cmake (the _TEST_NEEDED variable). +# NOTE: Qt modules for tests are defined centrally in cmake/FindQtRuntime.cmake (the QT_COMPONENTS_TEST variable). # If a new test needs additional Qt modules, add them there — not in individual test CMakeLists.txt files. enable_testing() @@ -18,8 +18,6 @@ add_test(NAME latency_tracker_test COMMAND latency_tracker_test) add_test(NAME deck_hash_performance_test COMMAND deck_hash_performance_test) set_tests_properties(deck_hash_performance_test PROPERTIES TIMEOUT 15) -# Find GTest - add_executable(dummy_test dummy_test.cpp) add_executable(expression_test expression_test.cpp) add_executable(clamped_arithmetic_test clamped_arithmetic_test.cpp) @@ -35,6 +33,7 @@ add_executable(lag_monitor_test ${CMAKE_SOURCE_DIR}/cockatrice/src/client/lag_mo target_include_directories(lag_monitor_test PRIVATE ${CMAKE_SOURCE_DIR}/cockatrice/src) add_executable(latency_tracker_test latency_tracker_test.cpp) +# Find GTest find_package(GTest) if(NOT GTEST_FOUND) @@ -77,39 +76,39 @@ endif() include_directories(${GTEST_INCLUDE_DIRS}) target_link_libraries(dummy_test Threads::Threads ${GTEST_BOTH_LIBRARIES}) -target_link_libraries(expression_test libcockatrice_utility Threads::Threads ${GTEST_BOTH_LIBRARIES} ${TEST_QT_MODULES}) +target_link_libraries(expression_test libcockatrice_utility Threads::Threads ${GTEST_BOTH_LIBRARIES} ${QT_MODULES_TEST}) target_link_libraries( - clamped_arithmetic_test libcockatrice_utility Threads::Threads ${GTEST_BOTH_LIBRARIES} ${TEST_QT_MODULES} + clamped_arithmetic_test libcockatrice_utility Threads::Threads ${GTEST_BOTH_LIBRARIES} ${QT_MODULES_TEST} ) target_link_libraries( - test_age_formatting libcockatrice_utility Threads::Threads ${GTEST_BOTH_LIBRARIES} ${TEST_QT_MODULES} + test_age_formatting libcockatrice_utility Threads::Threads ${GTEST_BOTH_LIBRARIES} ${QT_MODULES_TEST} ) target_link_libraries( - password_hash_test libcockatrice_utility Threads::Threads ${GTEST_BOTH_LIBRARIES} ${TEST_QT_MODULES} + password_hash_test libcockatrice_utility Threads::Threads ${GTEST_BOTH_LIBRARIES} ${QT_MODULES_TEST} ) target_link_libraries( playmat_resolver_test libcockatrice_deck_list libcockatrice_utility Threads::Threads ${GTEST_BOTH_LIBRARIES} - ${TEST_QT_MODULES} + ${QT_MODULES_TEST} ) target_link_libraries( deck_hash_performance_test libcockatrice_deck_list libcockatrice_utility Threads::Threads ${GTEST_BOTH_LIBRARIES} - ${TEST_QT_MODULES} + ${QT_MODULES_TEST} ) target_link_libraries( - server_card_counter_test libcockatrice_network Threads::Threads ${GTEST_BOTH_LIBRARIES} ${TEST_QT_MODULES} + server_card_counter_test libcockatrice_network Threads::Threads ${GTEST_BOTH_LIBRARIES} ${QT_MODULES_TEST} ) target_link_libraries( - server_counter_test libcockatrice_network Threads::Threads ${GTEST_BOTH_LIBRARIES} ${TEST_QT_MODULES} + server_counter_test libcockatrice_network Threads::Threads ${GTEST_BOTH_LIBRARIES} ${QT_MODULES_TEST} ) target_link_libraries( - server_rate_limiter_test libcockatrice_utility Threads::Threads ${GTEST_BOTH_LIBRARIES} ${TEST_QT_MODULES} + server_rate_limiter_test libcockatrice_utility Threads::Threads ${GTEST_BOTH_LIBRARIES} ${QT_MODULES_TEST} ) target_link_libraries( - warning_categories_test libcockatrice_utility Threads::Threads ${GTEST_BOTH_LIBRARIES} ${TEST_QT_MODULES} + warning_categories_test libcockatrice_utility Threads::Threads ${GTEST_BOTH_LIBRARIES} ${QT_MODULES_TEST} ) -target_link_libraries(lag_monitor_test Threads::Threads ${GTEST_BOTH_LIBRARIES} ${TEST_QT_MODULES}) +target_link_libraries(lag_monitor_test Threads::Threads ${GTEST_BOTH_LIBRARIES} ${QT_MODULES_TEST}) target_link_libraries( - latency_tracker_test libcockatrice_network Threads::Threads ${GTEST_BOTH_LIBRARIES} ${TEST_QT_MODULES} + latency_tracker_test libcockatrice_network Threads::Threads ${GTEST_BOTH_LIBRARIES} ${QT_MODULES_TEST} ) add_subdirectory(card_zone_algorithms) diff --git a/tests/carddatabase/CMakeLists.txt b/tests/carddatabase/CMakeLists.txt index 811cebc1d..042b2911a 100644 --- a/tests/carddatabase/CMakeLists.txt +++ b/tests/carddatabase/CMakeLists.txt @@ -16,7 +16,7 @@ target_link_libraries( PRIVATE libcockatrice_card PRIVATE Threads::Threads PRIVATE ${GTEST_BOTH_LIBRARIES} - PRIVATE ${TEST_QT_MODULES} + PRIVATE ${QT_MODULES_TEST} ) add_test(NAME carddatabase_test COMMAND carddatabase_test) @@ -32,7 +32,7 @@ target_link_libraries( PRIVATE libcockatrice_models PRIVATE Threads::Threads PRIVATE ${GTEST_BOTH_LIBRARIES} - PRIVATE ${TEST_QT_MODULES} + PRIVATE ${QT_MODULES_TEST} ) if(NOT GTEST_FOUND) @@ -51,7 +51,7 @@ if(WITH_ORACLE OR WITH_CLIENT) PRIVATE libcockatrice_filters PRIVATE Threads::Threads PRIVATE ${GTEST_BOTH_LIBRARIES} - PRIVATE ${TEST_QT_MODULES} + PRIVATE ${QT_MODULES_TEST} ) add_test(NAME filter_string_test COMMAND filter_string_test) diff --git a/tests/deck_list_model/CMakeLists.txt b/tests/deck_list_model/CMakeLists.txt index e3096c559..ad8d472d7 100644 --- a/tests/deck_list_model/CMakeLists.txt +++ b/tests/deck_list_model/CMakeLists.txt @@ -11,7 +11,7 @@ target_link_libraries( libcockatrice_deck_list Threads::Threads ${GTEST_BOTH_LIBRARIES} - ${TEST_QT_MODULES} + ${QT_MODULES_TEST} ) add_test(NAME deck_list_model_custom_zones_test COMMAND deck_list_model_custom_zones_test) @@ -28,6 +28,6 @@ target_link_libraries( libcockatrice_deck_list Threads::Threads ${GTEST_BOTH_LIBRARIES} - ${TEST_QT_MODULES} + ${QT_MODULES_TEST} ) add_test(NAME deck_list_model_zone_integration_test COMMAND deck_list_model_zone_integration_test) diff --git a/tests/deck_list_zones/CMakeLists.txt b/tests/deck_list_zones/CMakeLists.txt index 0710be94d..c445ede88 100644 --- a/tests/deck_list_zones/CMakeLists.txt +++ b/tests/deck_list_zones/CMakeLists.txt @@ -5,6 +5,6 @@ if(NOT GTEST_FOUND) endif() target_link_libraries( - deck_list_zones_test libcockatrice_deck_list Threads::Threads ${GTEST_BOTH_LIBRARIES} ${TEST_QT_MODULES} + deck_list_zones_test libcockatrice_deck_list Threads::Threads ${GTEST_BOTH_LIBRARIES} ${QT_MODULES_TEST} ) add_test(NAME deck_list_zones_test COMMAND deck_list_zones_test) diff --git a/tests/loading_from_clipboard/CMakeLists.txt b/tests/loading_from_clipboard/CMakeLists.txt index 719d62f45..c144b6205 100644 --- a/tests/loading_from_clipboard/CMakeLists.txt +++ b/tests/loading_from_clipboard/CMakeLists.txt @@ -7,6 +7,6 @@ endif() target_link_libraries( loading_from_clipboard_test libcockatrice_deck_list libcockatrice_card Threads::Threads ${GTEST_BOTH_LIBRARIES} - ${TEST_QT_MODULES} + ${QT_MODULES_TEST} ) add_test(NAME loading_from_clipboard_test COMMAND loading_from_clipboard_test) diff --git a/tests/movecard_tests/CMakeLists.txt b/tests/movecard_tests/CMakeLists.txt index 769047148..eaa81b345 100755 --- a/tests/movecard_tests/CMakeLists.txt +++ b/tests/movecard_tests/CMakeLists.txt @@ -10,7 +10,7 @@ target_link_libraries( PRIVATE libcockatrice_rng PRIVATE Threads::Threads PRIVATE ${GTEST_BOTH_LIBRARIES} - PRIVATE ${TEST_QT_MODULES} + PRIVATE ${QT_MODULES_TEST} ) add_test(NAME reverse_card_move_test COMMAND reverse_card_move_test) diff --git a/tests/oracle/CMakeLists.txt b/tests/oracle/CMakeLists.txt index 9bc5ee5be..6e98fc469 100644 --- a/tests/oracle/CMakeLists.txt +++ b/tests/oracle/CMakeLists.txt @@ -4,7 +4,7 @@ if(NOT GTEST_FOUND) add_dependencies(parse_cipt_test gtest) endif() -target_link_libraries(parse_cipt_test Threads::Threads ${GTEST_BOTH_LIBRARIES} ${TEST_QT_MODULES}) +target_link_libraries(parse_cipt_test Threads::Threads ${GTEST_BOTH_LIBRARIES} ${QT_MODULES_TEST}) add_test(NAME parse_cipt_test COMMAND parse_cipt_test) @@ -20,7 +20,7 @@ endif() target_link_libraries( oracle_importer_test libcockatrice_card libcockatrice_interfaces Threads::Threads ${GTEST_BOTH_LIBRARIES} - ${TEST_QT_MODULES} + ${QT_MODULES_TEST} ) add_test(NAME oracle_importer_test COMMAND oracle_importer_test) @@ -64,6 +64,6 @@ target_link_libraries( libcockatrice_interfaces Threads::Threads ${GTEST_BOTH_LIBRARIES} - ${TEST_QT_MODULES} + ${QT_MODULES_TEST} ${_ORACLE_BENCH_EXTRA_LIBRARIES} ) diff --git a/tests/settings/CMakeLists.txt b/tests/settings/CMakeLists.txt index 7ee32a645..fdff92e6e 100644 --- a/tests/settings/CMakeLists.txt +++ b/tests/settings/CMakeLists.txt @@ -3,16 +3,16 @@ add_executable(settings_defaults_test settings_defaults_test.cpp) add_executable(settings_migration_test settings_migration_test.cpp) target_link_libraries( - settings_manager_test libcockatrice_settings Threads::Threads ${GTEST_BOTH_LIBRARIES} ${TEST_QT_MODULES} + settings_manager_test libcockatrice_settings Threads::Threads ${GTEST_BOTH_LIBRARIES} ${QT_MODULES_TEST} ) target_link_libraries( - settings_defaults_test libcockatrice_settings Threads::Threads ${GTEST_BOTH_LIBRARIES} ${TEST_QT_MODULES} + settings_defaults_test libcockatrice_settings Threads::Threads ${GTEST_BOTH_LIBRARIES} ${QT_MODULES_TEST} ) target_compile_definitions(settings_defaults_test PRIVATE SETTINGS_UNIT_TEST) target_link_libraries( - settings_migration_test libcockatrice_settings Threads::Threads ${GTEST_BOTH_LIBRARIES} ${TEST_QT_MODULES} + settings_migration_test libcockatrice_settings Threads::Threads ${GTEST_BOTH_LIBRARIES} ${QT_MODULES_TEST} ) add_test(NAME settings_manager_test COMMAND settings_manager_test) From 5d65adfc9c8dd7a9af2e19a1657aacb21a15f7b2 Mon Sep 17 00:00:00 2001 From: tooomm Date: Wed, 9 Sep 2026 23:34:36 +0200 Subject: [PATCH 2/2] revert nsis changes --- cmake/NSIS.template.in | 220 +++++++++++++++++++++++++---------------- 1 file changed, 136 insertions(+), 84 deletions(-) diff --git a/cmake/NSIS.template.in b/cmake/NSIS.template.in index 197ee363b..5af116470 100644 --- a/cmake/NSIS.template.in +++ b/cmake/NSIS.template.in @@ -57,13 +57,21 @@ Page Custom PortableModePageCreate PortableModePageLeave Function .onInit -${If} ${NSIS_IS_64_BIT} == 1 # NSIS 64bit +${If} ${NSIS_IS_64_BIT} == 1 #NSIS 64bit ${IfNot} ${RunningX64} MessageBox MB_OK|MB_ICONSTOP "This version of Cockatrice requires a 64-bit Windows system." Abort ${EndIf} StrCpy $NormalDestDir "$ProgramFiles64\Cockatrice" SetRegView 64 +${Else} #NSIS 32bit + ${If} ${RunningX64} + MessageBox MB_OK|MB_ICONEXCLAMATION \ + "You are about to install a 32-bit version of Cockatrice on a 64-bit Windows system.$\n\ + We advise you to use the correct 64-bit installer instead to get around potential issues.$\n$\n\ + Download from our webpage: https://cockatrice.github.io" + ${EndIf} + StrCpy $NormalDestDir "$ProgramFiles\Cockatrice" ${EndIf} StrCpy $PortableDestDir "$Desktop\CockatricePortable" @@ -148,6 +156,7 @@ ${If} $8 != "admin" ${EndIf} FunctionEnd + Function SetModeDestinationFromInstdir ${If} $PortableMode = 0 StrCpy $NormalDestDir $InstDir @@ -166,14 +175,27 @@ Function AutoUninstallIfNeeded SetShellVarContext all -SetRegView 64 +; --- 32-bit uninstall --- +SetRegView 32 ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "QuietUninstallString" -StrCmp $R0 "" done64 -DetailPrint "Removing previous version..." +StrCmp $R0 "" done32 +DetailPrint "Removing previous version (32-bit)..." ExecWait '$R0' -done64: +done32: + +; --- 64-bit uninstall --- +${If} ${RunningX64} + SetRegView 64 + ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "QuietUninstallString" + + StrCmp $R0 "" done64 + DetailPrint "Removing previous version (64-bit)..." + ExecWait '$R0' + + done64: +${EndIf} FunctionEnd @@ -222,23 +244,45 @@ ${EndIf} ${If} $PortableMode = 0 SetShellVarContext all - SetRegView 64 + # uninstall 32bit version + SetRegView 32 ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "UninstallString" - StrCmp $R0 "" done64 + StrCmp $R0 "" done32 ${If} $ReinstallMode = 0 - MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "A previous version of Cockatrice must be uninstalled before installing the new one." IDOK uninst64 + MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "A previous version of Cockatrice must be uninstalled before installing the new one." IDOK uninst32 Abort ${Else} - Goto uninst64 + Goto uninst32 ${EndIf} - uninst64: + uninst32: ClearErrors ExecWait "$R0" - done64: + done32: + + # uninstall 64bit version + ${If} ${NSIS_IS_64_BIT} == 1 + SetRegView 64 + + ReadRegStr $R0 HKLM "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "UninstallString" + StrCmp $R0 "" done64 + + ${If} $ReinstallMode = 0 + MessageBox MB_OKCANCEL|MB_ICONEXCLAMATION "A previous version of Cockatrice must be uninstalled before installing the new one." IDOK uninst64 + Abort + ${Else} + Goto uninst64 + ${EndIf} + + uninst64: + ClearErrors + ExecWait "$R0" + + done64: + ${EndIf} ${Else} Abort @@ -252,62 +296,70 @@ SetOutPath "$INSTDIR" ${If} $PortableMode = 1 ${AndIf} ${FileExists} "$INSTDIR\portable.dat" - ; upgrade portable mode - RMDir /r "$INSTDIR\plugins" - RMDir /r "$INSTDIR\sounds" - RMDir /r "$INSTDIR\themes" - RMDir /r "$INSTDIR\translations" - Delete "$INSTDIR\uninstall.exe" - Delete "$INSTDIR\cockatrice.exe" - Delete "$INSTDIR\oracle.exe" - Delete "$INSTDIR\servatrice.exe" - Delete "$INSTDIR\Qt*.dll" - Delete "$INSTDIR\libmysql.dll" - Delete "$INSTDIR\icu*.dll" - Delete "$INSTDIR\libeay32.dll" - Delete "$INSTDIR\ssleay32.dll" - Delete "$INSTDIR\qt.conf" - Delete "$INSTDIR\qdebug.txt" - Delete "$INSTDIR\servatrice.sql" - Delete "$INSTDIR\servatrice.ini.example" - Delete "$INSTDIR\zlib*.dll" - RMDir "$INSTDIR" + ; upgrade portable mode + RMDir /r "$INSTDIR\plugins" + RMDir /r "$INSTDIR\sounds" + RMDir /r "$INSTDIR\themes" + RMDir /r "$INSTDIR\translations" + Delete "$INSTDIR\uninstall.exe" + Delete "$INSTDIR\cockatrice.exe" + Delete "$INSTDIR\oracle.exe" + Delete "$INSTDIR\servatrice.exe" + Delete "$INSTDIR\Qt*.dll" + Delete "$INSTDIR\libmysql.dll" + Delete "$INSTDIR\icu*.dll" + Delete "$INSTDIR\libeay32.dll" + Delete "$INSTDIR\ssleay32.dll" + Delete "$INSTDIR\qt.conf" + Delete "$INSTDIR\qdebug.txt" + Delete "$INSTDIR\servatrice.sql" + Delete "$INSTDIR\servatrice.ini.example" + Delete "$INSTDIR\zlib*.dll" + RMDir "$INSTDIR" ${EndIf} @CPACK_NSIS_EXTRA_PREINSTALL_COMMANDS@ @CPACK_NSIS_FULL_INSTALL@ ${If} $PortableMode = 0 - WriteUninstaller "$INSTDIR\uninstall.exe" - ${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2 - IntFmt $0 "0x%08X" $0 + WriteUninstaller "$INSTDIR\uninstall.exe" + ${GetSize} "$INSTDIR" "/S=0K" $0 $1 $2 + IntFmt $0 "0x%08X" $0 - ; Enable Windows User-Mode Dumps - ; https://learn.microsoft.com/en-us/windows/win32/wer/collecting-user-mode-dumps - WriteRegExpandStr HKLM "Software\Microsoft\Windows\Windows Error Reporting\LocalDumps\cockatrice.exe" "DumpFolder" "%LOCALAPPDATA%\CrashDumps\Cockatrice" - WriteRegDWORD HKLM "Software\Microsoft\Windows\Windows Error Reporting\LocalDumps\cockatrice.exe" "DumpCount" "5" - WriteRegDWORD HKLM "Software\Microsoft\Windows\Windows Error Reporting\LocalDumps\cockatrice.exe" "DumpType" "2" + ; Enable Windows User-Mode Dumps + ; https://learn.microsoft.com/en-us/windows/win32/wer/collecting-user-mode-dumps + WriteRegExpandStr HKLM "Software\Microsoft\Windows\Windows Error Reporting\LocalDumps\cockatrice.exe" "DumpFolder" "%LOCALAPPDATA%\CrashDumps\Cockatrice" + WriteRegDWORD HKLM "Software\Microsoft\Windows\Windows Error Reporting\LocalDumps\cockatrice.exe" "DumpCount" "5" + WriteRegDWORD HKLM "Software\Microsoft\Windows\Windows Error Reporting\LocalDumps\cockatrice.exe" "DumpType" "2" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "DisplayIcon" "$INSTDIR\cockatrice.exe" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "DisplayName" "Cockatrice" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "DisplayVersion" "@CPACK_PACKAGE_VERSION_MAJOR@.@CPACK_PACKAGE_VERSION_MINOR@.@CPACK_PACKAGE_VERSION_PATCH@" - WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "EstimatedSize" "$0" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "InstallLocation" "$INSTDIR" - WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "NoModify" "1" - WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "NoRepair" "1" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "Publisher" "Cockatrice team" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S" - WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "UninstallString" "$\"$INSTDIR\uninstall.exe$\"" - WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "VersionMajor" "@CPACK_PACKAGE_VERSION_MAJOR@" - WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "VersionMinor" "@CPACK_PACKAGE_VERSION_MINOR@" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "DisplayIcon" "$INSTDIR\cockatrice.exe" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "DisplayName" "Cockatrice" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "DisplayVersion" "@CPACK_PACKAGE_VERSION_MAJOR@.@CPACK_PACKAGE_VERSION_MINOR@.@CPACK_PACKAGE_VERSION_PATCH@" + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "EstimatedSize" "$0" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "InstallLocation" "$INSTDIR" + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "NoModify" "1" + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "NoRepair" "1" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "Publisher" "Cockatrice team" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "QuietUninstallString" "$\"$INSTDIR\uninstall.exe$\" /S" + WriteRegStr HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "UninstallString" "$\"$INSTDIR\uninstall.exe$\"" + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "VersionMajor" "@CPACK_PACKAGE_VERSION_MAJOR@" + WriteRegDWORD HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" "VersionMinor" "@CPACK_PACKAGE_VERSION_MINOR@" - IfFileExists "$INSTDIR\vc_redist.x64.exe" VcRedist64Exists PastVcRedist64Check - VcRedist64Exists: - ExecWait '"$INSTDIR\vc_redist.x64.exe" /passive /norestart' - DetailPrint "Sleep to ensure unlock of vc_redist file after installation..." - Sleep 3000 - Delete "$INSTDIR\vc_redist.x64.exe" - PastVcRedist64Check: + IfFileExists "$INSTDIR\vc_redist.x86.exe" VcRedist86Exists PastVcRedist86Check + VcRedist86Exists: + ExecWait '"$INSTDIR\vc_redist.x86.exe" /passive /norestart' + DetailPrint "Wait to ensure unlock of vc_redist file after installation..." + Sleep 3000 + Delete "$INSTDIR\vc_redist.x86.exe" + PastVcRedist86Check: + + IfFileExists "$INSTDIR\vc_redist.x64.exe" VcRedist64Exists PastVcRedist64Check + VcRedist64Exists: + ExecWait '"$INSTDIR\vc_redist.x64.exe" /passive /norestart' + DetailPrint "Sleep to ensure unlock of vc_redist file after installation..." + Sleep 3000 + Delete "$INSTDIR\vc_redist.x64.exe" + PastVcRedist64Check: ${Else} ; Create the file the application uses to detect portable mode @@ -325,51 +377,51 @@ SectionEnd Section "Start menu item" SecStartMenu ${If} $PortableMode = 0 - SetShellVarContext all - createDirectory "$SMPROGRAMS\Cockatrice" - createShortCut "$SMPROGRAMS\Cockatrice\Cockatrice.lnk" "$INSTDIR\cockatrice.exe" - createShortCut "$SMPROGRAMS\Cockatrice\Oracle.lnk" "$INSTDIR\oracle.exe" - createShortCut "$SMPROGRAMS\Cockatrice\Servatrice.lnk" "$INSTDIR\servatrice.exe" + SetShellVarContext all + createDirectory "$SMPROGRAMS\Cockatrice" + createShortCut "$SMPROGRAMS\Cockatrice\Cockatrice.lnk" "$INSTDIR\cockatrice.exe" + createShortCut "$SMPROGRAMS\Cockatrice\Oracle.lnk" "$INSTDIR\oracle.exe" + createShortCut "$SMPROGRAMS\Cockatrice\Servatrice.lnk" "$INSTDIR\servatrice.exe" ${EndIf} SectionEnd Section "un.Application" UnSecApplication - SetShellVarContext all - RMDir /r "$INSTDIR\plugins" - RMDir /r "$INSTDIR\sounds" - RMDir /r "$INSTDIR\themes" - RMDir /r "$INSTDIR\translations" - Delete "$INSTDIR\*.exe" - Delete "$INSTDIR\*.dll" - Delete "$INSTDIR\qt.conf" - Delete "$INSTDIR\qdebug.txt" - Delete "$INSTDIR\servatrice.sql" - Delete "$INSTDIR\servatrice.ini.example" - RMDir "$INSTDIR" + SetShellVarContext all + RMDir /r "$INSTDIR\plugins" + RMDir /r "$INSTDIR\sounds" + RMDir /r "$INSTDIR\themes" + RMDir /r "$INSTDIR\translations" + Delete "$INSTDIR\*.exe" + Delete "$INSTDIR\*.dll" + Delete "$INSTDIR\qt.conf" + Delete "$INSTDIR\qdebug.txt" + Delete "$INSTDIR\servatrice.sql" + Delete "$INSTDIR\servatrice.ini.example" + RMDir "$INSTDIR" - RMDir "$SMPROGRAMS\Cockatrice" + RMDir "$SMPROGRAMS\Cockatrice" - DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" + DeleteRegKey HKLM "Software\Microsoft\Windows\CurrentVersion\Uninstall\Cockatrice" SectionEnd ; unselected because it is /o Section /o "un.Configurations, decks, cards, pics" UnSecConfiguration - SetShellVarContext current - DeleteRegKey HKCU "Software\Cockatrice" + SetShellVarContext current + DeleteRegKey HKCU "Software\Cockatrice" - RMDir /r "$LOCALAPPDATA\Cockatrice" + RMDir /r "$LOCALAPPDATA\Cockatrice" SectionEnd LangString DESC_SecApplication ${LANG_ENGLISH} "Cockatrice program files" LangString DESC_SecStartMenu ${LANG_ENGLISH} "Create start menu items for Cockatrice and Oracle." !insertmacro MUI_FUNCTION_DESCRIPTION_BEGIN - !insertmacro MUI_DESCRIPTION_TEXT ${SecApplication} $(DESC_SecApplication) - !insertmacro MUI_DESCRIPTION_TEXT ${SecStartMenu} $(DESC_SecStartMenu) + !insertmacro MUI_DESCRIPTION_TEXT ${SecApplication} $(DESC_SecApplication) + !insertmacro MUI_DESCRIPTION_TEXT ${SecStartMenu} $(DESC_SecStartMenu) !insertmacro MUI_FUNCTION_DESCRIPTION_END LangString DESC_UnSecApplication ${LANG_ENGLISH} "Cockatrice program files and start menu items" LangString DESC_UnSecConfiguration ${LANG_ENGLISH} "Configurations, decks, card database, pictures" !insertmacro MUI_UNFUNCTION_DESCRIPTION_BEGIN - !insertmacro MUI_DESCRIPTION_TEXT ${UnSecApplication} $(DESC_UnSecApplication) - !insertmacro MUI_DESCRIPTION_TEXT ${UnSecConfiguration} $(DESC_UnSecConfiguration) + !insertmacro MUI_DESCRIPTION_TEXT ${UnSecApplication} $(DESC_UnSecApplication) + !insertmacro MUI_DESCRIPTION_TEXT ${UnSecConfiguration} $(DESC_UnSecConfiguration) !insertmacro MUI_UNFUNCTION_DESCRIPTION_END