1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-30 23:18:08 +02:00
vcmi/client/CMakeLists.txt

293 lines
7.9 KiB
CMake
Raw Normal View History

2012-07-01 17:27:41 +03:00
set(client_SRCS
StdInc.cpp
2014-07-11 11:01:03 +03:00
../CCallback.cpp
2014-07-11 11:01:03 +03:00
battle/CBattleAnimations.cpp
battle/CBattleInterfaceClasses.cpp
battle/CBattleInterface.cpp
2014-07-11 11:01:03 +03:00
battle/CCreatureAnimation.cpp
gui/CAnimation.cpp
gui/CCursorHandler.cpp
2014-07-11 11:01:03 +03:00
gui/CGuiHandler.cpp
gui/CIntObject.cpp
gui/Fonts.cpp
gui/Geometries.cpp
gui/SDL_Extensions.cpp
2020-03-22 15:57:13 +02:00
gui/NotificationHandler.cpp
widgets/AdventureMapClasses.cpp
widgets/Buttons.cpp
widgets/CArtifactHolder.cpp
widgets/CComponent.cpp
widgets/CGarrisonInt.cpp
widgets/Images.cpp
widgets/MiscWidgets.cpp
widgets/ObjectLists.cpp
widgets/TextControls.cpp
windows/CAdvmapInterface.cpp
windows/CCastleInterface.cpp
windows/CCreatureWindow.cpp
windows/CreaturePurchaseCard.cpp
windows/CHeroWindow.cpp
windows/CKingdomInterface.cpp
windows/CQuestLog.cpp
windows/CSpellWindow.cpp
windows/CTradeWindow.cpp
windows/CWindowObject.cpp
windows/GUIClasses.cpp
windows/InfoWindows.cpp
windows/QuickRecruitmentWindow.cpp
mainmenu/CMainMenu.cpp
mainmenu/CCampaignScreen.cpp
mainmenu/CreditsScreen.cpp
mainmenu/CPrologEpilogVideo.cpp
lobby/CBonusSelection.cpp
lobby/CSelectionBase.cpp
lobby/CLobbyScreen.cpp
lobby/CSavingScreen.cpp
lobby/CScenarioInfoScreen.cpp
lobby/CCampaignInfoScreen.cpp
lobby/OptionsTab.cpp
lobby/RandomMapTab.cpp
lobby/SelectionTab.cpp
2014-07-11 11:01:03 +03:00
CBitmapHandler.cpp
CreatureCostBox.cpp
2014-07-11 11:01:03 +03:00
CGameInfo.cpp
Client.cpp
2014-07-11 11:01:03 +03:00
CMessage.cpp
CMT.cpp
2014-07-11 11:01:03 +03:00
CMusicHandler.cpp
CPlayerInterface.cpp
2014-07-11 11:01:03 +03:00
CVideoHandler.cpp
CServerHandler.cpp
2014-07-11 11:01:03 +03:00
Graphics.cpp
mapHandler.cpp
NetPacksClient.cpp
NetPacksLobbyClient.cpp
2016-01-30 23:34:46 +02:00
SDLRWwrapper.cpp
2012-07-01 17:27:41 +03:00
)
set(client_HEADERS
StdInc.h
battle/CBattleAnimations.h
battle/CBattleInterfaceClasses.h
battle/CBattleInterface.h
battle/CCreatureAnimation.h
gui/CAnimation.h
gui/CCursorHandler.h
gui/CGuiHandler.h
gui/CIntObject.h
gui/Fonts.h
gui/Geometries.h
gui/SDL_Compat.h
gui/SDL_Extensions.h
gui/SDL_Pixels.h
2020-03-22 15:57:13 +02:00
gui/NotificationHandler.h
widgets/AdventureMapClasses.h
widgets/Buttons.h
widgets/CArtifactHolder.h
widgets/CComponent.h
widgets/CGarrisonInt.h
widgets/Images.h
widgets/MiscWidgets.h
widgets/ObjectLists.h
widgets/TextControls.h
windows/CAdvmapInterface.h
windows/CCastleInterface.h
windows/CCreatureWindow.h
windows/CreaturePurchaseCard.h
windows/CHeroWindow.h
windows/CKingdomInterface.h
windows/CQuestLog.h
windows/CSpellWindow.h
windows/CTradeWindow.h
windows/CWindowObject.h
windows/GUIClasses.h
windows/InfoWindows.h
windows/QuickRecruitmentWindow.h
mainmenu/CMainMenu.h
mainmenu/CCampaignScreen.h
mainmenu/CreditsScreen.h
mainmenu/CPrologEpilogVideo.h
lobby/CBonusSelection.h
lobby/CSelectionBase.h
lobby/CLobbyScreen.h
lobby/CSavingScreen.h
lobby/CScenarioInfoScreen.h
lobby/CCampaignInfoScreen.h
lobby/OptionsTab.h
lobby/RandomMapTab.h
lobby/SelectionTab.h
CBitmapHandler.h
CreatureCostBox.h
CGameInfo.h
Client.h
CMessage.h
CMT.h
CMusicHandler.h
CPlayerInterface.h
CVideoHandler.h
CServerHandler.h
Graphics.h
mapHandler.h
resource.h
SDLRWwrapper.h
)
if(APPLE_IOS)
set(client_SRCS ${client_SRCS}
CFocusableHelper.cpp
2022-09-29 11:47:31 +02:00
ios/GameChatKeyboardHandler.m
ios/main.m
ios/startSDL.mm
ios/utils.mm
)
set(client_HEADERS ${client_HEADERS}
CFocusableHelper.h
2022-09-29 11:47:31 +02:00
ios/GameChatKeyboardHandler.h
ios/startSDL.h
ios/utils.h
)
endif()
assign_source_group(${client_SRCS} ${client_HEADERS} VCMI_client.rc)
if(ANDROID) # android needs client/server to be libraries, not executables, so we can't reuse the build part of this script
return()
endif()
if(WIN32)
set(client_ICON "VCMI_client.rc")
endif()
if(ENABLE_DEBUG_CONSOLE)
add_executable(vcmiclient ${client_SRCS} ${client_HEADERS} ${client_ICON})
else()
add_executable(vcmiclient WIN32 ${client_SRCS} ${client_HEADERS} ${client_ICON})
endif(ENABLE_DEBUG_CONSOLE)
2022-08-15 13:38:03 +02:00
add_dependencies(vcmiclient vcmiserver BattleAI StupidAI VCAI Nullkiller)
2022-08-15 13:38:03 +02:00
if(APPLE_IOS)
if(ENABLE_ERM)
add_dependencies(vcmiclient vcmiERM)
endif()
if(ENABLE_LUA)
add_dependencies(vcmiclient vcmiLua)
endif()
endif()
2012-07-01 17:27:41 +03:00
2014-07-10 01:06:37 +03:00
if(WIN32)
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)
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>"
2022-10-04 20:30:18 +02:00
COMMAND ${CMAKE_COMMAND} -E copy AI/fuzzylite.dll fuzzylite.dll
COMMAND ${CMAKE_COMMAND} -E copy AI/tbb.dll tbb.dll
)
endif()
elseif(APPLE_IOS)
target_link_libraries(vcmiclient PRIVATE
2022-08-15 15:29:11 +02:00
iOS_utils
# FFmpeg
bz2
iconv
z
2022-06-27 12:01:23 +02:00
"-framework AudioToolbox"
"-framework AVFoundation"
"-framework CoreMedia"
"-framework VideoToolbox"
2021-03-02 02:56:54 +02:00
)
2021-03-12 12:31:05 +02:00
set_target_properties(vcmiclient PROPERTIES
2021-03-13 22:23:20 +02:00
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_LIST_DIR}/ios/Info.plist"
XCODE_ATTRIBUTE_LD_RUNPATH_SEARCH_PATHS "@executable_path/Frameworks"
2021-12-02 14:02:34 +02:00
XCODE_ATTRIBUTE_CODE_SIGNING_ALLOWED "$(CODE_SIGNING_ALLOWED_FOR_APPS)"
2021-03-13 15:53:31 +02:00
XCODE_ATTRIBUTE_ASSETCATALOG_COMPILER_APPICON_NAME AppIcon
2021-03-12 12:31:05 +02:00
)
2021-03-10 09:57:07 +02:00
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
2022-08-15 09:44:45 +02:00
# add max version condition when https://gitlab.kitware.com/cmake/cmake/-/merge_requests/7562 is merged
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.22.0")
set_source_files_properties(${XCODE_RESOURCE_PATH} PROPERTIES LANGUAGE CXX)
endif()
endforeach()
2021-03-13 15:53:31 +02:00
set(CMAKE_EXE_LINKER_FLAGS "-Wl,-e,_client_main")
2014-07-10 01:06:37 +03:00
endif()
if(BUILD_SINGLE_APP)
target_link_libraries(vcmiclient PRIVATE vcmiserver)
if(ENABLE_LAUNCHER)
target_link_libraries(vcmiclient PRIVATE vcmilauncher)
endif()
endif()
target_link_libraries(vcmiclient PRIVATE
${VCMI_LIB_TARGET} SDL2::SDL2 SDL2::Image SDL2::Mixer SDL2::TTF
)
2022-09-17 13:54:22 +02:00
if(ffmpeg_LIBRARIES)
target_link_libraries(vcmiclient PRIVATE
2022-06-27 12:01:23 +02:00
${ffmpeg_LIBRARIES}
2022-09-17 13:54:22 +02:00
)
else()
target_compile_definitions(vcmiclient PRIVATE DISABLE_VIDEO)
endif()
2021-07-27 20:26:17 +02:00
target_include_directories(vcmiclient
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
vcmi_set_output_dir(vcmiclient "")
enable_pch(vcmiclient)
if(APPLE_IOS)
2022-10-13 12:04:32 +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
else()
install(TARGETS vcmiclient DESTINATION ${BIN_DIR})
endif()
#install icons and desktop file on Linux
if(NOT WIN32 AND NOT APPLE)
#FIXME: move to client makefile?
install(FILES "${CMAKE_SOURCE_DIR}/client/icons/vcmiclient.64x64.png" DESTINATION share/icons/hicolor/64x64/apps RENAME vcmiclient.png)
install(FILES "${CMAKE_SOURCE_DIR}/client/icons/vcmiclient.48x48.png" DESTINATION share/icons/hicolor/48x48/apps RENAME vcmiclient.png)
install(FILES "${CMAKE_SOURCE_DIR}/client/icons/vcmiclient.32x32.png" DESTINATION share/icons/hicolor/32x32/apps RENAME vcmiclient.png)
install(FILES "${CMAKE_SOURCE_DIR}/client/icons/vcmiclient.256x256.png" DESTINATION share/icons/hicolor/256x256/apps RENAME vcmiclient.png)
install(FILES "${CMAKE_SOURCE_DIR}/client/icons/vcmiclient.desktop" DESTINATION share/applications)
endif()