From 9dc5f3ed8bd8f876136a0070ebd308d18fcc8ea8 Mon Sep 17 00:00:00 2001 From: Andrey Filipenkov Date: Fri, 26 Nov 2021 15:49:02 +0300 Subject: [PATCH] improve RPATH handling, apply RPATH when installing dylibs --- AI/Nullkiller/CMakeLists.txt | 2 +- client/CMakeLists.txt | 3 +-- configure_ios.sh | 5 ++++- launcher/CMakeLists.txt | 3 +-- scripting/erm/CMakeLists.txt | 2 +- scripting/lua/CMakeLists.txt | 2 +- server/CMakeLists.txt | 3 +-- 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/AI/Nullkiller/CMakeLists.txt b/AI/Nullkiller/CMakeLists.txt index e35e92af2..ddf408ec5 100644 --- a/AI/Nullkiller/CMakeLists.txt +++ b/AI/Nullkiller/CMakeLists.txt @@ -137,4 +137,4 @@ target_link_libraries(Nullkiller PRIVATE TBB::tbb) vcmi_set_output_dir(Nullkiller "AI") enable_pch(Nullkiller) -install(TARGETS Nullkiller RUNTIME DESTINATION ${AI_LIB_DIR} LIBRARY DESTINATION ${AI_LIB_DIR}) +install(TARGETS Nullkiller RUNTIME DESTINATION ${AI_LIB_DIR} LIBRARY DESTINATION ${AI_LIB_DIR} OPTIONAL) diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index c855476c5..f0c76a984 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -195,7 +195,7 @@ elseif(APPLE_IOS) set_target_properties(vcmiclient PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_LIST_DIR}/ios/Info.plist" - SKIP_BUILD_RPATH 1 + XCODE_ATTRIBUTE_LD_RUNPATH_SEARCH_PATHS "@executable_path/Frameworks" XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED YES XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME AppIcon XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS ${ENTITLEMENTS_OUT_PATH} @@ -229,7 +229,6 @@ enable_pch(vcmiclient) if(APPLE_IOS) add_custom_command(TARGET vcmiclient POST_BUILD COMMAND ${CMAKE_COMMAND} --install "${CMAKE_BINARY_DIR}" --config "$" --prefix "$" - COMMAND ${CMAKE_INSTALL_NAME_TOOL} -add_rpath @executable_path/Frameworks $ || true COMMAND ${CMAKE_SOURCE_DIR}/apple_codesign.sh ) else() diff --git a/configure_ios.sh b/configure_ios.sh index f981d49d0..b9da18092 100755 --- a/configure_ios.sh +++ b/configure_ios.sh @@ -21,9 +21,12 @@ prefixPath="$boostPrefix;$ffmpegDir;$sdlLibsDir;$qtDir;$tbbDir;$luajitDir" # fi srcDir="../vcmi" -cmake "$srcDir" -G Xcode -T buildsystem=1 \ +# cmake "$srcDir" -G Xcode -T buildsystem=1 \ +cmake "$srcDir" -G Xcode \ -DBUNDLE_IDENTIFIER_PREFIX=com.kambala \ + -DENABLE_PCH=OFF \ -Wno-dev \ + -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ -DCMAKE_TOOLCHAIN_FILE="$srcDir/ios.toolchain.cmake" \ -DPLATFORM=${1:-OS64} \ -DDEPLOYMENT_TARGET=11.0 \ diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt index c8eab5a2e..1ffe3ae9c 100644 --- a/launcher/CMakeLists.txt +++ b/launcher/CMakeLists.txt @@ -110,7 +110,7 @@ if(APPLE_IOS) set_target_properties(vcmilauncher PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_LIST_DIR}/ios/Info.plist" - SKIP_BUILD_RPATH 1 + XCODE_ATTRIBUTE_LD_RUNPATH_SEARCH_PATHS "@executable_path/Frameworks" XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED YES XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME AppIcon XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS ${ENTITLEMENTS_OUT_PATH} @@ -134,7 +134,6 @@ if(APPLE_IOS) install(DIRECTORY icons DESTINATION ${DATA_DIR}) add_custom_command(TARGET vcmilauncher POST_BUILD COMMAND ${CMAKE_COMMAND} --install "${CMAKE_BINARY_DIR}" --config "$" --prefix "$" - COMMAND ${CMAKE_INSTALL_NAME_TOOL} -add_rpath @executable_path/Frameworks $ || true COMMAND ${CMAKE_SOURCE_DIR}/apple_codesign.sh ) else() diff --git a/scripting/erm/CMakeLists.txt b/scripting/erm/CMakeLists.txt index c691094b7..cb501c2a6 100644 --- a/scripting/erm/CMakeLists.txt +++ b/scripting/erm/CMakeLists.txt @@ -20,4 +20,4 @@ target_link_libraries(vcmiERM Boost::boost vcmi) vcmi_set_output_dir(vcmiERM "scripting") enable_pch(vcmiERM) -install(TARGETS vcmiERM DESTINATION ${SCRIPTING_LIB_DIR}) +install(TARGETS vcmiERM LIBRARY DESTINATION ${SCRIPTING_LIB_DIR} OPTIONAL) diff --git a/scripting/lua/CMakeLists.txt b/scripting/lua/CMakeLists.txt index 1d43aca7a..13c927c8c 100644 --- a/scripting/lua/CMakeLists.txt +++ b/scripting/lua/CMakeLists.txt @@ -45,7 +45,7 @@ target_link_libraries(vcmiLua Boost::boost luajit::luajit vcmi) vcmi_set_output_dir(vcmiLua "scripting") enable_pch(vcmiLua) -install(TARGETS vcmiLua DESTINATION ${SCRIPTING_LIB_DIR}) +install(TARGETS vcmiLua LIBRARY DESTINATION ${SCRIPTING_LIB_DIR} OPTIONAL) #manually copy lua dll from vcpkg folder to build directory on windows since vcpkg deps copy feature has flaws, using hardcoded paths based on vcmi windows deps package 1.1 from github if(MSVC) diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index ae3de1a98..cf6d56e6f 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -53,7 +53,7 @@ elseif(APPLE_IOS) set_target_properties(vcmiserver PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_LIST_DIR}/ios/Info.plist" - SKIP_BUILD_RPATH 1 + XCODE_ATTRIBUTE_LD_RUNPATH_SEARCH_PATHS "@executable_path/Frameworks" XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED YES XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME AppIcon XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS ${ENTITLEMENTS_OUT_PATH} @@ -73,7 +73,6 @@ if(APPLE_IOS) # TODO: move to a common dir / add macro? add_custom_command(TARGET vcmiserver POST_BUILD COMMAND ${CMAKE_COMMAND} --install "${CMAKE_BINARY_DIR}" --config "$" --prefix "$" - COMMAND ${CMAKE_INSTALL_NAME_TOOL} -add_rpath @executable_path/Frameworks $ || true COMMAND ${CMAKE_SOURCE_DIR}/apple_codesign.sh ) else()