apple pls

This commit is contained in:
EmosewaMC 2024-10-28 00:16:39 -07:00
parent 0509aaf855
commit bb143ccf21
4 changed files with 12 additions and 16 deletions

View File

@ -49,3 +49,12 @@ function(UpdateConfigOption file_name old_option_name new_option_name)
file(APPEND ${file_name} "\n" ${current_value})
endif()
endfunction()
function(DoAppleMariaDBCopy target location)
if(APPLE)
add_custom_command(TARGET ${target} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${MARIADBCPP_SHARED_LIBRARY_LOCATION}
${location})
endif()
endfunction()

View File

@ -18,3 +18,4 @@ target_link_libraries(MasterServer ${COMMON_LIBRARIES} bcrypt dMasterServer dSer
if(WIN32)
add_dependencies(MasterServer WorldServer AuthServer ChatServer)
endif()
DoAppleMariaDBCopy(MasterServer ${CMAKE_BINARY_DIR})

View File

@ -22,16 +22,7 @@ if(MSVC)
add_dependencies(dCommonTests zlib_tests)
endif()
# Apple needs some special linkage for the mariadb connector for tests.
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})
endif()
DoAppleMariaDBCopy(dCommonTests ${CMAKE_CURRENT_BINARY_DIR})
# Link needed libraries
target_link_libraries(dCommonTests ${COMMON_LIBRARIES} GTest::gtest_main)

View File

@ -15,12 +15,7 @@ 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})
endif()
DoAppleMariaDBCopy(dGameTests ${CMAKE_CURRENT_BINARY_DIR})
target_link_libraries(dGameTests ${COMMON_LIBRARIES} GTest::gtest_main
dGame dScripts dPhysics Detour Recast tinyxml2 dWorldServer dZoneManager dChatFilter dNavigation)