-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
683 lines (599 loc) · 26 KB
/
Copy pathCMakeLists.txt
File metadata and controls
683 lines (599 loc) · 26 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
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
cmake_minimum_required(VERSION 3.24)
if(POLICY CMP0135)
cmake_policy(SET CMP0135 NEW)
endif()
if(POLICY CMP0167)
cmake_policy(SET CMP0167 NEW)
endif()
project(LOOT)
include(ExternalProject)
include(FetchContent)
option(LOOT_RUN_CLANG_TIDY "Whether or not to run clang-tidy during build. Has no effect when using CMake's MSVC generator." OFF)
option(LOOT_BUILD_TESTS "Whether or not to build LOOT's tests." ON)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(BUILD_SHARED_LIBS OFF)
if(MSVC)
add_compile_options("/MP")
endif()
##############################
# Get Build Revision
##############################
find_package(Git)
if(GIT_FOUND)
execute_process(COMMAND "${GIT_EXECUTABLE}" rev-parse --short HEAD
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_COMMIT_STRING
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
if(NOT GIT_COMMIT_STRING)
set(GIT_COMMIT_STRING "unknown")
endif()
message(STATUS "Git revision: ${GIT_COMMIT_STRING}")
# Write to file.
configure_file("${CMAKE_SOURCE_DIR}/src/gui/version.cpp.in"
"${CMAKE_BINARY_DIR}/generated/version.cpp"
@ONLY)
##############################
# Generate ICO file
##############################
set(LOOT_SVG_PATH "${CMAKE_SOURCE_DIR}/resources/icons/loot.svg")
set(LOOT_ICO_PATH "${CMAKE_SOURCE_DIR}/build/icon/icon.ico")
if(WIN32)
set(LOOT_ICO_SIZES "")
else()
set(LOOT_ICO_SIZES -s 16 -s 256)
endif()
add_custom_command(
OUTPUT "${LOOT_ICO_PATH}"
COMMAND svg_to_ico
-i "${LOOT_SVG_PATH}"
-o "${LOOT_ICO_PATH}"
${LOOT_ICO_SIZES}
DEPENDS "${LOOT_SVG_PATH}"
VERBATIM)
##############################
# External Projects
##############################
# Allow use of shared Boost libs, e.g. if installed through the Linux distribution's package manager.
if(NOT DEFINED Boost_USE_STATIC_LIBS)
set(Boost_USE_STATIC_LIBS ON)
endif()
set(Boost_USE_MULTITHREADED ON)
set(Boost_USE_STATIC_RUNTIME OFF)
find_package(Boost REQUIRED COMPONENTS locale CONFIG)
if(LINUX)
find_package(ICU REQUIRED COMPONENTS data uc i18n)
find_package(TBB REQUIRED)
endif()
find_package(Qt6 6.4 COMPONENTS Widgets Network Concurrent REQUIRED)
if(WIN32 AND CMAKE_HOST_LINUX)
# The MinGW build of Qt6 expects you to link to bz2.
find_package(BZip2 MODULE REQUIRED)
# The MinGW build of Qt6::Network expects you to link to brotlicommon.
set(BROTLI_BUILD_TOOLS OFF)
FetchContent_Declare(
Brotli
URL "https://github.com/google/brotli/archive/refs/tags/v1.2.0.tar.gz"
URL_HASH "SHA256=816c96e8e8f193b40151dad7e8ff37b1221d019dbcb9c35cd3fadbfe6477dfec"
FIND_PACKAGE_ARGS)
FetchContent_MakeAvailable(Brotli)
endif()
if(NOT DEFINED EP_PREFIX)
set_directory_properties(PROPERTIES "EP_PREFIX" "external")
endif()
find_package(libloot CONFIG)
if(NOT libloot_FOUND)
set(LIBLOOT_GIT_REPOSITORY_DEFAULT "https://github.com/loot/libloot.git")
set(LIBLOOT_GIT_COMMIT_DEFAULT "56bafaead362b06aa63e02f8917ffde0777d36ae")
if(NOT DEFINED LIBLOOT_GIT_REPOSITORY)
set(LIBLOOT_GIT_REPOSITORY "${LIBLOOT_GIT_REPOSITORY_DEFAULT}")
endif()
if(NOT DEFINED LIBLOOT_GIT_COMMIT)
set(LIBLOOT_GIT_COMMIT "${LIBLOOT_GIT_COMMIT_DEFAULT}")
endif()
if(NOT MSVC OR (GIT_FOUND AND (NOT LIBLOOT_GIT_REPOSITORY STREQUAL LIBLOOT_GIT_REPOSITORY_DEFAULT OR NOT LIBLOOT_GIT_COMMIT STREQUAL LIBLOOT_GIT_COMMIT_DEFAULT)))
set(LIBLOOT_USE_PREBUILT_MSVC_BINARY FALSE)
elseif(NOT DEFINED LIBLOOT_USE_PREBUILT_MSVC_BINARY)
set(LIBLOOT_USE_PREBUILT_MSVC_BINARY TRUE)
endif()
# If a URL is set and a Git source is not, prefer the URL over the Git or default source.
if(LIBLOOT_USE_PREBUILT_MSVC_BINARY)
if(DEFINED LIBLOOT_URL)
cmake_path(CONVERT "${LIBLOOT_URL}" TO_CMAKE_PATH_LIST LIBLOOT_URL)
else()
set(LIBLOOT_URL "https://github.com/loot/libloot/releases/download/0.29.6/libloot-0.29.6-win64.7z")
set(LIBLOOT_HASH "SHA256=b5012ff02d6a88f54a18b20aef4536a51c541714b8e218c55558c855fbeeda21")
endif()
set(LIBLOOT_DOWNLOAD_ARGS
URL "${LIBLOOT_URL}"
URL_HASH "${LIBLOOT_HASH}")
elseif(GIT_FOUND)
set(LIBLOOT_DOWNLOAD_ARGS
GIT_REPOSITORY "${LIBLOOT_GIT_REPOSITORY}"
GIT_TAG "${LIBLOOT_GIT_COMMIT}")
else()
message(WARNING "Git not found: building libloot from a source archive")
set(LIBLOOT_DOWNLOAD_ARGS
URL "https://github.com/loot/libloot/archive/refs/tags/0.29.6.tar.gz"
URL_HASH "SHA256=ffc89682b0d362ac8569efff8ad6392cd670203f34aeb7e3a0cbebab1700a840")
endif()
message(DEBUG "LIBLOOT_USE_PREBUILT_MSVC_BINARY: ${LIBLOOT_USE_PREBUILT_MSVC_BINARY}")
message(DEBUG "LIBLOOT_DOWNLOAD_ARGS: ${LIBLOOT_DOWNLOAD_ARGS}")
endif()
if(MSVC AND LIBLOOT_USE_PREBUILT_MSVC_BINARY AND NOT libloot_FOUND)
# Download a prebuilt binary and use it.
# For some reason if we use FetchContent's OVERRIDE_FIND_PACKAGE with find_package, find_package will find libloot but not import its target, so instead explicitly make it available and give an explicit search path to find_package.
FetchContent_Declare(
libloot
${LIBLOOT_DOWNLOAD_ARGS})
FetchContent_MakeAvailable(libloot)
find_package(libloot REQUIRED CONFIG
PATHS "${FETCHCONTENT_BASE_DIR}/libloot-src/lib/cmake/libloot")
else()
set(LIBLOOT_BUILD_SHARED ON)
set(LIBLOOT_BUILD_TESTS OFF)
set(LIBLOOT_INSTALL_DOCS OFF)
FetchContent_Declare(
libloot
${LIBLOOT_DOWNLOAD_ARGS}
SOURCE_SUBDIR "cpp"
FIND_PACKAGE_ARGS)
FetchContent_MakeAvailable(libloot)
endif()
if(NOT DEFINED ZLIB_REPOSITORY)
set(ZLIB_REPOSITORY "https://github.com/madler/zlib")
endif()
if(NOT DEFINED ZLIB_TAG)
set(ZLIB_TAG "da607da739fa6047df13e66a2af6b8bec7c2a498") # v1.3.2
endif()
set(ZLIB_BUILD_EXAMPLES OFF)
set(ZLIB_COMPAT ON)
set(MZ_ZLIB ON)
set(MZ_BZIP2 OFF)
set(MZ_LZMA OFF)
set(MZ_ZSTD OFF)
set(MZ_FETCH_LIBS ON)
set(MZ_PKCRYPT OFF)
set(MZ_WZAES OFF)
set(MZ_OPENSSL OFF)
set(MZ_LIBBSD OFF)
set(MZ_SIGNING OFF)
set(MZ_COMPRESS_ONLY ON)
FetchContent_Declare(
MINIZIP
URL "https://github.com/zlib-ng/minizip-ng/archive/refs/tags/4.1.0.tar.gz"
URL_HASH "SHA256=85417229bb0cd56403e811c316150eea1a3643346d9cec7512ddb7ea291b06f2"
FIND_PACKAGE_ARGS NAMES MINIZIP minizip-ng)
FetchContent_Declare(
tomlplusplus
URL "https://github.com/marzer/tomlplusplus/archive/v3.4.0.tar.gz"
URL_HASH "SHA256=8517f65938a4faae9ccf8ebb36631a38c1cadfb5efa85d9a72e15b9e97d25155"
FIND_PACKAGE_ARGS)
FetchContent_Declare(
fmt
URL "https://github.com/fmtlib/fmt/releases/download/12.1.0/fmt-12.1.0.zip"
URL_HASH "SHA256=695fd197fa5aff8fc67b5f2bbc110490a875cdf7a41686ac8512fb480fa8ada7"
FIND_PACKAGE_ARGS)
set(SPDLOG_FMT_EXTERNAL ON)
if(WIN32)
set(SPDLOG_WCHAR_FILENAMES ON)
endif()
FetchContent_Declare(
spdlog
URL "https://github.com/gabime/spdlog/archive/refs/tags/v1.17.0.tar.gz"
URL_HASH "SHA256=d8862955c6d74e5846b3f580b1605d2428b11d97a410d86e2fb13e857cd3a744"
FIND_PACKAGE_ARGS)
FetchContent_Declare(
ValveFileVDF
URL "https://github.com/TinyTinni/ValveFileVDF/archive/refs/tags/v1.1.1.tar.gz"
URL_HASH "SHA256=de16a199c535c3b49f2aa0bd17e3154e02b32fa7b0949053ba6d981f8c32197f")
FetchContent_MakeAvailable(fmt MINIZIP spdlog tomlplusplus ValveFileVDF)
find_package(OGDF CONFIG)
if(NOT OGDF_FOUND)
set(IS_RELEASE_BUILD "$<CONFIG:Release,RelWithDebInfo>")
set(OGDF_CONFIG "$<IF:${IS_RELEASE_BUILD},Release,Debug>")
set(OGDF_CONFIG_LOWERCASE "$<IF:${IS_RELEASE_BUILD},release,debug>")
set(OGDF_BASENAME_SUFFIX "$<$<NOT:${IS_RELEASE_BUILD}>:-debug>")
if(WIN32)
set(OGDF_BUILD_COMMAND
"${CMAKE_COMMAND}"
--build .
--target OGDF
--config "${OGDF_CONFIG}")
else()
set(OGDF_BUILD_COMMAND "${CMAKE_COMMAND}" --build . --target OGDF)
endif()
if(NOT DEFINED OGDF_URL)
set(OGDF_URL "https://ogdf.uos.de/wp-content/uploads/2025/10/ogdf.v2025.10.zip")
set(OGDF_HASH "SHA256=54f8fc9c2b44b3e4f34ca85be3ae77ce2a309337397662c1432a960367522ccb")
endif()
get_property(GENERATOR_IS_MULTI_CONFIG GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(GENERATOR_IS_MULTI_CONFIG)
set(OGDF_CFG_INTDIR "${OGDF_CONFIG}")
else()
set(OGDF_CFG_INTDIR ".")
endif()
# Use ExternalProject for OGDF as otherwise there's no way to stop it from
# creating and building loads of unnecessary targets.
ExternalProject_Add(OGDF
URL "${OGDF_URL}"
URL_HASH "${OGDF_HASH}"
CMAKE_ARGS
-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DOGDF_ARCH=x86-64
BUILD_COMMAND ${OGDF_BUILD_COMMAND}
BUILD_BYPRODUCTS
"<BINARY_DIR>/${OGDF_CFG_INTDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}OGDF${OGDF_BASENAME_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}"
"<BINARY_DIR>/${OGDF_CFG_INTDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}COIN${OGDF_BASENAME_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}"
"<BINARY_DIR>/include/ogdf-${OGDF_CONFIG_LOWERCASE}"
INSTALL_COMMAND "")
ExternalProject_Get_Property(OGDF SOURCE_DIR BINARY_DIR)
add_library(OGDF_INTERFACE INTERFACE)
add_dependencies(OGDF_INTERFACE OGDF)
target_link_libraries(OGDF_INTERFACE INTERFACE
"${BINARY_DIR}/${OGDF_CFG_INTDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}OGDF${OGDF_BASENAME_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}"
"${BINARY_DIR}/${OGDF_CFG_INTDIR}/${CMAKE_STATIC_LIBRARY_PREFIX}COIN${OGDF_BASENAME_SUFFIX}${CMAKE_STATIC_LIBRARY_SUFFIX}")
target_include_directories(OGDF_INTERFACE INTERFACE
"${SOURCE_DIR}/include"
"${BINARY_DIR}/include/ogdf-${OGDF_CONFIG_LOWERCASE}")
endif()
##############################
# General Settings
##############################
set(LOOT_SRC_GUI_CPP_FILES
"${CMAKE_SOURCE_DIR}/src/gui/backup.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/helpers.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/qt/back_up_load_order_dialog.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/qt/card.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/qt/card_delegate.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/qt/compare_load_orders_dialog.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/qt/counters.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/qt/filters_widget.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/qt/general_info.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/qt/general_info_card.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/qt/groups_editor/edge.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/qt/groups_editor/groups_editor_dialog.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/qt/groups_editor/graph_view.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/qt/groups_editor/layout.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/qt/groups_editor/node.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/qt/helpers.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/qt/icon_factory.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/qt/main.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/qt/main_window.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/qt/messages_widget.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/qt/plugin_card.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/qt/plugin_editor/delegates.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/qt/plugin_editor/group_tab.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/qt/plugin_editor/message_content_editor.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/qt/plugin_editor/models/cleaning_data_table_model.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/qt/plugin_editor/models/file_table_model.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/qt/plugin_editor/models/location_table_model.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/qt/plugin_editor/models/message_content_table_model.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/qt/plugin_editor/models/message_table_model.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/qt/plugin_editor/models/tag_table_model.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/qt/plugin_editor/plugin_editor_widget.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/qt/plugin_editor/table_tabs.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/plugin_item.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/sourced_message.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/qt/plugin_item_model.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/qt/plugin_item_filter_model.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/qt/restore_load_order_dialog.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/qt/search_toolbar.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/qt/settings/game_tab.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/qt/settings/general_tab.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/qt/settings/new_game_dialog.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/qt/settings/settings_dialog.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/qt/sidebar_plugin_name_delegate.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/qt/style.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/qt/tasks/check_for_update_task.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/qt/tasks/network_task.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/qt/tasks/tasks.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/qt/tasks/update_masterlist_task.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/state/game/detection/common.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/state/game/detection/detail.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/state/game/detection/epic_games_store.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/state/game/detection/generic.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/state/game/detection/gog.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/state/game/detection/heroic.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/state/game/detection/microsoft_store.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/state/game/detection/registry.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/state/game/detection/steam.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/state/game/detection.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/state/game/game.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/state/game/game_id.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/state/game/game_settings.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/state/game/games_manager.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/state/game/group_node_positions.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/state/game/helpers.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/state/game/validation.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/state/logging.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/state/loot_paths.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/state/loot_settings.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/state/loot_state.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/translate.cpp"
"${CMAKE_SOURCE_DIR}/src/gui/resource.rc")
set(LOOT_SRC_GUI_H_FILES
"${CMAKE_SOURCE_DIR}/src/gui/application_mutex.h"
"${CMAKE_SOURCE_DIR}/src/gui/backup.h"
"${CMAKE_SOURCE_DIR}/src/gui/helpers.h"
"${CMAKE_SOURCE_DIR}/src/gui/qt/back_up_load_order_dialog.h"
"${CMAKE_SOURCE_DIR}/src/gui/qt/card.h"
"${CMAKE_SOURCE_DIR}/src/gui/qt/card_delegate.h"
"${CMAKE_SOURCE_DIR}/src/gui/qt/compare_load_orders_dialog.h"
"${CMAKE_SOURCE_DIR}/src/gui/qt/counters.h"
"${CMAKE_SOURCE_DIR}/src/gui/qt/filters_states.h"
"${CMAKE_SOURCE_DIR}/src/gui/qt/filters_widget.h"
"${CMAKE_SOURCE_DIR}/src/gui/qt/general_info.h"
"${CMAKE_SOURCE_DIR}/src/gui/qt/general_info_card.h"
"${CMAKE_SOURCE_DIR}/src/gui/qt/groups_editor/edge.h"
"${CMAKE_SOURCE_DIR}/src/gui/qt/groups_editor/groups_editor_dialog.h"
"${CMAKE_SOURCE_DIR}/src/gui/qt/groups_editor/graph_view.h"
"${CMAKE_SOURCE_DIR}/src/gui/qt/groups_editor/layout.h"
"${CMAKE_SOURCE_DIR}/src/gui/qt/groups_editor/node.h"
"${CMAKE_SOURCE_DIR}/src/gui/qt/helpers.h"
"${CMAKE_SOURCE_DIR}/src/gui/qt/icon_factory.h"
"${CMAKE_SOURCE_DIR}/src/gui/qt/main_window.h"
"${CMAKE_SOURCE_DIR}/src/gui/qt/messages_widget.h"
"${CMAKE_SOURCE_DIR}/src/gui/qt/plugin_card.h"
"${CMAKE_SOURCE_DIR}/src/gui/qt/plugin_editor/delegates.h"
"${CMAKE_SOURCE_DIR}/src/gui/qt/plugin_editor/group_tab.h"
"${CMAKE_SOURCE_DIR}/src/gui/qt/plugin_editor/message_content_editor.h"
"${CMAKE_SOURCE_DIR}/src/gui/qt/plugin_editor/models/cleaning_data_table_model.h"
"${CMAKE_SOURCE_DIR}/src/gui/qt/plugin_editor/models/file_table_model.h"
"${CMAKE_SOURCE_DIR}/src/gui/qt/plugin_editor/models/location_table_model.h"
"${CMAKE_SOURCE_DIR}/src/gui/qt/plugin_editor/models/message_content_table_model.h"
"${CMAKE_SOURCE_DIR}/src/gui/qt/plugin_editor/models/message_table_model.h"
"${CMAKE_SOURCE_DIR}/src/gui/qt/plugin_editor/models/metadata_table_model.h"
"${CMAKE_SOURCE_DIR}/src/gui/qt/plugin_editor/models/tag_table_model.h"
"${CMAKE_SOURCE_DIR}/src/gui/qt/plugin_editor/plugin_editor_widget.h"
"${CMAKE_SOURCE_DIR}/src/gui/qt/plugin_editor/table_tabs.h"
"${CMAKE_SOURCE_DIR}/src/gui/plugin_item.h"
"${CMAKE_SOURCE_DIR}/src/gui/sourced_message.h"
"${CMAKE_SOURCE_DIR}/src/gui/qt/plugin_item_model.h"
"${CMAKE_SOURCE_DIR}/src/gui/qt/plugin_item_filter_model.h"
"${CMAKE_SOURCE_DIR}/src/gui/qt/restore_load_order_dialog.h"
"${CMAKE_SOURCE_DIR}/src/gui/qt/search_toolbar.h"
"${CMAKE_SOURCE_DIR}/src/gui/qt/settings/game_tab.h"
"${CMAKE_SOURCE_DIR}/src/gui/qt/settings/general_tab.h"
"${CMAKE_SOURCE_DIR}/src/gui/qt/settings/new_game_dialog.h"
"${CMAKE_SOURCE_DIR}/src/gui/qt/settings/settings_dialog.h"
"${CMAKE_SOURCE_DIR}/src/gui/qt/sidebar_plugin_name_delegate.h"
"${CMAKE_SOURCE_DIR}/src/gui/qt/style.h"
"${CMAKE_SOURCE_DIR}/src/gui/qt/tasks/check_for_update_task.h"
"${CMAKE_SOURCE_DIR}/src/gui/qt/tasks/network_task.h"
"${CMAKE_SOURCE_DIR}/src/gui/qt/tasks/tasks.h"
"${CMAKE_SOURCE_DIR}/src/gui/qt/tasks/update_masterlist_task.h"
"${CMAKE_SOURCE_DIR}/src/gui/query/query.h"
"${CMAKE_SOURCE_DIR}/src/gui/query/types/apply_sort_query.h"
"${CMAKE_SOURCE_DIR}/src/gui/query/types/cancel_sort_query.h"
"${CMAKE_SOURCE_DIR}/src/gui/query/types/change_game_query.h"
"${CMAKE_SOURCE_DIR}/src/gui/query/types/clear_all_metadata_query.h"
"${CMAKE_SOURCE_DIR}/src/gui/query/types/clear_plugin_metadata_query.h"
"${CMAKE_SOURCE_DIR}/src/gui/query/types/get_overlapping_plugins_query.h"
"${CMAKE_SOURCE_DIR}/src/gui/query/types/get_game_data_query.h"
"${CMAKE_SOURCE_DIR}/src/gui/query/types/sort_plugins_query.h"
"${CMAKE_SOURCE_DIR}/src/gui/state/change_count.h"
"${CMAKE_SOURCE_DIR}/src/gui/state/game/detection/common.h"
"${CMAKE_SOURCE_DIR}/src/gui/state/game/detection/detail.h"
"${CMAKE_SOURCE_DIR}/src/gui/state/game/detection/epic_games_store.h"
"${CMAKE_SOURCE_DIR}/src/gui/state/game/detection/game_install.h"
"${CMAKE_SOURCE_DIR}/src/gui/state/game/detection/generic.h"
"${CMAKE_SOURCE_DIR}/src/gui/state/game/detection/gog.h"
"${CMAKE_SOURCE_DIR}/src/gui/state/game/detection/heroic.h"
"${CMAKE_SOURCE_DIR}/src/gui/state/game/detection/microsoft_store.h"
"${CMAKE_SOURCE_DIR}/src/gui/state/game/detection/registry.h"
"${CMAKE_SOURCE_DIR}/src/gui/state/game/detection/steam.h"
"${CMAKE_SOURCE_DIR}/src/gui/state/game/detection.h"
"${CMAKE_SOURCE_DIR}/src/gui/state/game/game.h"
"${CMAKE_SOURCE_DIR}/src/gui/state/game/game_id.h"
"${CMAKE_SOURCE_DIR}/src/gui/state/game/game_settings.h"
"${CMAKE_SOURCE_DIR}/src/gui/state/game/games_manager.h"
"${CMAKE_SOURCE_DIR}/src/gui/state/game/group_node_positions.h"
"${CMAKE_SOURCE_DIR}/src/gui/state/game/helpers.h"
"${CMAKE_SOURCE_DIR}/src/gui/state/game/load_order_backup.h"
"${CMAKE_SOURCE_DIR}/src/gui/state/game/validation.h"
"${CMAKE_SOURCE_DIR}/src/gui/state/logging.h"
"${CMAKE_SOURCE_DIR}/src/gui/state/loot_paths.h"
"${CMAKE_SOURCE_DIR}/src/gui/state/loot_settings.h"
"${CMAKE_SOURCE_DIR}/src/gui/state/loot_state.h"
"${CMAKE_SOURCE_DIR}/src/gui/translate.h"
"${CMAKE_SOURCE_DIR}/src/gui/version.h")
source_group(TREE "${CMAKE_SOURCE_DIR}/src/gui"
PREFIX "Header Files"
FILES ${LOOT_SRC_GUI_H_FILES})
source_group(TREE "${CMAKE_SOURCE_DIR}/src/gui"
PREFIX "Source Files"
FILES ${LOOT_SRC_GUI_CPP_FILES})
set(LOOT_ALL_SOURCES
${LOOT_SRC_GUI_CPP_FILES}
${LOOT_SRC_GUI_H_FILES}
"${CMAKE_BINARY_DIR}/generated/version.cpp"
"${CMAKE_SOURCE_DIR}/resources/resources.qrc")
##############################
# System-Specific Settings
##############################
if(WIN32)
list(APPEND LOOT_ALL_SOURCES
"${CMAKE_SOURCE_DIR}/resources/resources.windows.qrc"
"${CMAKE_SOURCE_DIR}/src/gui/LOOT.manifest")
endif()
if(MSVC)
# Copy test code coverage config into build directory where MSVC expects to
# find it.
configure_file("${PROJECT_SOURCE_DIR}/.runsettings"
"${PROJECT_BINARY_DIR}/.runsettings"
COPYONLY)
endif()
##############################
# Define Targets
##############################
# Build Qt application.
add_executable(LOOT ${LOOT_ALL_SOURCES})
target_link_libraries(LOOT PRIVATE
Qt::Widgets Qt::Network Qt::Concurrent
Boost::headers Boost::locale
fmt::fmt
libloot::libloot
spdlog::spdlog
tomlplusplus::tomlplusplus
ValveFileVDF::ValveFileVDF)
##############################
# Set Target-Specific Flags
##############################
if(TARGET MINIZIP::minizip)
target_link_libraries(LOOT PRIVATE MINIZIP::minizip)
elseif(TARGET MINIZIP::minizip-ng)
target_link_libraries(LOOT PRIVATE MINIZIP::minizip-ng)
endif()
if(OGDF_FOUND)
target_link_libraries(LOOT PRIVATE OGDF)
else()
target_link_libraries(LOOT PRIVATE OGDF_INTERFACE)
endif()
# Include source and library directories.
target_include_directories(LOOT PRIVATE "${CMAKE_SOURCE_DIR}/src")
set_target_properties(LOOT PROPERTIES
CXX_STANDARD 17
CXX_STANDARD_REQUIRED ON
AUTOMOC ON
AUTORCC ON
AUTOUIC ON)
if(WIN32)
target_compile_definitions(LOOT PRIVATE UNICODE _UNICODE NOMINMAX)
if(CMAKE_HOST_LINUX)
target_compile_definitions(LOOT PRIVATE LOOT_STATIC)
target_link_libraries(LOOT PRIVATE BZip2::BZip2)
target_link_libraries(Qt6::Widgets INTERFACE BZip2::BZip2)
target_link_libraries(Qt6::Network INTERFACE BZip2::BZip2 brotlicommon)
endif()
else()
set(ICU_TARGETS ICU::data ICU::uc TBB::tbb)
target_link_libraries(LOOT PRIVATE X11 ${ICU_TARGETS})
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_compile_options(LOOT PRIVATE
"-Wall"
"-Wextra"
"-Wpedantic"
"-Wconversion"
"-Wdeprecated"
"-Wuninitialized"
"-Winit-self"
"-Wstringop-overflow=4"
"-Wduplicated-branches"
"-Wduplicated-cond"
"-Wzero-as-null-pointer-constant"
"-Wfloat-equal"
"-Wcast-qual"
"-Wcast-align"
"-Wlogical-op"
"-Wvla"
"-Wno-xor-used-as-pow")
endif()
if(WIN32)
set_target_properties(LOOT PROPERTIES WIN32_EXECUTABLE TRUE)
endif()
if(MSVC)
# Turn off permissive mode to be more standards-compliant and avoid compiler errors.
target_compile_options(LOOT PRIVATE
"/permissive-"
"/W4"
"/Wall"
"/wd4371"
"/wd4514"
"/wd4623"
"/wd4625"
"/wd4626"
"/wd4710"
"/wd4711"
"/wd4820"
"/wd4866"
"/wd5026"
"/wd5027"
"/wd5045"
"/external:anglebrackets"
"/external:W0"
"/sdl"
"$<$<CONFIG:Debug>:/RTC1>"
"/Zc:__cplusplus"
"/GL"
"/MP")
target_link_options(LOOT PRIVATE "/INCREMENTAL:NO" "/LTCG")
endif()
##############################
# Configure clang-tidy
##############################
if(LOOT_RUN_CLANG_TIDY)
set(CLANG_TIDY_COMMON_CHECKS
"cppcoreguidelines-avoid-c-arrays"
"cppcoreguidelines-c-copy-assignment-signature"
"cppcoreguidelines-explicit-virtual-functions"
"cppcoreguidelines-init-variables"
"cppcoreguidelines-interfaces-global-init"
"cppcoreguidelines-macro-usage"
"cppcoreguidelines-narrowing-conventions"
"cppcoreguidelines-no-malloc"
"cppcoreguidelines-pro-bounds-array-to-pointer-decay"
"cppcoreguidelines-pro-bounds-constant-array-index"
"cppcoreguidelines-pro-bounds-pointer-arithmetic"
"cppcoreguidelines-pro-type-const-cast"
"cppcoreguidelines-pro-type-cstyle-cast"
"cppcoreguidelines-pro-type-member-init"
"cppcoreguidelines-pro-type-reinterpret-cast"
"cppcoreguidelines-pro-type-static-cast-downcast"
"cppcoreguidelines-pro-type-union-access"
"cppcoreguidelines-pro-type-vararg"
"cppcoreguidelines-pro-type-slicing")
set(CLANG_TIDY_APP_CHECKS
${CLANG_TIDY_COMMON_CHECKS}
"cppcoreguidelines-avoid-goto"
"cppcoreguidelines-avoid-magic-numbers"
"cppcoreguidelines-non-private-member-variables-in-classes"
"cppcoreguidelines-special-member-functions")
list(JOIN CLANG_TIDY_APP_CHECKS "," CLANG_TIDY_APP_CHECKS_JOINED)
set(CLANG_TIDY_APP
clang-tidy "-header-filter=.*" "-checks=${CLANG_TIDY_APP_CHECKS_JOINED}")
set_target_properties(LOOT PROPERTIES CXX_CLANG_TIDY "${CLANG_TIDY_APP}")
endif()
##############################
# Post-Build Steps
##############################
set(QT_DIR "${Qt6_DIR}/../../..")
if(WIN32)
if(CMAKE_HOST_WIN32)
# Copy Qt binaries and resources.
add_custom_command(TARGET LOOT POST_BUILD
COMMAND "${QT_DIR}/bin/windeployqt" "$<TARGET_FILE:LOOT>"
COMMENT "Running windeployqt..."
VERBATIM)
else()
# Copy Qt binaries and resources.
add_custom_command(TARGET LOOT POST_BUILD
COMMAND wine "${QT_DIR}/bin/windeployqt.exe" "$<TARGET_FILE:LOOT>"
COMMENT "Running windeployqt..."
VERBATIM)
# Replace the MinGW DLLs because those that windeployqt copies are too old.
add_custom_command(TARGET LOOT POST_BUILD
COMMAND "${CMAKE_SOURCE_DIR}/scripts/replace_mingw_dlls.sh" "${CMAKE_BINARY_DIR}"
VERBATIM)
endif()
endif()
# Copy the API binary to the build directory.
add_custom_command(TARGET LOOT POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy_if_different
"$<TARGET_FILE:libloot::libloot>"
"$<TARGET_FILE_DIR:LOOT>/$<TARGET_FILE_NAME:libloot::libloot>"
VERBATIM)
if(LINUX)
add_custom_command(TARGET LOOT POST_BUILD
COMMAND "${CMAKE_COMMAND}" -E copy_if_different
"$<TARGET_SONAME_FILE:libloot::libloot>"
"$<TARGET_FILE_DIR:LOOT>/$<TARGET_SONAME_FILE_NAME:libloot::libloot>"
VERBATIM)
endif()
if(LOOT_BUILD_TESTS)
include("cmake/tests.cmake")
endif()