1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-24 22:14:36 +02:00

use rpath properly

This commit is contained in:
Andrey Filipenkov 2021-03-12 13:31:05 +03:00
parent b6c4126bed
commit cfa22c33ad
6 changed files with 517 additions and 321 deletions

View File

@ -20,4 +20,4 @@ target_link_libraries(EmptyAI PRIVATE vcmi)
vcmi_set_output_dir(EmptyAI "AI")
enable_pch(EmptyAI)
install(TARGETS EmptyAI RUNTIME DESTINATION ${AI_LIB_DIR} LIBRARY DESTINATION ${AI_LIB_DIR})
install(TARGETS EmptyAI RUNTIME DESTINATION ${AI_LIB_DIR} LIBRARY DESTINATION ${AI_LIB_DIR} OPTIONAL)

View File

@ -154,6 +154,7 @@ set(CMAKE_MAP_IMPORTED_CONFIG_MINSIZEREL MinSizeRel Release RelWithDebInfo "")
set(CMAKE_MAP_IMPORTED_CONFIG_RELEASE Release RelWithDebInfo MinSizeRel "")
if(APPLE_IOS)
set(CMAKE_MACOSX_RPATH 1)
set(SYSTEM_LIBS ${SYSTEM_LIBS} iconv) # boost.locale
endif(APPLE_IOS)
@ -269,6 +270,11 @@ if(TARGET zlib::zlib)
add_library(ZLIB::ZLIB ALIAS zlib::zlib)
endif()
# TODO: needed only for device+simulator
# if(APPLE_IOS)
# set(ZLIB_LIBRARIES "-lz")
# endif()
find_package(ffmpeg COMPONENTS avutil swscale avformat avcodec)
option(FORCE_BUNDLED_MINIZIP "Force bundled Minizip library" OFF)
if(NOT FORCE_BUNDLED_MINIZIP)

View File

@ -180,7 +180,10 @@ elseif(APPLE_IOS)
"-framework Foundation -framework UIKit -framework QuartzCore -framework CoreGraphics -framework CoreServices -framework ImageIO -framework Metal -framework OpenGLES -framework AVFoundation -framework GameController -framework CoreMotion" # SDL2_image
)
set_target_properties(vcmiclient PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_LIST_DIR}/ios/Info.plist.in")
set_target_properties(vcmiclient PROPERTIES
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_LIST_DIR}/ios/Info.plist.in"
SKIP_BUILD_RPATH 1
)
target_sources(vcmiclient PRIVATE ${CMAKE_SOURCE_DIR}/client/LaunchScreen.storyboard)
set_source_files_properties(${CMAKE_SOURCE_DIR}/client/LaunchScreen.storyboard PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
@ -207,6 +210,7 @@ enable_pch(vcmiclient)
if(APPLE_IOS)
add_custom_command(TARGET vcmiclient POST_BUILD
COMMAND ${CMAKE_COMMAND} --install "${CMAKE_BINARY_DIR}" --config "$<CONFIG>" --prefix "$<TARGET_BUNDLE_CONTENT_DIR:vcmiclient>"
COMMAND ${CMAKE_INSTALL_NAME_TOOL} -add_rpath @executable_path/Frameworks $<TARGET_FILE:vcmiclient> || true
)
else()
install(TARGETS vcmiclient DESTINATION ${BIN_DIR})

File diff suppressed because it is too large Load Diff

View File

@ -477,12 +477,14 @@ vcmi_set_output_dir(vcmi "")
enable_pch(vcmi)
# We want to deploy assets into build directory for easier debugging without install
add_custom_command(TARGET vcmi POST_BUILD
COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/config
COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/Mods
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/config ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/config
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/Mods ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/Mods
)
if(NOT APPLE_IOS)
add_custom_command(TARGET vcmi POST_BUILD
COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/config
COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/Mods
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/config ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/config
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/Mods ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/Mods
)
endif()
# Update version before vcmi compiling
if(TARGET update_version)

View File

@ -33,6 +33,7 @@ if(CMAKE_SYSTEM_NAME MATCHES FreeBSD)
set(server_LIBS execinfo ${server_LIBS})
elseif(APPLE_IOS)
set(server_LIBS ${server_LIBS} "-framework UIKit")
add_dependencies(vcmiserver BattleAI StupidAI VCAI)
endif()
target_link_libraries(vcmiserver PRIVATE ${server_LIBS} minizip::minizip)
@ -47,7 +48,10 @@ if(WIN32)
PROJECT_LABEL "VCMI_server"
)
elseif(APPLE_IOS)
set_target_properties(vcmiserver PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_LIST_DIR}/ios/Info.plist.in")
set_target_properties(vcmiserver PROPERTIES
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_LIST_DIR}/ios/Info.plist.in"
SKIP_BUILD_RPATH 1
)
# TODO: move to a common dir / add macro?
target_sources(vcmiserver PRIVATE ${CMAKE_SOURCE_DIR}/client/LaunchScreen.storyboard)
set_source_files_properties(${CMAKE_SOURCE_DIR}/client/LaunchScreen.storyboard PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
@ -59,6 +63,7 @@ enable_pch(vcmiserver)
if(APPLE_IOS)
add_custom_command(TARGET vcmiserver POST_BUILD
COMMAND ${CMAKE_COMMAND} --install "${CMAKE_BINARY_DIR}" --config "$<CONFIG>" --prefix "$<TARGET_BUNDLE_CONTENT_DIR:vcmiserver>"
COMMAND ${CMAKE_INSTALL_NAME_TOOL} -add_rpath @executable_path/Frameworks $<TARGET_FILE:vcmiserver> || true
)
else()
install(TARGETS vcmiserver DESTINATION ${BIN_DIR})