1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-11-28 08:48:48 +02:00

merge launcher and client

launcher is a static lib now
This commit is contained in:
Andrey Filipenkov 2022-08-03 10:49:04 +03:00
parent 6642592567
commit 5e838008df
8 changed files with 26 additions and 43 deletions

View File

@ -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})

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} 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()

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} COMPONENT AI)
install(TARGETS StupidAI RUNTIME DESTINATION ${AI_LIB_DIR} LIBRARY DESTINATION ${AI_LIB_DIR})

View File

@ -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})

View File

@ -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)

View File

@ -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 "$<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_COMMAND} --install "${CMAKE_BINARY_DIR}" --config "$<CONFIG>" --prefix "$<TARGET_BUNDLE_CONTENT_DIR:vcmiclient>"
COMMAND ${CMAKE_SOURCE_DIR}/apple_codesign.sh
)
else()

View File

@ -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()

View File

@ -80,7 +80,11 @@ if(WIN32)
set(launcher_ICON VCMI_launcher.rc)
endif()
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 "$<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
)
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})