1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-22 22:13:35 +02:00
vcmi/mapeditor/CMakeLists.txt

249 lines
6.5 KiB
CMake
Raw Normal View History

2022-09-18 01:23:17 +02:00
set(editor_SRCS
StdInc.cpp
main.cpp
mainwindow.cpp
BitmapHandler.cpp
maphandler.cpp
Animation.cpp
graphics.cpp
windownewmap.cpp
generatorprogress.cpp
mapview.cpp
objectbrowser.cpp
2023-09-05 01:26:38 +02:00
mapsettings/abstractsettings.cpp
mapsettings/mapsettings.cpp
mapsettings/generalsettings.cpp
mapsettings/modsettings.cpp
2023-09-07 20:19:31 +02:00
mapsettings/timedevent.cpp
2023-09-05 01:26:38 +02:00
mapsettings/victoryconditions.cpp
mapsettings/loseconditions.cpp
2023-09-07 23:57:56 +02:00
mapsettings/eventsettings.cpp
2023-09-08 17:54:34 +02:00
mapsettings/rumorsettings.cpp
2023-09-28 15:29:43 +02:00
mapsettings/translations.cpp
2022-09-18 01:23:17 +02:00
playersettings.cpp
playerparams.cpp
scenelayer.cpp
mapcontroller.cpp
validator.cpp
inspector/inspector.cpp
inspector/townbuildingswidget.cpp
2024-07-22 21:09:57 +02:00
inspector/towneventdialog.cpp
inspector/towneventswidget.cpp
inspector/townspellswidget.cpp
2022-09-18 01:23:17 +02:00
inspector/armywidget.cpp
inspector/messagewidget.cpp
inspector/rewardswidget.cpp
2022-10-16 23:16:27 +02:00
inspector/questwidget.cpp
inspector/heroartifactswidget.cpp
inspector/artifactwidget.cpp
2023-09-10 23:39:54 +02:00
inspector/heroskillswidget.cpp
inspector/herospellwidget.cpp
inspector/PickObjectDelegate.cpp
2023-10-13 20:15:11 +02:00
inspector/portraitwidget.cpp
2022-11-14 21:32:29 +02:00
resourceExtractor/ResourceConverter.cpp
2022-09-18 01:23:17 +02:00
)
set(editor_HEADERS
StdInc.h
mainwindow.h
BitmapHandler.h
maphandler.h
Animation.h
graphics.h
windownewmap.h
generatorprogress.h
mapview.h
objectbrowser.h
2023-09-05 01:26:38 +02:00
mapsettings/abstractsettings.h
mapsettings/mapsettings.h
mapsettings/generalsettings.h
mapsettings/modsettings.h
2023-09-07 20:19:31 +02:00
mapsettings/timedevent.h
2023-09-05 01:26:38 +02:00
mapsettings/victoryconditions.h
mapsettings/loseconditions.h
2023-09-07 23:57:56 +02:00
mapsettings/eventsettings.h
2023-09-08 17:54:34 +02:00
mapsettings/rumorsettings.h
2023-09-28 15:29:43 +02:00
mapsettings/translations.h
2022-09-18 01:23:17 +02:00
playersettings.h
playerparams.h
scenelayer.h
mapcontroller.h
validator.h
inspector/inspector.h
inspector/townbuildingswidget.h
2024-07-22 21:09:57 +02:00
inspector/towneventdialog.h
inspector/towneventswidget.h
inspector/townspellswidget.h
2022-09-18 01:23:17 +02:00
inspector/armywidget.h
inspector/messagewidget.h
inspector/rewardswidget.h
2022-10-16 23:16:27 +02:00
inspector/questwidget.h
inspector/heroartifactswidget.h
inspector/artifactwidget.h
2023-09-10 23:39:54 +02:00
inspector/heroskillswidget.h
inspector/herospellwidget.h
inspector/PickObjectDelegate.h
2023-10-13 20:15:11 +02:00
inspector/portraitwidget.h
2022-11-14 21:32:29 +02:00
resourceExtractor/ResourceConverter.h
mapeditorroles.h
2022-09-18 01:23:17 +02:00
)
set(editor_FORMS
mainwindow.ui
windownewmap.ui
generatorprogress.ui
2023-09-05 01:26:38 +02:00
mapsettings/mapsettings.ui
mapsettings/generalsettings.ui
mapsettings/modsettings.ui
2023-09-07 20:19:31 +02:00
mapsettings/timedevent.ui
2023-09-05 01:26:38 +02:00
mapsettings/victoryconditions.ui
mapsettings/loseconditions.ui
2023-09-07 23:57:56 +02:00
mapsettings/eventsettings.ui
2023-09-08 17:54:34 +02:00
mapsettings/rumorsettings.ui
2023-09-28 15:29:43 +02:00
mapsettings/translations.ui
2022-09-18 01:23:17 +02:00
playersettings.ui
playerparams.ui
validator.ui
inspector/townbuildingswidget.ui
2024-07-22 21:09:57 +02:00
inspector/towneventdialog.ui
inspector/towneventswidget.ui
inspector/townspellswidget.ui
2022-09-18 01:23:17 +02:00
inspector/armywidget.ui
inspector/messagewidget.ui
inspector/rewardswidget.ui
2022-10-16 23:16:27 +02:00
inspector/questwidget.ui
inspector/heroartifactswidget.ui
inspector/artifactwidget.ui
2023-09-10 23:39:54 +02:00
inspector/heroskillswidget.ui
inspector/herospellwidget.ui
2023-10-13 20:15:11 +02:00
inspector/portraitwidget.ui
2022-09-18 01:23:17 +02:00
)
set(editor_RESOURCES
resources.qrc
)
set(translationsDir "translation")
set(editor_TS
"${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"
"${translationsDir}/ukrainian.ts"
"${translationsDir}/vietnamese.ts"
2023-03-16 18:36:51 +02:00
)
if(ENABLE_TRANSLATIONS)
if(TARGET Qt5::Core)
file(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${translationsDir}")
set_source_files_properties(${editor_TS} PROPERTIES OUTPUT_LOCATION "${translationsDir}")
qt5_add_translation(editor_QM ${editor_TS})
set(translationsResource "${CMAKE_CURRENT_BINARY_DIR}/translations.qrc")
list(APPEND editor_RESOURCES "${translationsResource}")
set(rccQmFiles "")
foreach(qmFile ${editor_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()
if(WIN32)
set(editor_ICON mapeditor.rc)
endif()
assign_source_group(${editor_SRCS} ${editor_HEADERS} ${editor_RESOURCES} ${editor_TS} ${editor_ICON})
2022-09-18 01:23:17 +02:00
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
2022-09-18 01:23:17 +02:00
if(POLICY CMP0071)
cmake_policy(SET CMP0071 NEW)
endif()
# As moc files are generated in the binary dir, tell CMake
# to always look for includes there:
set(CMAKE_INCLUDE_CURRENT_DIR ON)
if(ENABLE_SINGLE_APP_BUILD OR ANDROID)
add_library(vcmieditor OBJECT ${editor_QM})
2022-09-18 01:23:17 +02:00
else()
add_executable(vcmieditor WIN32 ${editor_QM} ${editor_SRCS} ${editor_HEADERS} ${editor_UI_HEADERS} ${editor_ICON})
2022-09-18 01:23:17 +02:00
endif()
if(ENABLE_TRANSLATIONS)
if(TARGET Qt6::Core)
qt_add_translations(vcmieditor
TS_FILES ${editor_TS}
RESOURCE_PREFIX "/${translationsDir}"
INCLUDE_DIRECTORIES
${CMAKE_CURRENT_BINARY_DIR})
endif()
endif()
target_sources(vcmieditor PRIVATE
${editor_SRCS}
${editor_HEADERS}
${editor_FORMS}
${editor_RESOURCES}
)
2022-09-18 01:23:17 +02:00
if(WIN32)
set_target_properties(vcmieditor
PROPERTIES
OUTPUT_NAME "VCMI_mapeditor"
PROJECT_LABEL "VCMI_mapeditor"
)
# 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
target_link_libraries(vcmieditor Qt${QT_VERSION_MAJOR}::WinMain)
endif()
if(APPLE)
2022-11-30 00:58:43 +02:00
# This makes Xcode project prettier by moving mapeditor_autogen directory into vcmiclient subfolder
2022-09-18 01:23:17 +02:00
set_property(GLOBAL PROPERTY AUTOGEN_TARGETS_FOLDER vcmieditor)
endif()
2024-10-09 10:27:43 +02:00
if(ENABLE_STATIC_LIBS OR NOT (ENABLE_EDITOR AND ENABLE_LAUNCHER))
target_compile_definitions(vcmieditor PRIVATE VCMIQT_STATIC)
endif()
2024-10-07 07:47:00 +02:00
target_link_libraries(vcmieditor vcmi vcmiqt Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Network)
2022-09-18 01:23:17 +02:00
target_include_directories(vcmieditor
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
)
vcmi_set_output_dir(vcmieditor "")
enable_pch(vcmieditor)
install(TARGETS vcmieditor DESTINATION ${BIN_DIR})
2024-06-05 10:19:12 +02:00
# Install icons and desktop file on Linux
2022-09-18 01:23:17 +02:00
if(NOT WIN32 AND NOT APPLE)
2024-06-05 10:19:12 +02:00
foreach(iconSize 32 48 64 128 256)
install(FILES "icons/mapeditor.${iconSize}x${iconSize}.png"
DESTINATION "share/icons/hicolor/${iconSize}x${iconSize}/apps"
2024-06-06 04:04:36 +02:00
RENAME vcmieditor.png
2024-06-05 10:19:12 +02:00
)
endforeach()
install(FILES "vcmieditor.desktop" DESTINATION share/applications)
2022-09-18 01:23:17 +02:00
endif()