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

use component-based install to copy only what's needed for every app

This commit is contained in:
Andrey Filipenkov 2021-12-12 23:37:57 +03:00
parent fae295da88
commit 3388583089
9 changed files with 30 additions and 14 deletions

View File

@ -38,4 +38,4 @@ target_link_libraries(BattleAI PRIVATE vcmi)
vcmi_set_output_dir(BattleAI "AI")
enable_pch(BattleAI)
install(TARGETS BattleAI RUNTIME DESTINATION ${AI_LIB_DIR} LIBRARY DESTINATION ${AI_LIB_DIR})
install(TARGETS BattleAI RUNTIME DESTINATION ${AI_LIB_DIR} LIBRARY DESTINATION ${AI_LIB_DIR} COMPONENT AI)

View File

@ -137,7 +137,7 @@ 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} OPTIONAL)
install(TARGETS Nullkiller RUNTIME DESTINATION ${AI_LIB_DIR} LIBRARY DESTINATION ${AI_LIB_DIR} COMPONENT AI OPTIONAL)
if(APPLE_IOS)
install(IMPORTED_RUNTIME_ARTIFACTS TBB::tbb LIBRARY DESTINATION ${LIB_DIR} OPTIONAL) # CMake 3.21+
install(IMPORTED_RUNTIME_ARTIFACTS TBB::tbb LIBRARY DESTINATION ${LIB_DIR} COMPONENT AI OPTIONAL) # CMake 3.21+
endif()

View File

@ -20,4 +20,4 @@ target_include_directories(StupidAI PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
vcmi_set_output_dir(StupidAI "AI")
enable_pch(StupidAI)
install(TARGETS StupidAI RUNTIME DESTINATION ${AI_LIB_DIR} LIBRARY DESTINATION ${AI_LIB_DIR})
install(TARGETS StupidAI RUNTIME DESTINATION ${AI_LIB_DIR} LIBRARY DESTINATION ${AI_LIB_DIR} COMPONENT AI)

View File

@ -112,4 +112,4 @@ target_link_libraries(VCAI PRIVATE vcmi fuzzylite::fuzzylite)
vcmi_set_output_dir(VCAI "AI")
enable_pch(VCAI)
install(TARGETS VCAI RUNTIME DESTINATION ${AI_LIB_DIR} LIBRARY DESTINATION ${AI_LIB_DIR})
install(TARGETS VCAI RUNTIME DESTINATION ${AI_LIB_DIR} LIBRARY DESTINATION ${AI_LIB_DIR} COMPONENT AI)

View File

@ -423,9 +423,9 @@ endif()
# Installation section #
#######################################
install(DIRECTORY config DESTINATION ${DATA_DIR})
install(DIRECTORY scripts DESTINATION ${DATA_DIR})
install(DIRECTORY Mods DESTINATION ${DATA_DIR})
install(DIRECTORY config DESTINATION ${DATA_DIR} COMPONENT core)
install(DIRECTORY scripts DESTINATION ${DATA_DIR} COMPONENT core)
install(DIRECTORY Mods DESTINATION ${DATA_DIR} COMPONENT core)
# that script is useless for Windows
if(NOT WIN32 AND NOT APPLE_IOS)

View File

@ -228,7 +228,8 @@ 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_COMMAND} --install "${CMAKE_BINARY_DIR}" --config "$<CONFIG>" --component core --prefix "$<TARGET_BUNDLE_CONTENT_DIR:vcmiclient>"
COMMAND ${CMAKE_COMMAND} --install "${CMAKE_BINARY_DIR}" --config "$<CONFIG>" --component AI --prefix "$<TARGET_BUNDLE_CONTENT_DIR:vcmiclient>"
COMMAND ${CMAKE_SOURCE_DIR}/apple_codesign.sh
)
else()

View File

@ -131,9 +131,10 @@ vcmi_set_output_dir(vcmilauncher "")
enable_pch(vcmilauncher)
if(APPLE_IOS)
install(DIRECTORY icons DESTINATION ${DATA_DIR})
install(DIRECTORY icons DESTINATION ${DATA_DIR} COMPONENT launcher)
add_custom_command(TARGET vcmilauncher POST_BUILD
COMMAND ${CMAKE_COMMAND} --install "${CMAKE_BINARY_DIR}" --config "$<CONFIG>" --prefix "$<TARGET_BUNDLE_CONTENT_DIR:vcmilauncher>"
COMMAND ${CMAKE_COMMAND} --install "${CMAKE_BINARY_DIR}" --config "$<CONFIG>" --component core --prefix "$<TARGET_BUNDLE_CONTENT_DIR:vcmilauncher>"
COMMAND ${CMAKE_COMMAND} --install "${CMAKE_BINARY_DIR}" --config "$<CONFIG>" --component launcher --prefix "$<TARGET_BUNDLE_CONTENT_DIR:vcmilauncher>"
COMMAND ${CMAKE_SOURCE_DIR}/apple_codesign.sh
)
else()

View File

@ -491,4 +491,19 @@ if(TARGET update_version)
add_dependencies(vcmi update_version)
endif()
install(TARGETS vcmi RUNTIME DESTINATION ${LIB_DIR} LIBRARY DESTINATION ${LIB_DIR})
install(TARGETS vcmi RUNTIME DESTINATION ${LIB_DIR} LIBRARY DESTINATION ${LIB_DIR} COMPONENT core)
if(APPLE_IOS)
get_target_property(LINKED_LIBS vcmi LINK_LIBRARIES)
foreach(LINKED_LIB IN LISTS LINKED_LIBS)
if(TARGET ${LINKED_LIB})
get_target_property(LIB_TYPE ${LINKED_LIB} TYPE)
if(LIB_TYPE STREQUAL "SHARED_LIBRARY")
install(TARGETS ${LINKED_LIB} LIBRARY DESTINATION ${LIB_DIR} COMPONENT core)
endif()
else()
if(LINKED_LIB MATCHES "\\${CMAKE_SHARED_LIBRARY_SUFFIX}$")
install(FILES ${LINKED_LIB} DESTINATION ${LIB_DIR} COMPONENT core)
endif()
endif()
endforeach()
endif()

View File

@ -33,7 +33,6 @@ 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)
@ -72,7 +71,7 @@ enable_pch(vcmiserver)
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 "$<CONFIG>" --prefix "$<TARGET_BUNDLE_CONTENT_DIR:vcmiserver>"
COMMAND ${CMAKE_COMMAND} --install "${CMAKE_BINARY_DIR}" --config "$<CONFIG>" --component core --prefix "$<TARGET_BUNDLE_CONTENT_DIR:vcmiserver>"
COMMAND ${CMAKE_SOURCE_DIR}/apple_codesign.sh
)
else()