fix: use current binary directory mariadb shared object and dont override env variable (#1669)

* mac stuff

grab correct mariadb file and dont override env variable

fix for unix

Update CMakeLists.txt

unix only

* get that dylib
This commit is contained in:
David Markowitz 2024-12-07 22:36:49 -08:00 committed by GitHub
parent 4a1c289fb1
commit 8b56b0b7ba
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 17 additions and 28 deletions

View File

@ -43,6 +43,7 @@ jobs:
build/*/*.ini build/*/*.ini
build/*/*.so build/*/*.so
build/*/*.dll build/*/*.dll
build/*/*.dylib
build/*/vanity/ build/*/vanity/
build/*/navmeshes/ build/*/navmeshes/
build/*/migrations/ build/*/migrations/

View File

@ -66,6 +66,7 @@ set(RECASTNAVIGATION_EXAMPLES OFF CACHE BOOL "" FORCE)
# Disabled no-register # Disabled no-register
# Disabled unknown pragmas because Linux doesn't understand Windows pragmas. # Disabled unknown pragmas because Linux doesn't understand Windows pragmas.
if(UNIX) if(UNIX)
add_link_options("-Wl,-rpath,$ORIGIN/")
add_compile_options("-fPIC") add_compile_options("-fPIC")
add_compile_definitions(_GLIBCXX_USE_CXX11_ABI=0 _GLIBCXX_USE_CXX17_ABI=0) add_compile_definitions(_GLIBCXX_USE_CXX11_ABI=0 _GLIBCXX_USE_CXX17_ABI=0)

View File

@ -11,9 +11,6 @@
"displayName": "Default configure step", "displayName": "Default configure step",
"description": "Use 'build' dir and Unix makefiles", "description": "Use 'build' dir and Unix makefiles",
"binaryDir": "${sourceDir}/build", "binaryDir": "${sourceDir}/build",
"environment": {
"DLU_CONFIG_DIR": "${sourceDir}/build"
},
"generator": "Unix Makefiles" "generator": "Unix Makefiles"
}, },
{ {

View File

@ -2,6 +2,12 @@ add_subdirectory(CDClientDatabase)
add_subdirectory(GameDatabase) add_subdirectory(GameDatabase)
add_library(dDatabase STATIC "MigrationRunner.cpp") add_library(dDatabase STATIC "MigrationRunner.cpp")
add_custom_target(conncpp_dylib
${CMAKE_COMMAND} -E copy $<TARGET_FILE:MariaDB::ConnCpp> ${PROJECT_BINARY_DIR})
add_dependencies(dDatabase conncpp_dylib)
target_include_directories(dDatabase PUBLIC ".") target_include_directories(dDatabase PUBLIC ".")
target_link_libraries(dDatabase target_link_libraries(dDatabase
PUBLIC dDatabaseCDClient dDatabaseGame) PUBLIC dDatabaseCDClient dDatabaseGame)

View File

@ -4,15 +4,6 @@ enable_testing()
find_package(GoogleTest REQUIRED) find_package(GoogleTest REQUIRED)
include(GoogleTest) 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 $<TARGET_FILE:MariaDB::ConnCpp> ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
# Add the subdirectories # Add the subdirectories
add_subdirectory(dCommonTests) add_subdirectory(dCommonTests)
add_subdirectory(dGameTests) add_subdirectory(dGameTests)

View File

@ -17,18 +17,13 @@ list(APPEND DCOMMONTEST_SOURCES ${DENUMS_TESTS})
# Set our executable # Set our executable
add_executable(dCommonTests ${DCOMMONTEST_SOURCES}) 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) if(APPLE)
add_custom_command(TARGET dCommonTests POST_BUILD add_custom_target(dCommonTestsLink
COMMAND otool ARGS -l dCommonTests ${CMAKE_COMMAND} -E copy $<TARGET_FILE:MariaDB::ConnCpp> ${CMAKE_CURRENT_BINARY_DIR})
COMMAND otool ARGS -L dCommonTests
COMMAND ls add_dependencies(dCommonTests dCommonTestsLink)
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})
endif() endif()
# Link needed libraries # Link needed libraries

View File

@ -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 the executable. Remember to add all tests above this!
add_executable(dGameTests ${DGAMETEST_SOURCES}) add_executable(dGameTests ${DGAMETEST_SOURCES})
add_dependencies(dGameTests conncpp_tests)
# Apple needs some special linkage for the mariadb connector for tests.
if(APPLE) if(APPLE)
add_custom_command(TARGET dGameTests POST_BUILD add_custom_target(dGameTestsLink
COMMAND install_name_tool ARGS -change libmariadbcpp.dylib @rpath/libmariadbcpp.dylib dGameTests ${CMAKE_COMMAND} -E copy $<TARGET_FILE:MariaDB::ConnCpp> ${CMAKE_CURRENT_BINARY_DIR})
COMMAND otool ARGS -L dGameTests
WORKING_DIRECTORY ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) add_dependencies(dGameTests dGameTestsLink)
endif() endif()
target_link_libraries(dGameTests ${COMMON_LIBRARIES} GTest::gtest_main target_link_libraries(dGameTests ${COMMON_LIBRARIES} GTest::gtest_main