2024-08-14 17:36:42 +02:00
|
|
|
set(clientapp_SRCS
|
2024-08-31 17:12:00 +02:00
|
|
|
StdInc.cpp
|
|
|
|
EntryPoint.cpp
|
2024-08-14 17:36:42 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
set(clientapp_HEADERS
|
2024-08-31 17:12:00 +02:00
|
|
|
StdInc.h
|
2024-08-14 17:36:42 +02:00
|
|
|
)
|
|
|
|
|
2024-08-14 22:30:19 +02:00
|
|
|
if(APPLE_IOS)
|
2024-08-31 17:12:00 +02:00
|
|
|
set(clientapp_SRCS ${clientapp_SRCS}
|
|
|
|
CFocusableHelper.cpp
|
|
|
|
ios/GameChatKeyboardHandler.m
|
|
|
|
ios/main.m
|
|
|
|
ios/startSDL.mm
|
|
|
|
)
|
|
|
|
set(clientapp_HEADERS ${clientapp_HEADERS}
|
|
|
|
CFocusableHelper.h
|
|
|
|
ios/GameChatKeyboardHandler.h
|
|
|
|
ios/startSDL.h
|
|
|
|
)
|
2024-08-14 22:30:19 +02:00
|
|
|
endif()
|
|
|
|
|
2024-08-14 17:36:42 +02:00
|
|
|
assign_source_group(${clientapp_SRCS} ${clientapp_HEADERS})
|
2024-08-19 12:17:38 +02:00
|
|
|
|
|
|
|
if(ANDROID)
|
2024-08-31 17:12:00 +02:00
|
|
|
add_library(vcmiclient SHARED ${clientapp_SRCS} ${clientapp_HEADERS})
|
|
|
|
set_target_properties(vcmiclient PROPERTIES
|
|
|
|
OUTPUT_NAME "vcmiclient_${ANDROID_ABI}" # required by Qt
|
|
|
|
)
|
2024-08-19 12:17:38 +02:00
|
|
|
else()
|
2024-08-31 17:12:00 +02:00
|
|
|
add_executable(vcmiclient ${clientapp_SRCS} ${clientapp_HEADERS})
|
2024-08-19 12:17:38 +02:00
|
|
|
endif()
|
2024-08-14 17:36:42 +02:00
|
|
|
|
|
|
|
target_link_libraries(vcmiclient PRIVATE vcmiclientcommon)
|
|
|
|
|
2024-08-21 15:07:30 +02:00
|
|
|
if(ENABLE_SINGLE_APP_BUILD AND ENABLE_LAUNCHER)
|
2024-08-31 17:12:00 +02:00
|
|
|
target_link_libraries(vcmiclient PRIVATE vcmilauncher)
|
2024-08-21 15:07:30 +02:00
|
|
|
endif()
|
|
|
|
|
2024-08-14 17:36:42 +02:00
|
|
|
target_include_directories(vcmiclient
|
2024-08-31 17:12:00 +02:00
|
|
|
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
|
2024-08-14 17:36:42 +02:00
|
|
|
)
|
|
|
|
|
|
|
|
if(WIN32)
|
2024-08-31 17:12:00 +02:00
|
|
|
target_sources(vcmiclient PRIVATE "VCMI_client.rc")
|
|
|
|
set_target_properties(vcmiclient
|
|
|
|
PROPERTIES
|
|
|
|
OUTPUT_NAME "VCMI_client"
|
|
|
|
PROJECT_LABEL "VCMI_client"
|
|
|
|
)
|
|
|
|
set_property(DIRECTORY ${CMAKE_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT vcmiclient)
|
|
|
|
if(NOT ENABLE_DEBUG_CONSOLE)
|
|
|
|
set_target_properties(vcmiclient PROPERTIES WIN32_EXECUTABLE)
|
|
|
|
target_link_libraries(vcmiclient SDL2::SDL2main)
|
|
|
|
endif()
|
|
|
|
target_compile_definitions(vcmiclient PRIVATE WINDOWS_IGNORE_PACKING_MISMATCH)
|
|
|
|
|
|
|
|
# TODO: very hacky, find proper solution to copy AI dlls into bin dir
|
|
|
|
if(MSVC)
|
|
|
|
add_custom_command(TARGET vcmiclient POST_BUILD
|
|
|
|
WORKING_DIRECTORY "$<TARGET_FILE_DIR:vcmiclient>"
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy AI/fuzzylite.dll fuzzylite.dll
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy AI/tbb12.dll tbb12.dll
|
|
|
|
)
|
|
|
|
endif()
|
2024-08-14 17:36:42 +02:00
|
|
|
elseif(APPLE_IOS)
|
2024-08-31 17:12:00 +02:00
|
|
|
set_target_properties(vcmiclient 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
|
|
|
|
)
|
|
|
|
|
|
|
|
foreach(XCODE_RESOURCE LaunchScreen.storyboard Images.xcassets Settings.bundle vcmi_logo.png)
|
|
|
|
set(XCODE_RESOURCE_PATH ios/${XCODE_RESOURCE})
|
|
|
|
target_sources(vcmiclient PRIVATE ${XCODE_RESOURCE_PATH})
|
|
|
|
set_source_files_properties(${XCODE_RESOURCE_PATH} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
|
|
|
|
|
|
|
|
# workaround to prevent CMAKE_SKIP_PRECOMPILE_HEADERS being added as compile flag
|
|
|
|
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.22.0" AND CMAKE_VERSION VERSION_LESS "3.25.0")
|
|
|
|
set_source_files_properties(${XCODE_RESOURCE_PATH} PROPERTIES LANGUAGE CXX)
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "-Wl,-e,_client_main")
|
2024-08-14 17:36:42 +02:00
|
|
|
endif()
|
|
|
|
|
|
|
|
vcmi_set_output_dir(vcmiclient "")
|
|
|
|
enable_pch(vcmiclient)
|
|
|
|
|
|
|
|
if(APPLE_IOS)
|
2024-08-31 17:12:00 +02:00
|
|
|
vcmi_install_conan_deps("\${CMAKE_INSTALL_PREFIX}")
|
|
|
|
add_custom_command(TARGET vcmiclient POST_BUILD
|
|
|
|
COMMAND ios/set_build_version.sh "$<TARGET_BUNDLE_CONTENT_DIR:vcmiclient>"
|
|
|
|
COMMAND ${CMAKE_COMMAND} --install "${CMAKE_BINARY_DIR}" --component "${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}" --config "$<CONFIG>" --prefix "$<TARGET_BUNDLE_CONTENT_DIR:vcmiclient>"
|
|
|
|
COMMAND ios/rpath_remove_symlinks.sh
|
|
|
|
COMMAND ios/codesign.sh
|
|
|
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
|
|
|
)
|
|
|
|
install(TARGETS vcmiclient DESTINATION Payload COMPONENT app) # for ipa generation with cpack
|
2024-08-14 17:36:42 +02:00
|
|
|
elseif(ANDROID)
|
2024-08-31 17:12:00 +02:00
|
|
|
find_program(androidDeployQt androiddeployqt
|
|
|
|
PATHS "${qtBinDir}"
|
|
|
|
)
|
|
|
|
vcmi_install_conan_deps("\${CMAKE_INSTALL_PREFIX}/${LIB_DIR}")
|
|
|
|
|
|
|
|
add_custom_target(android_deploy ALL
|
|
|
|
COMMAND ${CMAKE_COMMAND} --install "${CMAKE_BINARY_DIR}" --config "$<CONFIG>" --prefix "${androidQtBuildDir}"
|
|
|
|
COMMAND "${androidDeployQt}" --input "${CMAKE_BINARY_DIR}/androiddeployqt.json" --output "${androidQtBuildDir}" --android-platform "android-${ANDROID_TARGET_SDK_VERSION}" --verbose $<$<NOT:$<CONFIG:Debug>>:--release> ${ANDROIDDEPLOYQT_OPTIONS}
|
|
|
|
COMMAND_EXPAND_LISTS
|
|
|
|
VERBATIM
|
|
|
|
COMMENT "Create android package"
|
|
|
|
)
|
|
|
|
add_dependencies(android_deploy vcmiclient)
|
2024-08-14 17:36:42 +02:00
|
|
|
else()
|
2024-08-31 17:12:00 +02:00
|
|
|
install(TARGETS vcmiclient DESTINATION ${BIN_DIR})
|
2024-08-14 17:36:42 +02:00
|
|
|
endif()
|
|
|
|
|
|
|
|
#install icons and desktop file on Linux
|
|
|
|
if(NOT WIN32 AND NOT APPLE AND NOT ANDROID)
|
2024-08-31 17:12:00 +02:00
|
|
|
#FIXME: move to client makefile?
|
|
|
|
foreach(iconSize 16 22 32 48 64 128 256 512 1024 2048)
|
|
|
|
install(FILES "icons/vcmiclient.${iconSize}x${iconSize}.png"
|
|
|
|
DESTINATION "share/icons/hicolor/${iconSize}x${iconSize}/apps"
|
|
|
|
RENAME vcmiclient.png
|
|
|
|
)
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
install(FILES icons/vcmiclient.svg
|
|
|
|
DESTINATION share/icons/hicolor/scalable/apps
|
|
|
|
RENAME vcmiclient.svg
|
|
|
|
)
|
|
|
|
install(FILES icons/vcmiclient.desktop
|
|
|
|
DESTINATION share/applications
|
|
|
|
)
|
2024-08-14 17:36:42 +02:00
|
|
|
endif()
|