summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
blob: 933ad9bb7048ec5742daef0cccdab44ea56376bb (plain)
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
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
cmake_minimum_required(VERSION 3.13..3.21)

option(APPVEYOR_BUILD "Build on appveyor" OFF)
option(CI_BUILD "Set when building in CI. Enables -Werror where possible" OFF)
option(ASAN "Compile with address sanitizers" OFF)
option(QML_DEBUGGING "Enable qml debugging" OFF)
if(UNIX AND NOT APPLE)
    option(MAN "Build man page" ON)
else()
    option(MAN "Build man page" OFF)
endif()
option(FLATPAK "Set this only if Nheko is built as a flatpak" OFF)
option(JSON_ImplicitConversions "Disable implicit conversions in nlohmann/json" ON)

set(
    CMAKE_TOOLCHAIN_FILE "${CMAKE_CURRENT_LIST_DIR}/toolchain.cmake"
    CACHE
    FILEPATH "Default toolchain"
)
set(CMAKE_CXX_STANDARD 20 CACHE STRING "C++ standard")
set(CMAKE_CXX_STANDARD_REQUIRED ON CACHE BOOL "Require C++ standard to be supported")
set(CMAKE_POSITION_INDEPENDENT_CODE ON CACHE BOOL "compile as PIC by default")
set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "macos deployment target")

option(HUNTER_ENABLED "Enable Hunter package manager" OFF)
include("cmake/HunterGate.cmake")
HunterGate(
    URL "https://github.com/cpp-pm/hunter/archive/v0.25.5.tar.gz"
    SHA1 "a20151e4c0740ee7d0f9994476856d813cdead29"
    LOCAL
)

macro(hunter_add_package_safe)
    set(pkg_temp_backup_libdir "$ENV{PKG_CONFIG_LIBDIR}")
    set(pkg_temp_backup_path "$ENV{PKG_CONFIG_PATH}")
    hunter_add_package(${ARGV})
    if("${pkg_temp_backup_path}" STREQUAL "")
        unset(ENV{PKG_CONFIG_PATH})
    else()
        set(ENV{PKG_CONFIG_PATH} "${pkg_temp_backup_path}")
    endif()
    if("${pkg_temp_backup_libdir}" STREQUAL "")
        unset(ENV{PKG_CONFIG_LIBDIR})
    else()
        set(ENV{PKG_CONFIG_LIBDIR} "${pkg_temp_backup_libdir}")
    endif()
    message("pkg_conf_path: '$ENV{PKG_CONFIG_PATH}', pkg_conf_libdir: '$ENV{PKG_CONFIG_LIBDIR}'")
endmacro()

project(nheko LANGUAGES CXX C)

option(USE_BUNDLED_SPDLOG "Use the bundled version of spdlog." ${HUNTER_ENABLED})
option(USE_BUNDLED_FMT "Use the bundled version of {fmt}." ${HUNTER_ENABLED})
option(USE_BUNDLED_OLM "Use the bundled version of libolm." ${HUNTER_ENABLED})
option(USE_BUNDLED_GTEST "Use the bundled version of Google Test." ${HUNTER_ENABLED})
option(USE_BUNDLED_CMARK "Use the bundled version of cmark." ${HUNTER_ENABLED})
option(USE_BUNDLED_JSON "Use the bundled version of nlohmann json." ${HUNTER_ENABLED})
option(USE_BUNDLED_OPENSSL "Use the bundled version of OpenSSL." OFF)
option(USE_BUNDLED_MTXCLIENT "Use the bundled version of the Matrix Client library." ${HUNTER_ENABLED})
option(USE_BUNDLED_LMDB "Use the bundled version of lmdb." ${HUNTER_ENABLED})
option(USE_BUNDLED_LMDBXX "Use the bundled version of lmdb++." ${HUNTER_ENABLED})
option(USE_BUNDLED_QTKEYCHAIN "Use the bundled version of Qt6Keychain." ${HUNTER_ENABLED})
option(USE_BUNDLED_COEURL "Use a bundled version of the Curl wrapper"
    ${HUNTER_ENABLED})
option(USE_BUNDLED_LIBEVENT "Use the bundled version of libevent." ${HUNTER_ENABLED})
option(USE_BUNDLED_LIBCURL "Use the bundled version of libcurl." ${HUNTER_ENABLED})
option(USE_BUNDLED_RE2 "Use the bundled version of re2." ${HUNTER_ENABLED})
option(USE_BUNDLED_KDSINGLEAPPLICATION "Use the bundled version of KDSingleApplication." ${HUNTER_ENABLED})
option(USE_BUNDLED_CPPHTTPLIB "Use the bundled version of cpp-httplib." ON)
option(USE_BUNDLED_BLURHASH "Use the bundled version of blurhash." ON)

include(CMakeDependentOption)
set(VOIP_DEFAULT ON)
if(APPLE OR WIN32 OR HAIKU)
    set(VOIP_DEFAULT OFF)
endif()
option(VOIP "Whether to enable voip support. Disable this, if you don't have gstreamer." ${VOIP_DEFAULT})
set(X11_DEFAULT)
if(WIN32 OR APPLE OR HAIKU)
    set(X11_DEFAULT OFF)
endif()
option(X11 "Whether to enable X11 specific features (screenshare, window roles)." ${X11_DEFAULT})
cmake_dependent_option(SCREENSHARE_XDP "Whether to enable screenshare support using xdg-desktop-portal." ON "VOIP" OFF)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")

if(${CMAKE_VERSION} VERSION_LESS "3.14.0")
    message("Adding FetchContent_MakeAvailable")
    # from cmakes sources
    macro(FetchContent_MakeAvailable)
        foreach(contentName IN ITEMS ${ARGV})
            string(TOLOWER ${contentName} contentNameLower)
            FetchContent_GetProperties(${contentName})
            if(NOT ${contentNameLower}_POPULATED)
                FetchContent_Populate(${contentName})

                # Only try to call add_subdirectory() if the populated content
                # can be treated that way. Protecting the call with the check
                # allows this function to be used for projects that just want
                # to ensure the content exists, such as to provide content at
                # a known location.
                if(EXISTS ${${contentNameLower}_SOURCE_DIR}/CMakeLists.txt)
                    add_subdirectory(${${contentNameLower}_SOURCE_DIR}
                        ${${contentNameLower}_BINARY_DIR})
                endif()
            endif()
        endforeach()
    endmacro()
endif()

# Include Qt basic functions
include(QtCommon)

include(GNUInstallDirs)

set(CPACK_PACKAGE_VERSION_MAJOR "0")
set(CPACK_PACKAGE_VERSION_MINOR "12")
set(CPACK_PACKAGE_VERSION_PATCH "0")
set(PROJECT_VERSION_MAJOR ${CPACK_PACKAGE_VERSION_MAJOR})
set(PROJECT_VERSION_MINOR ${CPACK_PACKAGE_VERSION_MINOR})
set(PROJECT_VERSION_PATCH ${CPACK_PACKAGE_VERSION_PATCH})

# Set PROJECT_VERSION_PATCH & PROJECT_VERSION_TWEAK to 0 if not present
# Needed by add_project_meta.
fix_project_version()

# Set additional project information
set(COMPANY "Nheko")
set(COPYRIGHT "Copyright (c) 2024 Nheko Contributors")
set(IDENTIFIER "im.nheko.Nheko")

add_project_meta(META_FILES_TO_INCLUDE)

if(NOT MSVC AND NOT APPLE)
    set(THREADS_PREFER_PTHREAD_FLAG ON)
    find_package(Threads REQUIRED)
endif()

if(BUILD_DOCS)
    find_package(Doxygen)

    if(DOXYGEN_FOUND)
        set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/cmake/Doxyfile.in)
        set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)

        configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT})

        add_custom_target(docs ALL
            COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
            WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
            COMMENT "Generating API documentation with Doxygen"
            VERBATIM )
    else(DOXYGEN_FOUND)
        message("Doxygen need to be installed to generate the doxygen documentation")
    endif(DOXYGEN_FOUND)
endif()

#
## coeurl
#
## Need to repeat all libevent deps?!?
if(USE_BUNDLED_LIBEVENT)
    hunter_add_package_safe(Libevent)
    find_package(Libevent CONFIG REQUIRED)
else()
    find_package(PkgConfig REQUIRED) 
    pkg_check_modules(libevent_core REQUIRED IMPORTED_TARGET libevent_core)
    if(WIN32)
        pkg_check_modules(libevent_windows REQUIRED IMPORTED_TARGET libevent_windows)
    else()
        pkg_check_modules(libevent_pthreads REQUIRED IMPORTED_TARGET libevent_pthreads)
    endif()
endif()

# curl
if(USE_BUNDLED_LIBCURL)
    hunter_add_package_safe(CURL)
    find_package(CURL CONFIG REQUIRED)
else()
    find_package(PkgConfig REQUIRED) 
    pkg_check_modules(libcurl REQUIRED IMPORTED_TARGET libcurl)
endif()

# fmt
if(USE_BUNDLED_FMT)
    hunter_add_package_safe(fmt)
endif()
find_package(fmt 8.0.0 CONFIG REQUIRED)

# spdlog
if(USE_BUNDLED_SPDLOG)
    hunter_add_package_safe(spdlog)
endif()
find_package(spdlog 1.0.0 CONFIG REQUIRED)

if(USE_BUNDLED_COEURL)
    include(FetchContent)
    FetchContent_Declare(
        coeurl
        GIT_REPOSITORY https://nheko.im/Nheko-Reborn/coeurl.git
        GIT_TAG        831e2ee8e9cf08ea1ee9736cde8370f9d0312abc
    )
    FetchContent_MakeAvailable(coeurl)
    set(COEURL_TARGET_NAME coeurl::coeurl)
else()
    find_package(PkgConfig)
    pkg_check_modules(coeurl IMPORTED_TARGET coeurl>=0.3.0)
    if(TARGET PkgConfig::coeurl)
        set(COEURL_TARGET_NAME PkgConfig::coeurl)
    endif()
endif()

if(NOT TARGET PkgConfig::coeurl)
    find_package(coeurl 0.2.1 CONFIG)
    if(TARGET coeurl::coeurl)
        set(COEURL_TARGET_NAME coeurl::coeurl)
    endif()
endif()

if(NOT COEURL_TARGET_NAME)
    message(ERROR "Couldn't find coeurl")
endif()

if(USE_BUNDLED_RE2)
    hunter_add_package(re2)
    find_package(re2 CONFIG REQUIRED)
else()
    find_package(PkgConfig REQUIRED)
    pkg_check_modules(re2 REQUIRED IMPORTED_TARGET re2)
endif()

#
# LMDB
#
#include(LMDB)
if(USE_BUNDLED_LMDB)
    hunter_add_package_safe(lmdb)
    find_package(liblmdb CONFIG REQUIRED)

    target_include_directories(liblmdb::lmdb INTERFACE
        "${HUNTER_INSTALL_PREFIX}/include/lmdb")
else()
    find_package(LMDB REQUIRED)
endif()

#
# Discover Qt dependencies.
#
find_package(Qt6 6.5 COMPONENTS Core Widgets Gui LinguistTools Svg Multimedia Qml QuickControls2 REQUIRED)
find_package(Qt6DBus)

if(USE_BUNDLED_QTKEYCHAIN)
    include(FetchContent)
    set(BUILD_WITH_QT6 ON)
    FetchContent_Declare(
        qt6keychain
        GIT_REPOSITORY https://github.com/frankosterfeld/qtkeychain.git
        GIT_TAG        v0.14.0
    )
    set(BUILD_TEST_APPLICATION OFF CACHE INTERNAL "")
    FetchContent_MakeAvailable(qt6keychain)
else()
    find_package(Qt6Keychain REQUIRED)
endif()

if(USE_BUNDLED_KDSINGLEAPPLICATION)
    include(FetchContent)
    set(KDSingleApplication_QT6 ON CACHE BOOL INTERNAL)
    set(KDSingleApplication_EXAMPLES OFF CACHE BOOL INTERNAL)
    FetchContent_Declare(
        kdsingleapplication
        GIT_REPOSITORY https://github.com/KDAB/KDSingleApplication.git
        GIT_TAG        v1.0.0
    )
    FetchContent_MakeAvailable(kdsingleapplication)
else()
    find_package(KDSingleApplication-qt6 REQUIRED)
endif()

if(Qt6Widgets_FOUND)
    if(Qt6Widgets_VERSION VERSION_LESS 6.5.0)
        message(STATUS "Qt version ${Qt6Widgets_VERSION}")
        message(WARNING "Minimum supported Qt6 version is 6.5!")
    endif()
endif(Qt6Widgets_FOUND)

set(CMAKE_INCLUDE_CURRENT_DIR ON)
if(NOT MSVC)
    set(
        CMAKE_CXX_FLAGS
        "${CMAKE_CXX_FLAGS} \
        -Wall \
        -Wextra \
        -pedantic \
        -fsized-deallocation \
        -fdiagnostics-color=always \
        -Wunreachable-code \
        -Wno-attributes"
    )
    if(NOT CMAKE_COMPILER_IS_GNUCXX)
        # -Wshadow is buggy and broken in GCC, so do not enable it.
        # see https://gcc.gnu.org/bugzilla/show_bug.cgi?id=79328
        set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wshadow")
    endif()
endif()

if(MSVC)
    set(
        CMAKE_CXX_FLAGS
        "${CMAKE_CXX_FLAGS} /bigobj"
    )
endif()

if(NOT (CMAKE_BUILD_TYPE OR CMAKE_CONFIGURATION_TYPES))
    set(CMAKE_BUILD_TYPE "Debug" CACHE STRING
        "Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
        FORCE)
    message("Setting build type to '${CMAKE_BUILD_TYPE}'")
else(NOT (CMAKE_BUILD_TYPE OR CMAKE_CONFIGURATION_TYPES))
    message("Build type set to '${CMAKE_BUILD_TYPE}'")
endif(NOT (CMAKE_BUILD_TYPE OR CMAKE_CONFIGURATION_TYPES))

set(SPDLOG_DEBUG_ON false)

# Windows doesn't handle CMAKE_BUILD_TYPE.
if(NOT WIN32)
    if(CMAKE_BUILD_TYPE STREQUAL "Debug")
        set(SPDLOG_DEBUG_ON true)
    else()
        set(SPDLOG_DEBUG_ON false)
    endif()
endif()

find_program(GIT git)
if(GIT)
    execute_process(
        WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
        COMMAND ${GIT} rev-parse --short HEAD
        OUTPUT_VARIABLE GIT_OUT OUTPUT_STRIP_TRAILING_WHITESPACE
    )
    if(GIT_OUT)
        set(CPACK_PACKAGE_VERSION_PATCH "${CPACK_PACKAGE_VERSION_PATCH}-${GIT_OUT}")
    else()
        set(CPACK_PACKAGE_VERSION_PATCH "${CPACK_PACKAGE_VERSION_PATCH}")
    endif()
endif(GIT)

set(CPACK_PACKAGE_VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH})
set(PROJECT_VERSION ${CPACK_PACKAGE_VERSION})

message(STATUS "Version: ${PROJECT_VERSION}")

cmake_host_system_information(RESULT BUILD_HOST QUERY HOSTNAME)

include(CheckSymbolExists)
check_symbol_exists(backtrace_symbols_fd "execinfo.h" HAVE_BACKTRACE_SYMBOLS_FD)

configure_file(cmake/nheko.h config/nheko.h)

#
# Declare source and header files.
#
set(SRC_FILES
    # Emoji
    src/emoji/Provider.cpp
    src/emoji/Provider.h
    src/emoji/Emoji.cpp
    src/emoji/Emoji.h

    # Timeline
    src/timeline/CommunitiesModel.cpp
    src/timeline/CommunitiesModel.h
    src/timeline/DelegateChooser.cpp
    src/timeline/DelegateChooser.h
    src/timeline/EventStore.cpp
    src/timeline/EventStore.h
    src/timeline/EventDelegateChooser.cpp
    src/timeline/EventDelegateChooser.h
    src/timeline/InputBar.cpp
    src/timeline/InputBar.h
    src/timeline/Permissions.cpp
    src/timeline/Permissions.h
    src/timeline/PresenceEmitter.cpp
    src/timeline/PresenceEmitter.h
    src/timeline/Reaction.cpp
    src/timeline/Reaction.h
    src/timeline/RoomlistModel.cpp
    src/timeline/RoomlistModel.h
    src/timeline/TimelineFilter.cpp
    src/timeline/TimelineFilter.h
    src/timeline/TimelineModel.cpp
    src/timeline/TimelineModel.h
    src/timeline/TimelineViewManager.cpp
    src/timeline/TimelineViewManager.h

    # UI components
    src/ui/HiddenEvents.cpp
    src/ui/HiddenEvents.h
    src/ui/EventExpiry.cpp
    src/ui/EventExpiry.h
    src/ui/MxcAnimatedImage.cpp
    src/ui/MxcAnimatedImage.h
    src/ui/MxcMediaProxy.cpp
    src/ui/MxcMediaProxy.h
    src/ui/NhekoCursorShape.cpp
    src/ui/NhekoCursorShape.h
    src/ui/NhekoDropArea.cpp
    src/ui/NhekoDropArea.h
    src/ui/NhekoGlobalObject.cpp
    src/ui/NhekoGlobalObject.h
    src/ui/RoomSettings.cpp
    src/ui/RoomSettings.h
    src/ui/RoomSummary.cpp
    src/ui/RoomSummary.h
    src/ui/Theme.cpp
    src/ui/Theme.h
    src/ui/UIA.cpp
    src/ui/UIA.h
    src/ui/UserProfile.cpp
    src/ui/UserProfile.h

    src/voip/CallDevices.cpp
    src/voip/CallDevices.h
    src/voip/CallManager.cpp
    src/voip/CallManager.h
    src/voip/ScreenCastPortal.cpp
    src/voip/ScreenCastPortal.h
    src/voip/WebRTCSession.h
    src/voip/WebRTCSession.cpp
    src/voip/WebRTCSession.h

    src/encryption/DeviceVerificationFlow.cpp
    src/encryption/DeviceVerificationFlow.h
    src/encryption/Olm.cpp
    src/encryption/Olm.h
    src/encryption/SelfVerificationStatus.cpp
    src/encryption/SelfVerificationStatus.h
    src/encryption/VerificationManager.cpp
    src/encryption/VerificationManager.h

    # Generic notification stuff
    src/notifications/Manager.cpp
    src/notifications/Manager.h

    src/dock/Dock.cpp
    src/dock/Dock.h

    src/AliasEditModel.cpp
    src/AliasEditModel.h
    src/AvatarProvider.cpp
    src/AvatarProvider.h
    src/BlurhashProvider.cpp
    src/BlurhashProvider.h
    src/Cache.cpp
    src/Cache.h
    src/CacheCryptoStructs.cpp
    src/CacheCryptoStructs.h
    src/CacheStructs.h
    src/Cache_p.h
    src/ChatPage.cpp
    src/ChatPage.h
    src/Clipboard.cpp
    src/Clipboard.h
    src/ColorImageProvider.cpp
    src/ColorImageProvider.h
    src/CombinedImagePackModel.cpp
    src/CombinedImagePackModel.h
    src/GridImagePackModel.cpp
    src/GridImagePackModel.h
    src/CommandCompleter.cpp
    src/CommandCompleter.h
    src/CompletionModelRoles.h
    src/CompletionProxyModel.cpp
    src/CompletionProxyModel.h
    src/Config.h
    src/EventAccessors.cpp
    src/EventAccessors.h
    src/FallbackAuth.cpp
    src/FallbackAuth.h
    src/ImagePackListModel.cpp
    src/ImagePackListModel.h
    src/InviteesModel.cpp
    src/InviteesModel.h
    src/JdenticonProvider.cpp
    src/JdenticonProvider.h
    src/Logging.cpp
    src/Logging.h
    src/LoginPage.cpp
    src/LoginPage.h
    src/MainWindow.cpp
    src/MainWindow.h
    src/MatrixClient.cpp
    src/MatrixClient.h
    src/MemberList.cpp
    src/MemberList.h
    src/MxcImageProvider.cpp
    src/MxcImageProvider.h
    src/PowerlevelsEditModels.cpp
    src/PowerlevelsEditModels.h
    src/ReadReceiptsModel.cpp
    src/ReadReceiptsModel.h
    src/ReCaptcha.cpp
    src/ReCaptcha.h
    src/RegisterPage.cpp
    src/RegisterPage.h
    src/RoomDirectoryModel.cpp
    src/RoomDirectoryModel.h
    src/RoomsModel.cpp
    src/RoomsModel.h
    src/SSOHandler.cpp
    src/SSOHandler.h
    src/SingleImagePackModel.cpp
    src/SingleImagePackModel.h
    src/TrayIcon.cpp
    src/TrayIcon.h
    src/UserSettingsPage.cpp
    src/UserSettingsPage.h
    src/UsersModel.cpp
    src/UsersModel.h
    src/Utils.cpp
    src/Utils.h

    includes/jdenticoninterface.h

    src/main.cpp
)

include(FeatureSummary)

if(USE_BUNDLED_OPENSSL)
    hunter_add_package_safe(OpenSSL)
endif()
find_package(OpenSSL 1.1.0 REQUIRED)
if(USE_BUNDLED_OLM)
    include(FetchContent)
    FetchContent_Declare(
        Olm
        GIT_REPOSITORY https://gitlab.matrix.org/matrix-org/olm.git
        GIT_TAG        3.2.12
    )
    set(OLM_TESTS OFF CACHE INTERNAL "")
    FetchContent_MakeAvailable(Olm)
else()
    find_package(Olm 3.2.7 REQUIRED)
    set_package_properties(Olm PROPERTIES
        DESCRIPTION "An implementation of the Double Ratchet cryptographic ratchet"
        URL "https://git.matrix.org/git/olm/about/"
        TYPE REQUIRED
    )
endif()
if(USE_BUNDLED_SPDLOG)
    hunter_add_package_safe(spdlog)
endif()
find_package(spdlog 1.0.0 CONFIG REQUIRED)

if(USE_BUNDLED_CMARK)
    include(FetchContent)
    FetchContent_Declare(
        cmark
        GIT_REPOSITORY https://github.com/commonmark/cmark.git
        GIT_TAG        0.30.2
        CMAKE_ARGS     "CMARK_STATIC=ON CMARK_SHARED=OFF CMARK_TESTS=OFF CMARK_TESTS=OFF"
    )
    FetchContent_MakeAvailable(cmark)
    if(MSVC)
        add_library(cmark::cmark ALIAS cmark)
    else()
        add_library(cmark::cmark ALIAS cmark_static)
    endif()
else()
    find_package(cmark REQUIRED 0.29.0)
endif()

if(USE_BUNDLED_JSON)
    hunter_add_package_safe(nlohmann_json)
endif()
find_package(nlohmann_json 3.2.0)
set_package_properties(nlohmann_json PROPERTIES
    DESCRIPTION "JSON for Modern C++, a C++11 header-only JSON class"
    URL "https://nlohmann.github.io/json/"
    TYPE REQUIRED
)

if(USE_BUNDLED_LMDBXX)
    include(FetchContent)
    FetchContent_Declare(
        lmdbxx
        URL "https://raw.githubusercontent.com/hoytech/lmdbxx/1.0.0/lmdb++.h"
        DOWNLOAD_NO_EXTRACT TRUE
        CONFIGURE_COMMAND ""
        BUILD_COMMAND ""
    )
    FetchContent_Populate(lmdbxx)
    add_library(lmdbxx INTERFACE)
    target_include_directories(lmdbxx INTERFACE ${lmdbxx_SOURCE_DIR})
    add_library(lmdbxx::lmdbxx ALIAS lmdbxx)
else()
    if(NOT LMDBXX_INCLUDE_DIR)
        find_path(LMDBXX_INCLUDE_DIR
            NAMES lmdb++.h
            PATHS /usr/include
            /usr/local/include
            $ENV{LIB_DIR}/include
            $ENV{LIB_DIR}/include/lmdbxx)
    endif()
    add_library(lmdbxx INTERFACE)
    target_include_directories(lmdbxx INTERFACE ${LMD