diff --git a/AI/BattleAI/CMakeLists.txt b/AI/BattleAI/CMakeLists.txt index 2e0c13f40..415ec9e79 100644 --- a/AI/BattleAI/CMakeLists.txt +++ b/AI/BattleAI/CMakeLists.txt @@ -38,4 +38,4 @@ target_link_libraries(BattleAI PRIVATE ${VCMI_LIB_TARGET}) vcmi_set_output_dir(BattleAI "AI") enable_pch(BattleAI) -install(TARGETS BattleAI RUNTIME DESTINATION ${AI_LIB_DIR} LIBRARY DESTINATION ${AI_LIB_DIR} COMPONENT AI) +install(TARGETS BattleAI RUNTIME DESTINATION ${AI_LIB_DIR} LIBRARY DESTINATION ${AI_LIB_DIR}) diff --git a/AI/Nullkiller/CMakeLists.txt b/AI/Nullkiller/CMakeLists.txt index bbe7a2126..0ccf0a281 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} COMPONENT AI OPTIONAL) +install(TARGETS Nullkiller RUNTIME DESTINATION ${AI_LIB_DIR} LIBRARY DESTINATION ${AI_LIB_DIR}) if(APPLE_IOS) - install(IMPORTED_RUNTIME_ARTIFACTS TBB::tbb LIBRARY DESTINATION ${LIB_DIR} COMPONENT AI OPTIONAL) # CMake 3.21+ + install(IMPORTED_RUNTIME_ARTIFACTS TBB::tbb LIBRARY DESTINATION ${LIB_DIR}) # CMake 3.21+ endif() diff --git a/AI/StupidAI/CMakeLists.txt b/AI/StupidAI/CMakeLists.txt index efa37ba5d..9230b57c3 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} COMPONENT AI) +install(TARGETS StupidAI RUNTIME DESTINATION ${AI_LIB_DIR} LIBRARY DESTINATION ${AI_LIB_DIR}) diff --git a/AI/VCAI/CMakeLists.txt b/AI/VCAI/CMakeLists.txt index 5735eecab..259129afe 100644 --- a/AI/VCAI/CMakeLists.txt +++ b/AI/VCAI/CMakeLists.txt @@ -112,4 +112,4 @@ target_link_libraries(VCAI PRIVATE ${VCMI_LIB_TARGET} fuzzylite::fuzzylite) vcmi_set_output_dir(VCAI "AI") enable_pch(VCAI) -install(TARGETS VCAI RUNTIME DESTINATION ${AI_LIB_DIR} LIBRARY DESTINATION ${AI_LIB_DIR} COMPONENT AI) +install(TARGETS VCAI RUNTIME DESTINATION ${AI_LIB_DIR} LIBRARY DESTINATION ${AI_LIB_DIR}) diff --git a/CMakeLists.txt b/CMakeLists.txt index 32196fd76..1feb37be6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -425,12 +425,12 @@ else() add_subdirectory(lib) endif() -add_subdirectory(client) -add_subdirectory(server) -add_subdirectory_with_folder("AI" AI) if(ENABLE_LAUNCHER) add_subdirectory(launcher) endif() +add_subdirectory(client) +add_subdirectory(server) +add_subdirectory_with_folder("AI" AI) if(ENABLE_TEST) enable_testing() add_subdirectory(test) diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index b56e75a16..6a32dba15 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -226,6 +226,9 @@ endif() if(BUILD_SINGLE_APP) target_link_libraries(vcmiclient PRIVATE vcmiserver) + if(ENABLE_LAUNCHER) + target_link_libraries(vcmiclient PRIVATE vcmilauncher) + endif() set(VCMI_LIB_TARGET vcmi_lib_client) else() set(VCMI_LIB_TARGET vcmi) @@ -250,8 +253,7 @@ enable_pch(vcmiclient) if(APPLE_IOS) add_custom_command(TARGET vcmiclient POST_BUILD - COMMAND ${CMAKE_COMMAND} --install "${CMAKE_BINARY_DIR}" --config "$" --component core --prefix "$" - COMMAND ${CMAKE_COMMAND} --install "${CMAKE_BINARY_DIR}" --config "$" --component AI --prefix "$" + COMMAND ${CMAKE_COMMAND} --install "${CMAKE_BINARY_DIR}" --config "$" --prefix "$" COMMAND ${CMAKE_SOURCE_DIR}/apple_codesign.sh ) else() diff --git a/cmake_modules/VCMI_lib.cmake b/cmake_modules/VCMI_lib.cmake index 9873d3cbf..ec688e307 100644 --- a/cmake_modules/VCMI_lib.cmake +++ b/cmake_modules/VCMI_lib.cmake @@ -495,14 +495,14 @@ macro(add_main_lib TARGET_NAME LIBRARY_TYPE) endif() if("${LIBRARY_TYPE}" STREQUAL SHARED) - install(TARGETS ${TARGET_NAME} RUNTIME DESTINATION ${LIB_DIR} LIBRARY DESTINATION ${LIB_DIR} COMPONENT core) + install(TARGETS ${TARGET_NAME} RUNTIME DESTINATION ${LIB_DIR} LIBRARY DESTINATION ${LIB_DIR}) endif() if(APPLE_IOS) get_target_property(LINKED_LIBS ${TARGET_NAME} LINK_LIBRARIES) foreach(LINKED_LIB IN LISTS LINKED_LIBS) if(NOT TARGET ${LINKED_LIB}) if(LINKED_LIB MATCHES "\\${CMAKE_SHARED_LIBRARY_SUFFIX}$") - install(FILES ${LINKED_LIB} DESTINATION ${LIB_DIR} COMPONENT core) + install(FILES ${LINKED_LIB} DESTINATION ${LIB_DIR}) endif() continue() endif() @@ -526,13 +526,13 @@ macro(add_main_lib TARGET_NAME LIBRARY_TYPE) foreach(BOOST_DEPENDENCY IN LISTS BOOST_DEPENDENCIES) get_target_property(BOOST_DEPENDENCY_TYPE ${BOOST_DEPENDENCY} TYPE) if(BOOST_DEPENDENCY_TYPE STREQUAL "SHARED_LIBRARY") - install(IMPORTED_RUNTIME_ARTIFACTS ${BOOST_DEPENDENCY} LIBRARY DESTINATION ${LIB_DIR} COMPONENT core) + install(IMPORTED_RUNTIME_ARTIFACTS ${BOOST_DEPENDENCY} LIBRARY DESTINATION ${LIB_DIR}) endif() endforeach() else() set(INSTALL_TYPE TARGETS) endif() - install(${INSTALL_TYPE} ${LINKED_LIB_REAL} LIBRARY DESTINATION ${LIB_DIR} COMPONENT core) + install(${INSTALL_TYPE} ${LINKED_LIB_REAL} LIBRARY DESTINATION ${LIB_DIR}) endforeach() endif() endmacro() diff --git a/launcher/CMakeLists.txt b/launcher/CMakeLists.txt index 2d2880511..e1cebc975 100644 --- a/launcher/CMakeLists.txt +++ b/launcher/CMakeLists.txt @@ -80,7 +80,11 @@ if(WIN32) set(launcher_ICON VCMI_launcher.rc) endif() -add_executable(vcmilauncher WIN32 ${launcher_SRCS} ${launcher_HEADERS} ${launcher_UI_HEADERS} ${launcher_ICON}) +if(BUILD_SINGLE_APP) + add_library(vcmilauncher STATIC ${launcher_SRCS} ${launcher_HEADERS} ${launcher_UI_HEADERS}) +else() + add_executable(vcmilauncher WIN32 ${launcher_SRCS} ${launcher_HEADERS} ${launcher_UI_HEADERS} ${launcher_ICON}) +endif() if(WIN32) set_target_properties(vcmilauncher @@ -102,26 +106,6 @@ if(APPLE) # This makes Xcode project prettier by moving vcmilauncher_autogen directory into vcmiclient subfolder set_property(GLOBAL PROPERTY AUTOGEN_TARGETS_FOLDER vcmilauncher) endif() -if(APPLE_IOS) - set(CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS} "-Wl,-e,_qt_main_wrapper") - - set(ENTITLEMENTS_OUT_PATH ${CMAKE_CURRENT_BINARY_DIR}/VCMI.entitlements) - configure_file(ios/Entitlements.in ${ENTITLEMENTS_OUT_PATH} @ONLY) - - set_target_properties(vcmilauncher PROPERTIES - MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_LIST_DIR}/ios/Info.plist" - XCODE_ATTRIBUTE_LD_RUNPATH_SEARCH_PATHS "@executable_path/Frameworks" - XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "$(CODE_SIGNING_ALLOWED_FOR_APPS)" - XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME AppIcon - XCODE_ATTRIBUTE_CODE_SIGN_ENTITLEMENTS ${ENTITLEMENTS_OUT_PATH} - ) - - target_sources(vcmilauncher PRIVATE ${CMAKE_SOURCE_DIR}/client/LaunchScreen.storyboard) - set_source_files_properties(${CMAKE_SOURCE_DIR}/client/LaunchScreen.storyboard PROPERTIES MACOSX_PACKAGE_LOCATION "Resources") - - target_sources(vcmilauncher PRIVATE ios/Images.xcassets) - set_source_files_properties(ios/Images.xcassets PROPERTIES MACOSX_PACKAGE_LOCATION "Resources") -endif() if(BUILD_SINGLE_APP) set(VCMI_LIB_TARGET vcmi_lib_client) @@ -136,13 +120,10 @@ vcmi_set_output_dir(vcmilauncher "") enable_pch(vcmilauncher) if(APPLE_IOS) - install(DIRECTORY icons DESTINATION ${DATA_DIR} COMPONENT launcher) - add_custom_command(TARGET vcmilauncher POST_BUILD - 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 - ) + set(ICONS_DESTINATION ${DATA_DIR}) else() + set(ICONS_DESTINATION ${DATA_DIR}/launcher) + # Copy to build directory for easier debugging add_custom_command(TARGET vcmilauncher POST_BUILD COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_BINARY_DIR}/bin/${CMAKE_CFG_INTDIR}/launcher/icons @@ -150,11 +131,11 @@ else() ) install(TARGETS vcmilauncher DESTINATION ${BIN_DIR}) - # copy whole directory - install(DIRECTORY icons DESTINATION ${DATA_DIR}/launcher) + # Install icons and desktop file on Linux if(NOT WIN32 AND NOT APPLE) install(FILES "vcmilauncher.desktop" DESTINATION share/applications) install(FILES "eu.vcmi.VCMI.metainfo.xml" DESTINATION share/metainfo) endif() endif() +install(DIRECTORY icons DESTINATION ${ICONS_DESTINATION})