diff --git a/AI/BattleAI/CMakeLists.txt b/AI/BattleAI/CMakeLists.txt index 527ccdcd3..1c0754b4c 100644 --- a/AI/BattleAI/CMakeLists.txt +++ b/AI/BattleAI/CMakeLists.txt @@ -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) diff --git a/AI/Nullkiller/CMakeLists.txt b/AI/Nullkiller/CMakeLists.txt index 43036e7a6..beb4ccd0b 100644 --- a/AI/Nullkiller/CMakeLists.txt +++ b/AI/Nullkiller/CMakeLists.txt @@ -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() diff --git a/AI/StupidAI/CMakeLists.txt b/AI/StupidAI/CMakeLists.txt index 1943fa2ff..f99948995 100644 --- a/AI/StupidAI/CMakeLists.txt +++ b/AI/StupidAI/CMakeLists.txt @@ -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) diff --git a/AI/VCAI/CMakeLists.txt b/AI/VCAI/CMakeLists.txt index e96423834..7f16361ba 100644 --- a/AI/VCAI/CMakeLists.txt +++ b/AI/VCAI/CMakeLists.txt @@ -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) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2d853e8d7..f395b505f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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) diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index 9898da1e8..5264233a5 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -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 "$" --prefix "$" + COMMAND ${CMAKE_COMMAND} --install "${CMAKE_BINARY_DIR}" --config "$" --component core --prefix "$" + COMMAND ${CMAKE_COMMAND} --install "${CMAKE_BINARY_DIR}" --config "$" --component AI --prefix "$" COMMAND ${CMAKE_SOURCE_DIR}/apple_codesign.sh ) else() diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt index 681dbd6e7..0d3bcebbb 100644 --- a/launcher/CMakeLists.txt +++ b/launcher/CMakeLists.txt @@ -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 "$" --prefix "$" + COMMAND ${CMAKE_COMMAND} --install "${CMAKE_BINARY_DIR}" --config "$" --component core --prefix "$" + COMMAND ${CMAKE_COMMAND} --install "${CMAKE_BINARY_DIR}" --config "$" --component launcher --prefix "$" COMMAND ${CMAKE_SOURCE_DIR}/apple_codesign.sh ) else() diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt index 35d7d3d38..d21408085 100644 --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt @@ -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() diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt index 4d1c7cab8..95cd7f135 100644 --- a/server/CMakeLists.txt +++ b/server/CMakeLists.txt @@ -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 "$" --prefix "$" + COMMAND ${CMAKE_COMMAND} --install "${CMAKE_BINARY_DIR}" --config "$" --component core --prefix "$" COMMAND ${CMAKE_SOURCE_DIR}/apple_codesign.sh ) else()