-
Notifications
You must be signed in to change notification settings - Fork 69
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
613 lines (576 loc) · 20.1 KB
/
CMakeLists.txt
File metadata and controls
613 lines (576 loc) · 20.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
cmake_minimum_required(VERSION 3.15)
cmake_policy(SET CMP0091 NEW) # Support MSVC_RUNTIME_LIBRARY
project(EasyRPG_Editor VERSION 0.1.0 LANGUAGES CXX)
# Extra CMake Module files
set(REQUIRED_QT_VERSION "6.10.1")
find_package(ECM ${REQUIRED_QT_VERSION} REQUIRED)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/builds/cmake/Modules" ${ECM_MODULE_PATH})
include(EditorConfigureWindows)
# Dependencies provided by CMake Presets
option(EDITOR_FIND_ROOT_PATH_APPEND "When enabled the items from CMAKE_PREFIX_PATH are added to CMAKE_FIND_ROOT_PATH. Works around problematic CMake Toolchain files" OFF)
list(APPEND CMAKE_PREFIX_PATH "${EDITOR_PREFIX_PATH_APPEND}")
if(EDITOR_FIND_ROOT_PATH_APPEND)
list(APPEND CMAKE_FIND_ROOT_PATH "${CMAKE_PREFIX_PATH}")
endif()
# C++23 is required
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
# Source Files
set(EDITOR_SOURCES
src/common/dbstring.h
src/common/filefinder.cpp
src/common/filefinder.h
src/common/image_loader.cpp
src/common/image_loader.h
src/common/lcf_widget_binding.cpp
src/common/lcf_widget_binding.h
src/common/scope_guard.h
src/common/signal_blocker.h
src/common/sortfilter_proxy_models.cpp
src/common/sortfilter_proxy_models.h
src/core.cpp
src/core.h
src/defines.h
src/main.cpp
src/model/actor.cpp
src/model/actor.h
src/model/animation.cpp
src/model/animation.h
src/model/attribute.cpp
src/model/attribute.h
src/model/battleranimation.cpp
src/model/battleranimation.h
src/model/chipset.cpp
src/model/chipset.h
src/model/class.cpp
src/model/class.h
src/model/commonevent.cpp
src/model/commonevent.h
src/model/enemy.cpp
src/model/enemy.h
src/model/event_command_list.cpp
src/model/event_command_list.h
src/model/item.cpp
src/model/item.h
src/model/project.cpp
src/model/project.h
src/model/project_data.cpp
src/model/project_data.h
src/model/rpg_base.cpp
src/model/rpg_base.h
src/model/rpg_reflect.h
src/model/skill.cpp
src/model/skill.h
src/model/state.cpp
src/model/state.h
src/model/switch.cpp
src/model/switch.h
src/model/terrain.cpp
src/model/terrain.h
src/model/troop.cpp
src/model/troop.h
src/model/variable.cpp
src/model/variable.h
src/stringizer.cpp
src/stringizer.h
src/ui/commands/all_commands.h
src/ui/commands/change_actor_face_widget.cpp
src/ui/commands/change_actor_face_widget.h
src/ui/commands/change_actor_face_widget.ui
src/ui/commands/change_actor_graphic_widget.cpp
src/ui/commands/change_actor_graphic_widget.h
src/ui/commands/change_actor_graphic_widget.ui
src/ui/commands/change_actor_name_widget.cpp
src/ui/commands/change_actor_name_widget.h
src/ui/commands/change_actor_name_widget.ui
src/ui/commands/change_actor_title_widget.cpp
src/ui/commands/change_actor_title_widget.h
src/ui/commands/change_actor_title_widget.ui
src/ui/commands/change_experience_widget.cpp
src/ui/commands/change_experience_widget.h
src/ui/commands/change_experience_widget.ui
src/ui/commands/change_item_widget.cpp
src/ui/commands/change_item_widget.h
src/ui/commands/change_item_widget.ui
src/ui/commands/change_level_widget.cpp
src/ui/commands/change_level_widget.h
src/ui/commands/change_level_widget.ui
src/ui/commands/change_money_widget.cpp
src/ui/commands/change_money_widget.h
src/ui/commands/change_money_widget.ui
src/ui/commands/change_party_widget.cpp
src/ui/commands/change_party_widget.h
src/ui/commands/change_party_widget.ui
src/ui/commands/change_vehicle_graphic_widget.cpp
src/ui/commands/change_vehicle_graphic_widget.h
src/ui/commands/change_vehicle_graphic_widget.ui
src/ui/commands/enable_disable_widget.cpp
src/ui/commands/enable_disable_widget.h
src/ui/commands/enable_disable_widget.ui
src/ui/commands/face_graphics_widget.cpp
src/ui/commands/face_graphics_widget.h
src/ui/commands/face_graphics_widget.ui
src/ui/commands/flash_screen_widget.cpp
src/ui/commands/flash_screen_widget.h
src/ui/commands/flash_screen_widget.ui
src/ui/commands/full_heal_widget.cpp
src/ui/commands/full_heal_widget.h
src/ui/commands/full_heal_widget.ui
src/ui/commands/input_number_widget.cpp
src/ui/commands/input_number_widget.h
src/ui/commands/input_number_widget.ui
src/ui/commands/message_options_widget.cpp
src/ui/commands/message_options_widget.h
src/ui/commands/message_options_widget.ui
src/ui/commands/shake_screen_widget.cpp
src/ui/commands/shake_screen_widget.h
src/ui/commands/shake_screen_widget.ui
src/ui/commands/show_choices_widget.cpp
src/ui/commands/show_choices_widget.h
src/ui/commands/show_choices_widget.ui
src/ui/commands/show_message_widget.cpp
src/ui/commands/show_message_widget.h
src/ui/commands/show_message_widget.ui
src/ui/commands/switch_operations_widget.cpp
src/ui/commands/switch_operations_widget.h
src/ui/commands/switch_operations_widget.ui
src/ui/commands/timer_operation_widget.cpp
src/ui/commands/timer_operation_widget.h
src/ui/commands/timer_operation_widget.ui
src/ui/commands/tint_screen_widget.cpp
src/ui/commands/tint_screen_widget.h
src/ui/commands/tint_screen_widget.ui
src/ui/commands/variable_operations_widget.cpp
src/ui/commands/variable_operations_widget.h
src/ui/commands/variable_operations_widget.ui
src/ui/commands/weather_effects_widget.cpp
src/ui/commands/weather_effects_widget.h
src/ui/commands/weather_effects_widget.ui
src/ui/common/edit_dialog.cpp
src/ui/common/edit_dialog.h
src/ui/common/edit_dialog.ui
src/ui/common/encounter_delegate.cpp
src/ui/common/encounter_delegate.h
src/ui/common/import_image_dialog.cpp
src/ui/common/import_image_dialog.h
src/ui/common/import_image_dialog.ui
src/ui/common/import_item.cpp
src/ui/common/import_item.h
src/ui/common/operand_widget.cpp
src/ui/common/operand_widget.h
src/ui/common/palette_scene.cpp
src/ui/common/palette_scene.h
src/ui/common/picker_scene.cpp
src/ui/common/picker_scene.h
src/ui/common/rpg_combobox.h
src/ui/common/rpg_model.h
src/ui/common/rpg_audio_lineedit.cpp
src/ui/common/rpg_audio_lineedit.h
src/ui/common/rpg_slider.cpp
src/ui/common/rpg_slider.h
src/ui/common/rpg_spinbox.cpp
src/ui/common/rpg_spinbox.h
src/ui/common/system_color_combobox.cpp
src/ui/common/system_color_combobox.h
src/ui/common/widget_as_dialog_model_wrapper.h
src/ui/common/widget_as_dialog_wrapper.h
src/ui/database/actor_delegate.cpp
src/ui/database/actor_delegate.h
src/ui/database/actor_widget.cpp
src/ui/database/actor_widget.h
src/ui/database/actor_widget.ui
src/ui/database/attribute_widget.cpp
src/ui/database/attribute_widget.h
src/ui/database/attribute_widget.ui
src/ui/database/battle_animation2_widget.cpp
src/ui/database/battle_animation2_widget.h
src/ui/database/battle_animation2_widget.ui
src/ui/database/battle_animation_widget.cpp
src/ui/database/battle_animation_widget.h
src/ui/database/battle_animation_widget.ui
src/ui/database/battle_screen_widget.cpp
src/ui/database/battle_screen_widget.h
src/ui/database/battle_screen_widget.ui
src/ui/database/chipset_widget.cpp
src/ui/database/chipset_widget.h
src/ui/database/chipset_widget.ui
src/ui/database/class_widget.cpp
src/ui/database/class_widget.h
src/ui/database/class_widget.ui
src/ui/database/common_event_widget.cpp
src/ui/database/common_event_widget.h
src/ui/database/common_event_widget.ui
src/ui/database/database_dialog.cpp
src/ui/database/database_dialog.h
src/ui/database/database_dialog.ui
src/ui/database/database_split_widget.cpp
src/ui/database/database_split_widget.h
src/ui/database/database_split_widget.ui
src/ui/database/enemy_group_widget.cpp
src/ui/database/enemy_group_widget.h
src/ui/database/enemy_group_widget.ui
src/ui/database/enemy_widget.cpp
src/ui/database/enemy_widget.h
src/ui/database/enemy_widget.ui
src/ui/database/item_widget.cpp
src/ui/database/item_widget.h
src/ui/database/item_widget.ui
src/ui/database/skill_widget.cpp
src/ui/database/skill_widget.h
src/ui/database/skill_widget.ui
src/ui/database/state_widget.cpp
src/ui/database/state_widget.h
src/ui/database/state_widget.ui
src/ui/database/switch_widget.cpp
src/ui/database/switch_widget.h
src/ui/database/switch_widget.ui
src/ui/database/system2_widget.cpp
src/ui/database/system2_widget.h
src/ui/database/system2_widget.ui
src/ui/database/system_widget.cpp
src/ui/database/system_widget.h
src/ui/database/system_widget.ui
src/ui/database/terrain_widget.cpp
src/ui/database/terrain_widget.h
src/ui/database/terrain_widget.ui
src/ui/database/variable_widget.cpp
src/ui/database/variable_widget.h
src/ui/database/variable_widget.ui
src/ui/database/vocabulary_widget.cpp
src/ui/database/vocabulary_widget.h
src/ui/database/vocabulary_widget.ui
src/ui/event/battle_page_widget.cpp
src/ui/event/battle_page_widget.h
src/ui/event/battle_page_widget.ui
src/ui/event/event_command_base_widget.cpp
src/ui/event/event_command_base_widget.h
src/ui/event/event_commands_widget.cpp
src/ui/event/event_commands_widget.h
src/ui/event/event_dialog.cpp
src/ui/event/event_dialog.h
src/ui/event/event_dialog.ui
src/ui/event/event_page_widget.cpp
src/ui/event/event_page_widget.h
src/ui/event/event_page_widget.ui
src/ui/event/event_raw_widget.cpp
src/ui/event/event_raw_widget.h
src/ui/event/event_raw_widget.ui
src/ui/main_window.cpp
src/ui/main_window.h
src/ui/main_window.ui
src/ui/map/map_scene.cpp
src/ui/map/map_scene.h
src/ui/map/undo_draw.cpp
src/ui/map/undo_draw.h
src/ui/map/undo_event.cpp
src/ui/map/undo_event.h
src/ui/maptree/map_properties_dialog.cpp
src/ui/maptree/map_properties_dialog.h
src/ui/maptree/map_properties_dialog.ui
src/ui/other/import_project_dialog.cpp
src/ui/other/import_project_dialog.h
src/ui/other/import_project_dialog.ui
src/ui/other/new_project_dialog.cpp
src/ui/other/new_project_dialog.h
src/ui/other/new_project_dialog.ui
src/ui/other/open_project_dialog.cpp
src/ui/other/open_project_dialog.h
src/ui/other/open_project_dialog.ui
src/ui/other/resource_manager_dialog.cpp
src/ui/other/resource_manager_dialog.h
src/ui/other/resource_manager_dialog.ui
src/ui/other/rtp_path_dialog.cpp
src/ui/other/rtp_path_dialog.h
src/ui/other/rtp_path_dialog.ui
src/ui/other/run_game_dialog.cpp
src/ui/other/run_game_dialog.h
src/ui/other/run_game_dialog.ui
src/ui/other/search_dialog.cpp
src/ui/other/search_dialog.h
src/ui/other/search_dialog.ui
src/ui/picker/picker_audio_widget.cpp
src/ui/picker/picker_audio_widget.h
src/ui/picker/picker_audio_widget.ui
src/ui/picker/picker_backdrop_widget.cpp
src/ui/picker/picker_backdrop_widget.h
src/ui/picker/picker_child_widget.cpp
src/ui/picker/picker_child_widget.h
src/ui/picker/picker_charset_widget.cpp
src/ui/picker/picker_charset_widget.h
src/ui/picker/picker_faceset_widget.cpp
src/ui/picker/picker_faceset_widget.h
src/ui/picker/picker_panorama_widget.cpp
src/ui/picker/picker_panorama_widget.h
src/ui/picker/picker_dialog.cpp
src/ui/picker/picker_dialog.h
src/ui/picker/picker_dialog.ui
src/ui/viewer/battle_animation_graphics_item.cpp
src/ui/viewer/battle_animation_graphics_item.h
src/ui/viewer/charset_graphics_item.cpp
src/ui/viewer/charset_graphics_item.h
src/ui/viewer/faceset_graphics_item.cpp
src/ui/viewer/faceset_graphics_item.h
src/ui/viewer/rpg_graphics_view.cpp
src/ui/viewer/rpg_graphics_view.h
src/ui/viewer/stat_curve_graphics_item.cpp
src/ui/viewer/stat_curve_graphics_item.h
)
set(EDITOR_QML_UI
src/ui/common/CheckBox.qml
src/ui/common/SpinBox.qml
src/ui/common/TextField.qml
src/ui/MainWindow.qml
src/ui/database/DatabaseWindow.qml
src/ui/database/ActorPage.qml
src/ui/database/DatabaseEntryListPage.qml
src/ui/database/DatabaseEntryPage.qml
src/ui/database/DatabasePage.qml
src/ui/database/ItemPage.qml
src/ui/database/SkillPage.qml
src/ui/database/VocabularyPage.qml
)
set(EDITOR_QML_INTERFACE
src/qmlbinding/json_internals/json_t_database.cpp
src/qmlbinding/json_internals/json_t_impl.h
src/qmlbinding/json_internals/json_t_map.cpp
src/qmlbinding/json_internals/json_t_treemap.cpp
src/qmlbinding/json.h
src/qmlbinding/json_list_view.cpp
src/qmlbinding/json_list_view.h
src/qmlbinding/json_t.h
src/qmlbinding/json_view.cpp
src/qmlbinding/json_view.h
src/qmlbinding/lcf_glaze.h
src/qmlbinding/project_data_gadget.cpp
src/qmlbinding/project_data_gadget.h
)
# Dependencies
set(QT_NO_PRIVATE_MODULE_WARNING ON)
find_package(Qt6 ${REQUIRED_QT_VERSION} CONFIG REQUIRED COMPONENTS
Widgets Core Multimedia Gui Svg
GuiPrivate QuickPrivate QuickControls2 WidgetsPrivate)
find_package(Qt6LinguistTools CONFIG QUIET)
find_package(ZLIB REQUIRED)
find_package(glaze REQUIRED)
find_package(KF6 ${KF_DEP_VERSION} REQUIRED COMPONENTS Kirigami)
find_package(QQC2BreezeStyle REQUIRED)
find_package(KDBindings QUIET) # only required by the static build
find_package(KDDockWidgets-qt6 REQUIRED)
qt_standard_project_setup(
REQUIRES "${REQUIRED_QT_VERSION}"
)
# Executable
if(APPLE)
# Do not code sign
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGNING_REQUIRED "NO")
set(CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY "")
set(CMAKE_XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "org.easyrpg.editor")
# App Icon
set(EDITOR_BUNDLE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/resources/app/Editor.icns")
set_source_files_properties(${EDITOR_BUNDLE_ICON} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")
set(EXE_NAME "EasyRPG-Editor.app")
set(EXE_OUTPUT_NAME "EasyRPG Editor")
qt_add_executable(${EXE_NAME} MACOSX_BUNDLE "src/main.cpp" ${EDITOR_SOURCES} ${EDITOR_BUNDLE_ICON} MANUAL_FINALIZATION)
set_target_properties(${EXE_NAME} PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/resources/app/Info.plist.in")
set_target_properties(${EXE_NAME} PROPERTIES OUTPUT_NAME ${EXE_OUTPUT_NAME})
else()
# Executable
set(EXE_NAME ${PROJECT_NAME})
qt_add_executable(${EXE_NAME} WIN32 "src/main.cpp" ${EDITOR_SOURCES} MANUAL_FINALIZATION)
if(WIN32)
# Open console for Debug builds
if(CMAKE_BUILD_TYPE MATCHES "Debug")
set_target_properties(${EXE_NAME} PROPERTIES WIN32_EXECUTABLE FALSE)
endif()
set_target_properties(${EXE_NAME} PROPERTIES OUTPUT_NAME "Editor")
# Add icon
target_sources(${EXE_NAME} PRIVATE "resources/Resources.rc")
# Set Visual Studio startup project
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT ${EXE_NAME})
else()
set_target_properties(${EXE_NAME} PROPERTIES OUTPUT_NAME "easyrpg-editor")
endif()
# QML Debugger support
if(CMAKE_BUILD_TYPE MATCHES "Debug")
target_compile_definitions(${EXE_NAME} PRIVATE QT_QML_DEBUG=1)
endif()
endif()
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang$")
# Fix template recursion limit hit by glaze
target_compile_options(${EXE_NAME} PRIVATE "-fbracket-depth=1024")
endif()
# Include directories
target_include_directories(${EXE_NAME}
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}/src
${CMAKE_CURRENT_SOURCE_DIR}/src/qmlbinding # Required by QML build step
INTERFACE
$<BUILD_INTERFACE:${AUTOGEN_INCLUDE_DIR}>
)
# IDE source grouping
source_group(TREE "${CMAKE_CURRENT_SOURCE_DIR}/src" PREFIX "Editor" FILES ${EDITOR_SOURCES})
# Add autogen include dirs to include path, otherwise the includes are not found
# when used in the header (via https://stackoverflow.com/q/44746308/)
get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(_isMultiConfig)
set(AUTOGEN_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}_autogen/include_$<CONFIG>)
else()
set(AUTOGEN_INCLUDE_DIR ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}_autogen/include)
endif()
# Qt Magic
set_target_properties(${EXE_NAME} PROPERTIES
AUTOMOC ON
AUTOUIC ON
AUTORCC ON # Enable resource compiler for exe
)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
include(ECMQmlModule)
include(ECMFindQmlModule)
ecm_add_qml_module(${EXE_NAME}
URI "org.easyrpg.editor"
VERSION 1.0
GENERATE_PLUGIN_SOURCE
SOURCES
${EDITOR_QML_INTERFACE}
)
ecm_target_qml_sources(${EXE_NAME}
SOURCES ${EDITOR_QML_UI}
)
# liblcf
option(EDITOR_BUILD_LIBLCF "Instead of detecting liblcf the liblcf repository is cloned into lib/liblcf and built together with the Player. This is convenient for development" OFF)
set(EDITOR_BUILD_LIBLCF_GIT "https://github.com/EasyRPG/liblcf.git" CACHE STRING "Git repository of liblcf to clone when building liblcf. Requires EDITOR_BUILD_LIBLCF=ON.")
if(EDITOR_BUILD_LIBLCF)
# liblcf is built as part of this cmake file
set(LIBLCF_PATH "${CMAKE_CURRENT_SOURCE_DIR}/lib/liblcf")
if(NOT EXISTS ${LIBLCF_PATH})
find_package(Git REQUIRED)
execute_process(COMMAND ${GIT_EXECUTABLE} clone "--depth=1"
"${EDITOR_BUILD_LIBLCF_GIT}"
"${LIBLCF_PATH}")
endif()
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/lib/liblcf/builds/cmake/Modules")
option(BUILD_SHARED_LIBS "Not used. Supresses CMP0077 in liblcf" ON)
# Always build static liblcf and do not install it
function(add_liblcf)
set(BUILD_SHARED_LIBS OFF)
set(LIBLCF_ENABLE_INSTALL OFF)
add_subdirectory(${LIBLCF_PATH})
endfunction()
add_liblcf()
target_link_libraries(${EXE_NAME} PRIVATE lcf)
else()
# Use system package
find_package(liblcf REQUIRED)
target_link_libraries(${EXE_NAME} PRIVATE liblcf::liblcf)
endif()
# Libraries
target_link_libraries(${EXE_NAME} PRIVATE
ZLIB::ZLIB
glaze::glaze
KDAB::kddockwidgets
Qt6::Widgets
Qt6::Gui
Qt6::Core
Qt6::Multimedia
Qt6::Svg
Qt6::QuickControls2
)
get_target_property(KIRIGAMI_TYPE KF6::Kirigami TYPE)
message(STATUS "Kirigami library type: ${KIRIGAMI_TYPE}")
if(KIRIGAMI_TYPE STREQUAL "STATIC_LIBRARY")
# Why is this so difficult? Kirigami bug?
target_link_libraries(${EXE_NAME} PRIVATE
KF6::Kirigami
KF6Kirigamiplugin
KF6KirigamiTemplatesplugin
KF6KirigamiDialogsplugin
KF6KirigamiDelegatesplugin
KF6KirigamiLayoutsplugin
KF6KirigamiLayoutsPrivateplugin
KF6KirigamiPrimitivesplugin
KF6KirigamiPrivateplugin
KF6KirigamiPolyfillplugin
)
target_compile_definitions(${EXE_NAME} PUBLIC "-DKIRIGAMI_STATIC=1")
endif()
get_target_property(QQC2_TYPE org.kde.breeze TYPE)
message(STATUS "BreezeStyle library type: ${QQC2_TYPE}")
if(QQC2_TYPE STREQUAL "STATIC_LIBRARY")
target_link_libraries(${EXE_NAME} PRIVATE
BreezeStyle
BreezeImpl
)
endif()
qt_import_qml_plugins(${EXE_NAME})
# Add resources
target_sources(${EXE_NAME} PRIVATE "resources/Resources.qrc")
# Translations
if(TARGET Qt6::lrelease)
set(TRANSLATION_SOURCES
translations/editor_de.ts
)
set(TRANSLATION_RES ${CMAKE_CURRENT_BINARY_DIR}/translations/editor.qrc)
configure_file(translations/editor.qrc ${TRANSLATION_RES} COPYONLY)
set_source_files_properties(${TRANSLATION_SOURCES} PROPERTIES
OUTPUT_LOCATION "translations")
qt_add_translation(EDITOR_TRANSLATIONS ${TRANSLATION_SOURCES}
OPTIONS -compress -nounfinished -removeidentical)
target_sources(${EXE_NAME} PRIVATE ${TRANSLATION_RES} ${EDITOR_TRANSLATIONS})
add_custom_target(translations
COMMAND ${Qt6_LUPDATE_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/src -ts ${TRANSLATION_SOURCES}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMENT "Create/Update translations..."
COMMAND_EXPAND_LISTS VERBATIM)
else()
message(STATUS "Disabling translation support")
endif()
qt_finalize_target(${EXE_NAME})
# Installation
include(GNUInstallDirs)
if(APPLE)
install(TARGETS ${EXE_NAME}
BUNDLE DESTINATION .
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
else()
install(TARGETS ${EXE_NAME}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
)
if(UNIX)
# Install desktop entry and icon
install(FILES resources/unix/easyrpg-editor.desktop
DESTINATION ${CMAKE_INSTALL_DATADIR}/applications)
# legacy path, remove 2030 :)
install(FILES resources/app/easyrpg.png
DESTINATION ${CMAKE_INSTALL_DATADIR}/pixmaps
RENAME easyrpg-editor.png)
# FIXME: use scalable icon
install(FILES resources/app/easyrpg.png
DESTINATION ${CMAKE_INSTALL_DATADIR}/icons/hicolor/48x48/apps
RENAME easyrpg-editor.png)
# FIXME: Fill appdata file
#install(FILES resources/unix/easyrpg-editor.appdata.xml
# DESTINATION ${CMAKE_INSTALL_DATADIR}/appdata)
endif()
endif()
# Generate a deployment script to be executed at install time
if(WIN32 OR APPLE)
# The script fails on Linux currently
# On macOS the generated app does not run due to unsigned plugins
qt_generate_deploy_qml_app_script(
TARGET ${EXE_NAME}
OUTPUT_SCRIPT deploy_script
)
install(SCRIPT ${deploy_script})
endif()
if(WIN32)
# Environment for the MSVC Debugger
set_target_properties(${EXE_NAME}
PROPERTIES VS_DEBUGGER_ENVIRONMENT
"PATH=$ENV{Qt6_Path}/bin;%PATH%"
)
# Other dev environments
configure_file("builds/cmake/setup_env.cmd.in" "setup_env.cmd")
message(STATUS "When not using Visual Studio for development run setup_env.cmd to configure the environment")
endif()