From 796ae6fcd78441e80103c511e4c75c2f389c6127 Mon Sep 17 00:00:00 2001 From: EmosewaMC <39972741+EmosewaMC@users.noreply.github.com> Date: Sat, 7 Dec 2024 17:15:27 -0800 Subject: [PATCH] mac stuff --- dDatabase/CMakeLists.txt | 6 ++++++ tests/CMakeLists.txt | 9 --------- tests/dCommonTests/CMakeLists.txt | 15 +++++---------- tests/dGameTests/CMakeLists.txt | 10 ++++------ 4 files changed, 15 insertions(+), 25 deletions(-) diff --git a/dDatabase/CMakeLists.txt b/dDatabase/CMakeLists.txt index 004bdc147..42bdb9838 100644 --- a/dDatabase/CMakeLists.txt +++ b/dDatabase/CMakeLists.txt @@ -2,6 +2,12 @@ add_subdirectory(CDClientDatabase) add_subdirectory(GameDatabase) add_library(dDatabase STATIC "MigrationRunner.cpp") + +add_custom_target(conncpp_dylib + ${CMAKE_COMMAND} -E copy $ ${PROJECT_BINARY_DIR}) + +add_dependencies(dDatabase conncpp_dylib) + target_include_directories(dDatabase PUBLIC ".") target_link_libraries(dDatabase PUBLIC dDatabaseCDClient dDatabaseGame) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 24adec61d..d95a24bc1 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -4,15 +4,6 @@ enable_testing() find_package(GoogleTest REQUIRED) include(GoogleTest) -if(APPLE) - set(CMAKE_INSTALL_RPATH_USE_LINK_PATH True) - set(CMAKE_BUILD_WITH_INSTALL_RPATH True) - set(CMAKE_INSTALL_RPATH "@executable_path") -endif() - -add_custom_target(conncpp_tests - ${CMAKE_COMMAND} -E copy $ ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) - # Add the subdirectories add_subdirectory(dCommonTests) add_subdirectory(dGameTests) diff --git a/tests/dCommonTests/CMakeLists.txt b/tests/dCommonTests/CMakeLists.txt index ef7c4cba9..17b31ceda 100644 --- a/tests/dCommonTests/CMakeLists.txt +++ b/tests/dCommonTests/CMakeLists.txt @@ -17,18 +17,13 @@ list(APPEND DCOMMONTEST_SOURCES ${DENUMS_TESTS}) # Set our executable add_executable(dCommonTests ${DCOMMONTEST_SOURCES}) -add_dependencies(dCommonTests conncpp_tests) -# Apple needs some special linkage for the mariadb connector for tests. +# Needs to be in binary dir for ctest if(APPLE) -add_custom_command(TARGET dCommonTests POST_BUILD - COMMAND otool ARGS -l dCommonTests - COMMAND otool ARGS -L dCommonTests - COMMAND ls - COMMAND otool ARGS -D libmariadbcpp.dylib - COMMAND install_name_tool ARGS -change libmariadbcpp.dylib @rpath/libmariadbcpp.dylib dCommonTests - COMMAND otool ARGS -L dCommonTests - WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) + add_custom_target(dCommonTestsLink + ${CMAKE_COMMAND} -E copy $ ${CMAKE_CURRENT_BINARY_DIR}) + + add_dependencies(dCommonTests dCommonTestsLink) endif() # Link needed libraries diff --git a/tests/dGameTests/CMakeLists.txt b/tests/dGameTests/CMakeLists.txt index e1c294331..f4749ce8c 100644 --- a/tests/dGameTests/CMakeLists.txt +++ b/tests/dGameTests/CMakeLists.txt @@ -13,14 +13,12 @@ file(COPY ${COMPONENT_TEST_DATA} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) # Add the executable. Remember to add all tests above this! add_executable(dGameTests ${DGAMETEST_SOURCES}) -add_dependencies(dGameTests conncpp_tests) -# Apple needs some special linkage for the mariadb connector for tests. if(APPLE) -add_custom_command(TARGET dGameTests POST_BUILD - COMMAND install_name_tool ARGS -change libmariadbcpp.dylib @rpath/libmariadbcpp.dylib dGameTests - COMMAND otool ARGS -L dGameTests - WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) + add_custom_target(dGameTestsLink + ${CMAKE_COMMAND} -E copy $ ${CMAKE_CURRENT_BINARY_DIR}) + + add_dependencies(dGameTests dGameTestsLink) endif() target_link_libraries(dGameTests ${COMMON_LIBRARIES} GTest::gtest_main