2024-04-01 02:31:33 +02:00
|
|
|
if(ENABLE_INNOEXTRACT)
|
|
|
|
add_subdirectory("lib/innoextract")
|
2024-04-16 22:23:41 +02:00
|
|
|
add_definitions(-DENABLE_INNOEXTRACT)
|
2024-04-01 02:31:33 +02:00
|
|
|
endif()
|
|
|
|
|
2023-01-26 18:24:34 +02:00
|
|
|
set(launcher_SRCS
|
|
|
|
StdInc.cpp
|
2023-06-30 14:24:43 +02:00
|
|
|
aboutProject/aboutproject_moc.cpp
|
2017-08-15 20:17:00 +02:00
|
|
|
modManager/cdownloadmanager_moc.cpp
|
2024-11-12 22:00:21 +02:00
|
|
|
modManager/modstateitemmodel_moc.cpp
|
2017-08-15 20:17:00 +02:00
|
|
|
modManager/cmodlistview_moc.cpp
|
2024-11-12 22:00:21 +02:00
|
|
|
modManager/modstatecontroller.cpp
|
|
|
|
modManager/modstatemodel.cpp
|
|
|
|
modManager/modstate.cpp
|
2017-08-15 20:17:00 +02:00
|
|
|
modManager/imageviewer_moc.cpp
|
2024-08-30 21:17:18 +02:00
|
|
|
modManager/chroniclesextractor.cpp
|
2017-08-15 20:17:00 +02:00
|
|
|
settingsView/csettingsview_moc.cpp
|
2023-01-26 18:24:34 +02:00
|
|
|
firstLaunch/firstlaunch_moc.cpp
|
2017-08-15 20:17:00 +02:00
|
|
|
main.cpp
|
2024-04-21 16:56:39 +02:00
|
|
|
helper.cpp
|
2024-09-02 23:36:42 +02:00
|
|
|
innoextract.cpp
|
2017-08-15 20:17:00 +02:00
|
|
|
mainwindow_moc.cpp
|
2023-03-08 00:23:37 +02:00
|
|
|
languages.cpp
|
2022-09-04 18:32:48 +02:00
|
|
|
updatedialog_moc.cpp
|
2024-03-02 23:24:00 +02:00
|
|
|
prepare.cpp
|
2013-08-22 17:22:49 +03:00
|
|
|
)
|
2024-03-02 23:24:00 +02:00
|
|
|
if(APPLE_IOS)
|
|
|
|
list(APPEND launcher_SRCS
|
|
|
|
ios/launchGame.m
|
2024-06-13 02:53:43 +02:00
|
|
|
ios/revealdirectoryinfiles.h
|
|
|
|
ios/revealdirectoryinfiles.mm
|
2024-06-09 17:10:28 +02:00
|
|
|
ios/selectdirectory.h
|
|
|
|
ios/selectdirectory.mm
|
2024-03-02 23:24:00 +02:00
|
|
|
)
|
|
|
|
endif()
|
2013-08-22 17:22:49 +03:00
|
|
|
|
2017-07-13 01:44:58 +02:00
|
|
|
set(launcher_HEADERS
|
2017-08-15 20:17:00 +02:00
|
|
|
StdInc.h
|
2023-06-30 14:24:43 +02:00
|
|
|
aboutProject/aboutproject_moc.h
|
2023-01-26 18:24:34 +02:00
|
|
|
modManager/cdownloadmanager_moc.h
|
2024-11-12 22:00:21 +02:00
|
|
|
modManager/modstateitemmodel_moc.h
|
2023-01-26 18:24:34 +02:00
|
|
|
modManager/cmodlistview_moc.h
|
2024-11-12 22:00:21 +02:00
|
|
|
modManager/modstatecontroller.h
|
|
|
|
modManager/modstatemodel.h
|
|
|
|
modManager/modstate.h
|
2023-01-26 18:24:34 +02:00
|
|
|
modManager/imageviewer_moc.h
|
2024-08-30 21:17:18 +02:00
|
|
|
modManager/chroniclesextractor.h
|
2023-01-26 18:24:34 +02:00
|
|
|
settingsView/csettingsview_moc.h
|
|
|
|
firstLaunch/firstlaunch_moc.h
|
2017-08-15 20:17:00 +02:00
|
|
|
mainwindow_moc.h
|
2023-03-08 00:23:37 +02:00
|
|
|
languages.h
|
2022-09-04 18:32:48 +02:00
|
|
|
updatedialog_moc.h
|
2022-08-05 13:32:29 +02:00
|
|
|
main.h
|
2024-03-02 23:24:00 +02:00
|
|
|
helper.h
|
2024-09-02 23:36:42 +02:00
|
|
|
innoextract.h
|
2024-03-02 23:24:00 +02:00
|
|
|
prepare.h
|
2017-07-13 01:44:58 +02:00
|
|
|
)
|
|
|
|
|
2013-08-22 17:22:49 +03:00
|
|
|
set(launcher_FORMS
|
2023-06-30 14:24:43 +02:00
|
|
|
aboutProject/aboutproject_moc.ui
|
2017-08-15 20:17:00 +02:00
|
|
|
modManager/cmodlistview_moc.ui
|
|
|
|
modManager/imageviewer_moc.ui
|
|
|
|
settingsView/csettingsview_moc.ui
|
2023-01-26 18:24:34 +02:00
|
|
|
firstLaunch/firstlaunch_moc.ui
|
2017-08-15 20:17:00 +02:00
|
|
|
mainwindow_moc.ui
|
2022-09-04 18:32:48 +02:00
|
|
|
updatedialog_moc.ui
|
2013-08-22 17:22:49 +03:00
|
|
|
)
|
|
|
|
|
2024-03-02 23:24:00 +02:00
|
|
|
set(launcher_RESOURCES
|
|
|
|
resources.qrc
|
|
|
|
)
|
|
|
|
|
|
|
|
set(translationsDir "translation")
|
2022-12-25 22:18:14 +02:00
|
|
|
set(launcher_TS
|
2024-03-02 23:24:00 +02:00
|
|
|
"${translationsDir}/chinese.ts"
|
|
|
|
"${translationsDir}/czech.ts"
|
|
|
|
"${translationsDir}/english.ts"
|
|
|
|
"${translationsDir}/french.ts"
|
|
|
|
"${translationsDir}/german.ts"
|
|
|
|
"${translationsDir}/polish.ts"
|
|
|
|
"${translationsDir}/portuguese.ts"
|
|
|
|
"${translationsDir}/russian.ts"
|
|
|
|
"${translationsDir}/spanish.ts"
|
2024-09-16 18:59:04 +02:00
|
|
|
"${translationsDir}/swedish.ts"
|
2024-03-02 23:24:00 +02:00
|
|
|
"${translationsDir}/ukrainian.ts"
|
|
|
|
"${translationsDir}/vietnamese.ts"
|
2023-03-16 18:36:51 +02:00
|
|
|
)
|
2024-03-02 23:24:00 +02:00
|
|
|
if(ENABLE_TRANSLATIONS)
|
|
|
|
if(TARGET Qt5::Core)
|
|
|
|
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${translationsDir}")
|
|
|
|
set_source_files_properties(${launcher_TS} PROPERTIES OUTPUT_LOCATION "${translationsDir}")
|
|
|
|
qt5_add_translation(launcher_QM ${launcher_TS})
|
|
|
|
|
|
|
|
set(translationsResource "${CMAKE_CURRENT_BINARY_DIR}/translations.qrc")
|
|
|
|
list(APPEND launcher_RESOURCES "${translationsResource}")
|
|
|
|
|
|
|
|
set(rccQmFiles "")
|
|
|
|
foreach(qmFile ${launcher_QM})
|
|
|
|
string(APPEND rccQmFiles "<file>${qmFile}</file>\n")
|
|
|
|
endforeach()
|
|
|
|
file(WRITE "${translationsResource}"
|
|
|
|
"<!DOCTYPE RCC>
|
|
|
|
<RCC version=\"1.0\">
|
|
|
|
<qresource prefix=\"/\">
|
|
|
|
${rccQmFiles}
|
|
|
|
</qresource>
|
|
|
|
</RCC>"
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
endif()
|
2022-12-25 22:18:14 +02:00
|
|
|
|
2024-03-02 23:24:00 +02:00
|
|
|
if(WIN32)
|
|
|
|
set(launcher_ICON VCMI_launcher.rc)
|
2021-04-19 02:38:20 +02:00
|
|
|
endif()
|
|
|
|
|
2024-03-02 23:24:00 +02:00
|
|
|
assign_source_group(${launcher_SRCS} ${launcher_HEADERS} ${launcher_RESOURCES} ${launcher_TS} ${launcher_ICON})
|
2017-08-15 20:17:00 +02:00
|
|
|
|
2013-08-22 17:22:49 +03:00
|
|
|
set(CMAKE_AUTOMOC ON)
|
2024-03-02 23:24:00 +02:00
|
|
|
set(CMAKE_AUTOUIC ON)
|
2024-06-12 23:36:21 +02:00
|
|
|
set(CMAKE_AUTORCC ON)
|
2013-08-22 17:22:49 +03:00
|
|
|
|
2018-02-23 21:20:20 +02:00
|
|
|
if(POLICY CMP0071)
|
|
|
|
cmake_policy(SET CMP0071 NEW)
|
|
|
|
endif()
|
|
|
|
|
2013-08-22 17:22:49 +03:00
|
|
|
# As moc files are generated in the binary dir, tell CMake
|
|
|
|
# to always look for includes there:
|
|
|
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
|
|
|
|
2024-03-02 23:24:00 +02:00
|
|
|
if(ENABLE_SINGLE_APP_BUILD OR ANDROID)
|
|
|
|
add_library(vcmilauncher OBJECT ${launcher_QM})
|
2022-05-28 15:32:20 +02:00
|
|
|
else()
|
2024-03-02 23:24:00 +02:00
|
|
|
add_executable(vcmilauncher WIN32 ${launcher_QM} ${launcher_ICON})
|
2017-08-15 20:17:00 +02:00
|
|
|
endif()
|
2013-08-22 17:22:49 +03:00
|
|
|
|
2024-03-02 23:24:00 +02:00
|
|
|
if(ENABLE_TRANSLATIONS)
|
|
|
|
if(TARGET Qt6::Core)
|
2023-01-29 19:41:55 +02:00
|
|
|
qt_add_translations(vcmilauncher
|
|
|
|
TS_FILES ${launcher_TS}
|
2024-03-02 23:24:00 +02:00
|
|
|
RESOURCE_PREFIX "/${translationsDir}"
|
2023-01-29 19:41:55 +02:00
|
|
|
INCLUDE_DIRECTORIES
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR})
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2024-03-02 23:24:00 +02:00
|
|
|
if(ANDROID)
|
|
|
|
get_target_property(rccPath Qt${QT_VERSION_MAJOR}::rcc IMPORTED_LOCATION)
|
|
|
|
get_filename_component(qtDir "${rccPath}/../../" ABSOLUTE)
|
|
|
|
set(qtDir "${qtDir}" PARENT_SCOPE)
|
|
|
|
|
|
|
|
function(generate_binary_resource resourceName resourceDir)
|
|
|
|
file(CREATE_LINK "${resourceDir}" "${CMAKE_CURRENT_BINARY_DIR}/${resourceName}"
|
|
|
|
COPY_ON_ERROR
|
|
|
|
SYMBOLIC
|
|
|
|
)
|
|
|
|
set(qrcFile "${CMAKE_CURRENT_BINARY_DIR}/${resourceName}.qrc")
|
|
|
|
execute_process(COMMAND
|
|
|
|
"${rccPath}" --project
|
|
|
|
WORKING_DIRECTORY "${resourceDir}"
|
|
|
|
OUTPUT_VARIABLE rccOutput
|
|
|
|
)
|
|
|
|
# add parent directory
|
|
|
|
string(REPLACE "<file>." "<file>${resourceName}" rccOutput "${rccOutput}")
|
|
|
|
file(WRITE "${qrcFile}" "${rccOutput}")
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
generate_binary_resource("config" "${CMAKE_SOURCE_DIR}/config")
|
|
|
|
list(APPEND launcher_RESOURCES "${CMAKE_CURRENT_BINARY_DIR}/config.qrc")
|
|
|
|
generate_binary_resource("Mods" "${CMAKE_SOURCE_DIR}/Mods")
|
|
|
|
list(APPEND launcher_RESOURCES "${CMAKE_CURRENT_BINARY_DIR}/Mods.qrc")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
target_sources(vcmilauncher PRIVATE
|
|
|
|
${launcher_SRCS}
|
|
|
|
${launcher_HEADERS}
|
|
|
|
${launcher_RESOURCES}
|
2024-06-08 13:53:58 +02:00
|
|
|
${launcher_FORMS}
|
2024-03-02 23:24:00 +02:00
|
|
|
)
|
|
|
|
|
2017-08-15 20:17:00 +02:00
|
|
|
if(WIN32)
|
|
|
|
set_target_properties(vcmilauncher
|
|
|
|
PROPERTIES
|
|
|
|
OUTPUT_NAME "VCMI_launcher"
|
|
|
|
PROJECT_LABEL "VCMI_launcher"
|
|
|
|
)
|
|
|
|
|
|
|
|
# FIXME: Can't to get CMP0020 working with Vcpkg and CMake 3.8.2
|
|
|
|
# So far I tried:
|
|
|
|
# - cmake_minimum_required set to 2.8.11 globally and in this file
|
|
|
|
# - cmake_policy in all possible places
|
|
|
|
# - used NO_POLICY_SCOPE to make sure no other parts reset policies
|
|
|
|
# Still nothing worked, warning kept appearing and WinMain didn't link automatically
|
2022-05-28 15:32:20 +02:00
|
|
|
target_link_libraries(vcmilauncher Qt${QT_VERSION_MAJOR}::WinMain)
|
2014-10-12 16:40:49 +03:00
|
|
|
endif()
|
2013-08-22 17:22:49 +03:00
|
|
|
|
2017-08-11 04:31:23 +02:00
|
|
|
if(APPLE)
|
|
|
|
# This makes Xcode project prettier by moving vcmilauncher_autogen directory into vcmiclient subfolder
|
|
|
|
set_property(GLOBAL PROPERTY AUTOGEN_TARGETS_FOLDER vcmilauncher)
|
|
|
|
endif()
|
|
|
|
|
2024-03-02 23:24:00 +02:00
|
|
|
if(ANDROID)
|
|
|
|
target_link_libraries(vcmilauncher Qt${QT_VERSION_MAJOR}::AndroidExtras)
|
|
|
|
elseif(NOT APPLE_IOS)
|
2023-05-07 21:18:01 +02:00
|
|
|
target_link_libraries(vcmilauncher SDL2::SDL2)
|
|
|
|
endif()
|
|
|
|
|
2024-10-09 10:27:43 +02:00
|
|
|
if(ENABLE_STATIC_LIBS OR NOT (ENABLE_EDITOR AND ENABLE_LAUNCHER))
|
|
|
|
target_compile_definitions(vcmilauncher PRIVATE VCMIQT_STATIC)
|
|
|
|
endif()
|
|
|
|
|
2024-10-07 07:47:00 +02:00
|
|
|
target_link_libraries(vcmilauncher vcmi vcmiqt Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Network)
|
2019-01-19 01:57:54 +02:00
|
|
|
target_include_directories(vcmilauncher
|
|
|
|
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
)
|
2017-07-04 22:46:49 +02:00
|
|
|
vcmi_set_output_dir(vcmilauncher "")
|
2022-06-16 22:02:36 +02:00
|
|
|
enable_pch(vcmilauncher)
|
2014-02-01 16:37:26 +03:00
|
|
|
|
2024-04-01 02:31:33 +02:00
|
|
|
if(ENABLE_INNOEXTRACT)
|
|
|
|
target_link_libraries(vcmilauncher innoextract)
|
|
|
|
endif()
|
|
|
|
|
2021-04-19 02:38:20 +02:00
|
|
|
if(APPLE_IOS)
|
2024-06-09 17:10:28 +02:00
|
|
|
target_link_libraries(vcmilauncher
|
2024-06-09 17:11:14 +02:00
|
|
|
iOS_utils
|
2024-06-09 17:10:28 +02:00
|
|
|
"-framework UniformTypeIdentifiers"
|
|
|
|
)
|
|
|
|
|
2024-03-02 23:24:00 +02:00
|
|
|
# TODO: remove after switching prebuilt deps to a newer Conan's Qt recipe
|
2023-01-14 19:29:42 +02:00
|
|
|
if(XCODE_VERSION VERSION_GREATER_EQUAL 14.0)
|
|
|
|
target_link_libraries(vcmilauncher "-framework IOKit")
|
|
|
|
endif()
|
|
|
|
|
2022-10-13 12:04:32 +02:00
|
|
|
# workaround https://github.com/conan-io/conan-center-index/issues/13332
|
|
|
|
if(USING_CONAN)
|
|
|
|
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/QIOSIntegrationPlugin.h
|
|
|
|
"#include <QtPlugin>\nQ_IMPORT_PLUGIN(QIOSIntegrationPlugin)"
|
|
|
|
)
|
|
|
|
target_link_libraries(vcmilauncher
|
|
|
|
Qt${QT_VERSION_MAJOR}::QIOSIntegrationPlugin
|
|
|
|
qt::QIOSIntegrationPlugin
|
|
|
|
)
|
|
|
|
endif()
|
2024-03-02 23:24:00 +02:00
|
|
|
elseif(ANDROID)
|
|
|
|
set(androidSdkDir "$ENV{ANDROID_HOME}")
|
|
|
|
configure_file(
|
|
|
|
"${androidPackageSourceDir}/androiddeployqt.json.in"
|
|
|
|
"${CMAKE_BINARY_DIR}/androiddeployqt.json"
|
|
|
|
@ONLY
|
2021-04-19 23:23:44 +02:00
|
|
|
)
|
2024-03-02 23:24:00 +02:00
|
|
|
else()
|
2021-04-19 02:38:20 +02:00
|
|
|
install(TARGETS vcmilauncher DESTINATION ${BIN_DIR})
|
2022-08-03 09:49:04 +02:00
|
|
|
|
2021-04-19 02:38:20 +02:00
|
|
|
# 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()
|
2013-08-22 17:22:49 +03:00
|
|
|
endif()
|