1
- cmake_minimum_required (VERSION 3.7.0 )
1
+ cmake_minimum_required (VERSION 3.16 )
2
2
3
3
project (otter-browser )
4
4
@@ -64,39 +64,19 @@ set(CMAKE_AUTOMOC ON)
64
64
set (CMAKE_CXX_EXTENSIONS OFF )
65
65
set (CMAKE_CXX_STANDARD 11 )
66
66
set (CMAKE_CXX_STANDARD_REQUIRED ON )
67
- set (MIN_VERSION_QT5 5.15 )
68
- set (MIN_VERSION_QT6 6.2 )
69
- set (MIN_VERSION_QTWEBKIT 5.212 )
70
67
71
68
include (FeatureSummary )
72
69
include (GNUInstallDirs )
73
70
74
71
option (ALLOW_WITHOUT_WEB_BACKENDS "Allow to build without any web backends (build testing only)" OFF )
75
- option (ENABLE_QT6 "Build using Qt 6" ON )
76
-
77
- if (ENABLE_QT6 )
78
- if (NOT ALLOW_WITHOUT_WEB_BACKENDS )
79
- option (ENABLE_QTWEBENGINE "Enable QtWebEngine backend (requires QtWebEngine version ${MIN_VERSION_QT6} or higher)" ON )
80
- endif ()
81
- find_package (Qt6 ${MIN_VERSION_QT6} REQUIRED COMPONENTS Core Core5Compat Gui Multimedia Network PrintSupport Qml Svg WebEngineWidgets Widgets )
82
- else ()
83
- if (NOT ALLOW_WITHOUT_WEB_BACKENDS )
84
- option (ENABLE_QTWEBENGINE "Enable QtWebEngine backend (requires QtWebEngine ${MIN_VERSION_QT5} )" ON )
85
- option (ENABLE_QTWEBKIT "Enable QtWebKit backend (requires QtWebKit ${MIN_VERSION_QTWEBKIT} )" ON )
86
- endif ()
87
- find_package (Qt5 ${MIN_VERSION_QT5} REQUIRED COMPONENTS Core Gui Multimedia Network PrintSupport Qml Svg Widgets )
88
- find_package (Qt5WebKitWidgets ${MIN_VERSION_QTWEBKIT} QUIET )
89
- endif ()
90
-
91
72
option (ENABLE_CRASH_REPORTS "Enable built-in crash reporting (official builds only)" OFF )
92
73
option (ENABLE_DBUS "Enable D-Bus based integration for notifications (only freedesktop.org compatible platforms)" ON )
93
- option (ENABLE_SPELLCHECK "Enable Hunspell based spell checking" ON )
94
-
95
- if (ENABLE_SPELLCHECK )
96
- find_package (Hunspell 1.5.0 REQUIRED )
97
- endif ()
74
+ option (ENABLE_SPELLCHECK "Enable Hunspell based spell checking" OFF )
75
+ option (ENABLE_QT6 "Build using Qt 6" ON )
76
+ option (ENABLE_QTWEBENGINE "Enable QtWebEngine backend (requires Qt WebEngine version ${QT_MINIMUM_VERSION} or higher)" ON )
77
+ option (ENABLE_QTWEBKIT "Enable QtWebKit backend (requires QtWebKit ${QT_MINIMUM_VERSION_WEBKIT} )" OFF )
98
78
99
- set_package_properties ( Hunspell PROPERTIES URL "https://hunspell.github.io/" DESCRIPTION "Generic spell checking support" TYPE OPTIONAL )
79
+ include ( cmake/Dependencies.cmake )
100
80
101
81
set (OTTER_SOURCES
102
82
src/main.cpp
@@ -308,7 +288,7 @@ set(OTTER_SOURCES
308
288
3rdparty/qrcodegen/qrcodegen.cpp
309
289
)
310
290
311
- set ( OTTER_UI_SOURCES
291
+ qt_wrap_ui ( OTTER_UI
312
292
src/ui/AcceptCookieDialog.ui
313
293
src/ui/ActionParametersDialog.ui
314
294
src/ui/AuthenticationDialog.ui
@@ -382,41 +362,17 @@ set(OTTER_UI_SOURCES
382
362
src/modules/windows/windows/WindowsContentsWidget.ui
383
363
)
384
364
385
- if (ENABLE_QT6 )
386
- qt6_add_resources (OTTER_RESOURCES
387
- resources/resources.qrc
388
- )
389
-
390
- qt6_wrap_ui (OTTER_UI
391
- ${OTTER_UI_SOURCES}
392
- )
393
- else ()
394
- qt5_add_resources (OTTER_RESOURCES
395
- resources/resources.qrc
396
- )
397
-
398
- qt5_wrap_ui (OTTER_UI
399
- ${OTTER_UI_SOURCES}
400
- )
401
- endif ()
365
+ qt_add_resources (OTTER_RESOURCES
366
+ resources/resources.qrc
367
+ )
402
368
403
- if (ENABLE_QT6 )
404
- foreach (_current_dir ${Qt6Widgets_PRIVATE_INCLUDE_DIRS} )
405
- if (EXISTS "${_current_dir} /private/qpixmapfilter_p.h" )
406
- add_definitions (-DOTTER_ENABLE_STARTPAGEBLUR )
407
- include_directories (${Qt6Widgets_PRIVATE_INCLUDE_DIRS} )
408
- break ()
409
- endif ()
410
- endforeach ()
411
- else ()
412
- foreach (_dir ${Qt5Widgets_PRIVATE_INCLUDE_DIRS} )
413
- if (EXISTS "${_dir} /private/qpixmapfilter_p.h" )
414
- add_definitions (-DOTTER_ENABLE_STARTPAGEBLUR )
415
- include_directories (${Qt5Widgets_PRIVATE_INCLUDE_DIRS} )
416
- break ()
417
- endif ()
418
- endforeach ()
419
- endif ()
369
+ foreach (_dir ${QT_MAJOR_VERSION} Widgets_PRIVATE_INCLUDE_DIRS} )
370
+ if (EXISTS "${_dir} /private/qpixmapfilter_p.h" )
371
+ add_definitions (-DOTTER_ENABLE_STARTPAGEBLUR )
372
+ include_directories (${QT_MAJOR_VERSION} Widgets_PRIVATE_INCLUDE_DIRS} )
373
+ break ()
374
+ endif ()
375
+ endforeach ()
420
376
421
377
if (ENABLE_QTWEBENGINE )
422
378
include (src/modules/backends/web/qtwebengine/CMakeLists.txt )
@@ -489,10 +445,6 @@ endif ()
489
445
if (WIN32 )
490
446
add_definitions (-DUNICODE -D_UNICODE )
491
447
492
- if (NOT ENABLE_QT6 )
493
- find_package (Qt5 ${MIN_VERSION_QT5} QUIET COMPONENTS WinExtras )
494
- endif ()
495
-
496
448
if (MSVC )
497
449
set (CMAKE_PREFIX_PATH $ENV{QTDIR} )
498
450
set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /MP" )
@@ -513,10 +465,6 @@ if (WIN32)
513
465
src/modules/platforms/windows/WindowsPlatformStyle.cpp
514
466
)
515
467
elseif (APPLE )
516
- if (NOT ENABLE_QT6 )
517
- find_package (Qt5 ${MIN_VERSION_QT5} QUIET COMPONENTS MacExtras )
518
- endif ()
519
-
520
468
set (CMAKE_OSX_DEPLOYMENT_TARGET 10.13 )
521
469
set (MACOSX_BUNDLE_BUNDLE_NAME "Otter Browser" )
522
470
set (MACOSX_BUNDLE_BUNDLE_VERSION ${MAJOR_VERSION} .${MINOR_VERSION}.${PATCH_VERSION} )
@@ -534,16 +482,8 @@ elseif (APPLE)
534
482
535
483
set_source_files_properties (resources/icons/otter-browser.icns PROPERTIES MACOSX_PACKAGE_LOCATION Resources )
536
484
elseif (UNIX )
537
- if (ENABLE_QT6 )
538
- find_package (Qt6 ${MIN_VERSION_QT6} QUIET COMPONENTS DBus )
539
- if (TARGET Qt6::DBus AND ENABLE_DBUS )
540
- add_definitions (-DOTTER_ENABLE_DBUS )
541
- endif ()
542
- else ()
543
- find_package (Qt5 ${MIN_VERSION_QT5} QUIET COMPONENTS DBus )
544
- if (TARGET Qt5::DBus AND ENABLE_DBUS )
545
- add_definitions (-DOTTER_ENABLE_DBUS )
546
- endif ()
485
+ if (TARGET ${QT_MAJOR_VERSION} ::DBus AND ENABLE_DBUS )
486
+ add_definitions (-DOTTER_ENABLE_DBUS )
547
487
endif ()
548
488
549
489
set (OTTER_SOURCES
@@ -616,27 +556,13 @@ foreach (_library ${OTTER_LINK_LIBRARIES})
616
556
target_link_libraries (otter-browser ${_library} )
617
557
endforeach ()
618
558
619
- if (ENABLE_QT6 )
620
- if (TARGET Qt6::WebEngineWidgets AND ENABLE_QTWEBENGINE )
621
- target_link_libraries (otter-browser Qt6::WebEngineCore Qt6::WebEngineWidgets )
622
- endif ()
623
- else ()
624
- if (TARGET Qt5::WebEngineWidgets AND ENABLE_QTWEBENGINE )
625
- target_link_libraries (otter-browser Qt5::WebEngineCore Qt5::WebEngineWidgets )
626
- endif ()
627
- endif ()
628
-
629
- if (TARGET Qt5::WebKitWidgets AND ENABLE_QTWEBKIT )
630
- target_link_libraries (otter-browser Qt5::WebKit Qt5::WebKitWidgets )
631
- endif ()
632
-
633
559
if (TARGET Hunspell::Hunspell AND ENABLE_SPELLCHECK )
634
560
target_link_libraries (otter-browser Hunspell::Hunspell )
635
561
endif ()
636
562
637
563
if (WIN32 )
638
564
if (NOT ENABLE_QT6 )
639
- target_link_libraries (Qt5 ::WinExtras )
565
+ target_link_libraries (${QT_MAJOR_VERSION} ::WinExtras )
640
566
endif ()
641
567
target_link_libraries (otter-browser ole32 shell32 advapi32 user32 )
642
568
elseif (APPLE )
@@ -646,29 +572,33 @@ elseif (APPLE)
646
572
set_target_properties (otter-browser PROPERTIES OUTPUT_NAME "Otter Browser" )
647
573
648
574
if (NOT ENABLE_QT6 )
649
- target_link_libraries (otter-browser Qt5 ::MacExtras ${FRAMEWORK_Cocoa} ${FRAMEWORK_Foundation} )
575
+ target_link_libraries (otter-browser ${QT_MAJOR_VERSION} ::MacExtras ${FRAMEWORK_Cocoa} ${FRAMEWORK_Foundation} )
650
576
endif ()
651
577
target_link_libraries (otter-browser ${FRAMEWORK_Cocoa} ${FRAMEWORK_Foundation} )
652
578
elseif (UNIX )
653
- if (ENABLE_QT6 )
654
- if (TARGET Qt6::DBus AND ENABLE_DBUS )
655
- target_link_libraries (otter-browser Qt6::DBus )
656
- endif ()
657
- else ()
658
- if (TARGET Qt5::DBus AND ENABLE_DBUS )
659
- target_link_libraries (otter-browser Qt5::DBus )
660
- endif ()
579
+ if (TARGET ${QT_MAJOR_VERSION} ::DBus AND ENABLE_DBUS )
580
+ target_link_libraries (otter-browser ${QT_MAJOR_VERSION} ::DBus )
661
581
endif ()
662
582
663
583
if (ENABLE_CRASH_REPORTS )
664
584
target_link_libraries (otter-browser -lpthread )
665
585
endif ()
666
586
endif ()
667
587
588
+ target_link_libraries (
589
+ otter-browser
590
+ ${QT_MAJOR_VERSION} ::Core
591
+ ${QT_MAJOR_VERSION} ::Gui
592
+ ${QT_MAJOR_VERSION} ::Multimedia
593
+ ${QT_MAJOR_VERSION} ::Network
594
+ ${QT_MAJOR_VERSION} ::PrintSupport
595
+ ${QT_MAJOR_VERSION} ::Qml
596
+ ${QT_MAJOR_VERSION} ::Svg
597
+ ${QT_MAJOR_VERSION} ::Widgets
598
+ )
599
+
668
600
if (ENABLE_QT6 )
669
- target_link_libraries (otter-browser Qt6::Core Qt6::Core5Compat Qt6::Gui Qt6::Multimedia Qt6::Network Qt6::PrintSupport Qt6::Qml Qt6::Svg Qt6::Widgets )
670
- else ()
671
- target_link_libraries (otter-browser Qt5::Core Qt5::Gui Qt5::Multimedia Qt5::Network Qt5::PrintSupport Qt5::Qml Qt5::Svg Qt5::Widgets )
601
+ target_link_libraries (otter-browser ${QT_MAJOR_VERSION} ::Core5Compat )
672
602
endif ()
673
603
674
604
set (XDG_APPS_INSTALL_DIR ${CMAKE_INSTALL_PREFIX} /share/applications CACHE FILEPATH "Install path for .desktop files" )
0 commit comments