2017-04-23 18:27:31 +02:00
|
|
|
cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR)
|
|
|
|
|
|
|
|
# metadata
|
|
|
|
set(META_PROJECT_NAME syncthingwidgets)
|
|
|
|
set(META_PROJECT_TYPE library)
|
|
|
|
set(META_APP_NAME "Widgets of Syncthing Tray")
|
|
|
|
set(META_PUBLIC_QT_MODULES Gui Widgets)
|
|
|
|
set(META_WEBVIEW_SRC_DIR webview)
|
|
|
|
|
|
|
|
# add project files
|
|
|
|
set(WIDGETS_HEADER_FILES
|
|
|
|
settings/settings.h
|
|
|
|
settings/settingsdialog.h
|
2022-08-06 21:08:55 +02:00
|
|
|
settings/wizard.h
|
2017-04-23 18:27:31 +02:00
|
|
|
webview/webpage.h
|
|
|
|
webview/webviewdialog.h
|
|
|
|
misc/textviewdialog.h
|
2018-11-03 18:07:45 +01:00
|
|
|
misc/internalerrorsdialog.h
|
2018-11-03 21:30:17 +01:00
|
|
|
misc/direrrorsdialog.h
|
2017-04-25 00:50:30 +02:00
|
|
|
misc/statusinfo.h
|
|
|
|
misc/dbusstatusnotifier.h
|
2017-08-20 01:20:47 +02:00
|
|
|
misc/internalerror.h
|
2017-08-29 23:53:44 +02:00
|
|
|
misc/otherdialogs.h
|
2018-04-11 23:15:15 +02:00
|
|
|
misc/syncthinglauncher.h
|
2019-02-06 17:36:14 +01:00
|
|
|
misc/syncthingkiller.h)
|
2017-04-23 18:27:31 +02:00
|
|
|
set(WIDGETS_SRC_FILES
|
|
|
|
settings/settings.cpp
|
|
|
|
settings/settingsdialog.cpp
|
2022-08-23 18:19:47 +02:00
|
|
|
settings/setupdetection.h
|
|
|
|
settings/setupdetection.cpp
|
2022-08-06 21:08:55 +02:00
|
|
|
settings/wizard.cpp
|
2017-04-23 18:27:31 +02:00
|
|
|
webview/webpage.cpp
|
|
|
|
webview/webviewdialog.cpp
|
2017-12-30 02:26:55 +01:00
|
|
|
webview/webviewinterceptor.h
|
|
|
|
webview/webviewinterceptor.cpp
|
2017-04-23 18:27:31 +02:00
|
|
|
misc/textviewdialog.cpp
|
2018-11-03 18:07:45 +01:00
|
|
|
misc/internalerrorsdialog.cpp
|
2018-11-03 21:30:17 +01:00
|
|
|
misc/direrrorsdialog.cpp
|
2017-04-25 00:50:30 +02:00
|
|
|
misc/statusinfo.cpp
|
|
|
|
misc/dbusstatusnotifier.cpp
|
2017-09-08 16:54:59 +02:00
|
|
|
misc/internalerror.cpp
|
2017-08-29 23:53:44 +02:00
|
|
|
misc/otherdialogs.cpp
|
2018-04-11 23:15:15 +02:00
|
|
|
misc/syncthinglauncher.cpp
|
2019-02-06 17:36:14 +01:00
|
|
|
misc/syncthingkiller.cpp)
|
|
|
|
set(RES_FILES resources/${META_PROJECT_NAME}icons.qrc)
|
2017-04-23 18:27:31 +02:00
|
|
|
set(WIDGETS_UI_FILES
|
|
|
|
settings/connectionoptionpage.ui
|
|
|
|
settings/notificationsoptionpage.ui
|
|
|
|
settings/appearanceoptionpage.ui
|
2019-05-19 17:56:11 +02:00
|
|
|
settings/iconsoptionpage.ui
|
2017-04-23 18:27:31 +02:00
|
|
|
settings/autostartoptionpage.ui
|
|
|
|
settings/launcheroptionpage.ui
|
|
|
|
settings/systemdoptionpage.ui
|
2023-03-27 20:13:49 +02:00
|
|
|
settings/generalwebviewoptionpage.ui
|
|
|
|
settings/builtinwebviewoptionpage.ui
|
2022-09-03 21:32:44 +02:00
|
|
|
settings/mainconfigwizardpage.ui
|
2022-09-17 23:09:00 +02:00
|
|
|
settings/autostartwizardpage.ui
|
|
|
|
settings/applywizardpage.ui)
|
2017-04-23 18:27:31 +02:00
|
|
|
|
2021-10-07 18:28:13 +02:00
|
|
|
set(TS_FILES translations/${META_PROJECT_NAME}_zh_CN.ts translations/${META_PROJECT_NAME}_cs_CZ.ts
|
|
|
|
translations/${META_PROJECT_NAME}_de_DE.ts translations/${META_PROJECT_NAME}_en_US.ts)
|
2017-04-23 18:27:31 +02:00
|
|
|
|
|
|
|
set(REQUIRED_ICONS
|
2019-11-19 19:33:58 +01:00
|
|
|
color-profile
|
2020-04-03 16:31:41 +02:00
|
|
|
document-open
|
2017-04-23 18:27:31 +02:00
|
|
|
preferences-other
|
|
|
|
process-stop
|
|
|
|
list-add
|
|
|
|
preferences-desktop
|
|
|
|
internet-web-browser
|
|
|
|
system-run
|
|
|
|
edit-paste
|
|
|
|
list-remove
|
|
|
|
preferences-desktop-notification
|
2021-05-07 00:05:18 +02:00
|
|
|
preferences-system-startup
|
|
|
|
preferences-system-services
|
2017-04-23 18:27:31 +02:00
|
|
|
view-refresh
|
|
|
|
emblem-checked
|
|
|
|
network-connect
|
|
|
|
emblem-remove
|
2017-10-07 22:24:19 +02:00
|
|
|
go-down
|
2022-08-06 21:08:55 +02:00
|
|
|
go-up
|
2022-10-30 21:40:42 +01:00
|
|
|
quickwizard
|
2022-08-06 21:08:55 +02:00
|
|
|
help-contents)
|
2017-04-23 18:27:31 +02:00
|
|
|
|
2022-10-16 15:08:29 +02:00
|
|
|
set(QT_TESTS wizard)
|
|
|
|
|
2017-04-23 18:27:31 +02:00
|
|
|
# find c++utilities
|
2022-10-08 22:44:00 +02:00
|
|
|
find_package(${PACKAGE_NAMESPACE_PREFIX}c++utilities${CONFIGURATION_PACKAGE_SUFFIX} 5.20.0 REQUIRED)
|
2021-07-15 02:38:26 +02:00
|
|
|
use_cpp_utilities(VISIBILITY PUBLIC)
|
2017-04-23 18:27:31 +02:00
|
|
|
|
|
|
|
# find qtutilities
|
2023-02-17 19:20:10 +01:00
|
|
|
find_package(${PACKAGE_NAMESPACE_PREFIX}qtutilities${CONFIGURATION_PACKAGE_SUFFIX_QTUTILITIES} 6.11.0 REQUIRED)
|
2017-04-23 18:27:31 +02:00
|
|
|
use_qt_utilities()
|
|
|
|
|
|
|
|
# find backend libraries
|
|
|
|
find_package(syncthingconnector ${META_APP_VERSION} REQUIRED)
|
2019-03-13 19:12:23 +01:00
|
|
|
use_syncthingconnector(VISIBILITY PUBLIC)
|
2017-04-23 18:27:31 +02:00
|
|
|
find_package(syncthingmodel ${META_APP_VERSION} REQUIRED)
|
2019-03-13 19:12:23 +01:00
|
|
|
use_syncthingmodel(VISIBILITY PUBLIC)
|
2017-04-23 18:27:31 +02:00
|
|
|
|
2018-10-28 17:03:23 +01:00
|
|
|
# configure libsyncthing
|
2018-04-11 23:15:15 +02:00
|
|
|
option(USE_LIBSYNCTHING "whether libsyncthing should be included for the launcher" OFF)
|
2019-02-06 17:36:14 +01:00
|
|
|
if (USE_LIBSYNCTHING)
|
2018-04-11 23:15:15 +02:00
|
|
|
find_package(syncthing ${META_APP_VERSION} REQUIRED)
|
|
|
|
use_syncthing()
|
2021-02-03 00:01:34 +01:00
|
|
|
list(APPEND META_PUBLIC_COMPILE_DEFINITIONS SYNCTHINGWIDGETS_USE_LIBSYNCTHING)
|
2019-02-06 17:36:14 +01:00
|
|
|
endif ()
|
2018-04-11 23:15:15 +02:00
|
|
|
|
2018-10-28 17:03:23 +01:00
|
|
|
# configure logging JavaScript events to stderr
|
|
|
|
option(SYNCTHING_WIDGETS_LOG_JAVASCRIPT_CONSOLE "enables logging JavaScript events of webview to stderr" OFF)
|
2019-02-06 17:36:14 +01:00
|
|
|
if (SYNCTHING_WIDGETS_LOG_JAVASCRIPT_CONSOLE)
|
2019-11-30 18:24:19 +01:00
|
|
|
set_property(
|
|
|
|
SOURCE webview/webpage.cpp
|
|
|
|
APPEND
|
|
|
|
PROPERTY COMPILE_DEFINITIONS SYNCTHINGWIDGETS_LOG_JAVASCRIPT_CONSOLE)
|
2018-10-28 17:03:23 +01:00
|
|
|
message(WARNING "JavaScript console of web view will be logged to stderr")
|
2019-02-06 17:36:14 +01:00
|
|
|
endif ()
|
2018-10-28 17:03:23 +01:00
|
|
|
|
2022-12-09 07:34:01 +01:00
|
|
|
# configure autostart .desktop file exec path
|
2022-12-10 12:19:26 +01:00
|
|
|
set(AUTOSTART_EXEC_PATH
|
|
|
|
""
|
|
|
|
CACHE STRING "Set the Exec= path for Linux' autostart/syncthingtray.desktop file - useful for Nix & Guix")
|
2022-12-09 07:34:01 +01:00
|
|
|
if (AUTOSTART_EXEC_PATH)
|
2022-12-10 12:19:26 +01:00
|
|
|
set_property(
|
|
|
|
SOURCE settings/settingsdialog.cpp
|
|
|
|
APPEND
|
|
|
|
PROPERTY COMPILE_DEFINITIONS SYNCTHINGWIDGETS_AUTOSTART_EXEC_PATH="${AUTOSTART_EXEC_PATH}")
|
|
|
|
endif ()
|
2022-12-09 07:34:01 +01:00
|
|
|
|
2021-07-03 19:29:49 +02:00
|
|
|
# link also explicitly against the following Qt modules
|
2018-04-15 20:20:30 +02:00
|
|
|
list(APPEND ADDITIONAL_QT_MODULES Network Concurrent)
|
2017-04-23 18:27:31 +02:00
|
|
|
|
|
|
|
# include modules to apply configuration
|
|
|
|
include(BasicConfig)
|
|
|
|
include(QtGuiConfig)
|
2019-03-13 19:12:23 +01:00
|
|
|
include(QtWebViewProviderConfig)
|
2017-04-23 18:27:31 +02:00
|
|
|
include(QtConfig)
|
|
|
|
include(WindowsResources)
|
|
|
|
include(LibraryTarget)
|
|
|
|
include(Doxygen)
|
|
|
|
include(ConfigHeader)
|
2022-10-16 15:08:29 +02:00
|
|
|
|
|
|
|
# configure test target
|
|
|
|
include(TestUtilities)
|
|
|
|
list(APPEND QT_TEST_LIBRARIES ${CPP_UTILITIES_LIB} ${META_TARGET_NAME})
|
|
|
|
use_qt_module(LIBRARIES_VARIABLE "QT_TEST_LIBRARIES" PREFIX "${QT_PACKAGE_PREFIX}" MODULE "Test")
|
|
|
|
foreach (TEST ${QT_TESTS})
|
2022-12-18 00:23:02 +01:00
|
|
|
configure_test_target(
|
|
|
|
TEST_NAME
|
|
|
|
"${TEST}_tests"
|
|
|
|
SRC_FILES
|
|
|
|
"tests/${TEST}.cpp"
|
|
|
|
LIBRARIES
|
|
|
|
"${QT_TEST_LIBRARIES}"
|
|
|
|
FULL_TEST_NAME_OUT_VAR
|
|
|
|
FULL_TEST_NAME_${TEST})
|
|
|
|
# avoid running wizard tests in parallel with other tests spawning a Syncthing test instance
|
|
|
|
if ("${TEST}" STREQUAL "wizard")
|
|
|
|
set_tests_properties("${FULL_TEST_NAME_${TEST}}" PROPERTIES RESOURCE_LOCK "syncthingtestinstance")
|
2023-01-30 15:19:08 +01:00
|
|
|
set_tests_properties("${FULL_TEST_NAME_${TEST}}" PROPERTIES ENVIRONMENT "LIB_SYNCTHING_CONNECTOR_LOG_ALL=1")
|
2022-12-18 00:23:02 +01:00
|
|
|
endif ()
|
2022-10-16 15:08:29 +02:00
|
|
|
endforeach ()
|