-
Notifications
You must be signed in to change notification settings - Fork 47
/
Copy pathCMakeLists.txt
121 lines (111 loc) · 5.46 KB
/
CMakeLists.txt
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
cmake_minimum_required(VERSION 3.17.0 FATAL_ERROR)
# define metadata
set(META_PROJECT_NAME syncthingtray)
set(META_APP_AUTHOR "Martchus")
set(META_APP_AUTHOR_MAIL "[email protected]")
set(META_APP_URL "https://${META_APP_AUTHOR}.github.io/${META_PROJECT_NAME}")
set(META_APP_URL_RAW "https://raw.githubusercontent.com/${META_APP_AUTHOR}/${META_PROJECT_NAME}/master")
set(META_APP_BUGTRACKER_URL "https://github.com/${META_APP_AUTHOR}/${META_PROJECT_NAME}/issues")
set(META_APP_DESCRIPTION "Tray application for Syncthing")
set(META_APP_CATEGORIES "Network;FileTransfer")
set(META_GUI_OPTIONAL false)
set(META_VERSION_MAJOR 1)
set(META_VERSION_MINOR 7)
set(META_VERSION_PATCH 2)
set(META_RELEASE_DATE "2025-01-09")
set(META_SOVERSION 21)
set(META_ADD_DEFAULT_CPP_UNIT_TEST_APPLICATION ON)
set(NETWORK_INFORMATION_SUPPORT ON)
project(${META_PROJECT_NAME})
enable_testing()
# disable experimental Qt Quick GUI by default except on mobile platforms, enable libsyncthing by default
if (ANDROID OR IOS)
set(WIDGET_GUI_ENABLED_BY_DEFAULT OFF)
set(QUICK_GUI_ENABLED_BY_DEFAULT ON)
set(LIBSYNCTHING_DISABLED_BY_DEFAULT OFF)
else ()
set(WIDGET_GUI_ENABLED_BY_DEFAULT ON)
set(QUICK_GUI_ENABLED_BY_DEFAULT OFF)
set(LIBSYNCTHING_DISABLED_BY_DEFAULT ON)
endif ()
# disable KDE integration under Android, Windows and MacOS by default
if(ANDROID OR WIN32 OR APPLE)
set(FILE_ITEM_ACTION_PLUGIN_DISABLED_BY_DEFAULT ON)
set(PLASMOID_DISABLED_BY_DEFAULT ON)
else()
set(FILE_ITEM_ACTION_PLUGIN_DISABLED_BY_DEFAULT OFF)
set(PLASMOID_DISABLED_BY_DEFAULT OFF)
endif()
# determine Qt and KDE Frameworks version bases on the package prefix
set(QT_PACKAGE_PREFIX
"Qt5"
CACHE STRING "specifies the prefix for Qt packages")
set(KF_PACKAGE_PREFIX
"KF5"
CACHE STRING "specifies the prefix for KDE Frameworks packages")
set(QT_MAJOR_VERSION 5)
if (QT_PACKAGE_PREFIX MATCHES ".*Qt([0-9]+).*")
set(QT_MAJOR_VERSION "${CMAKE_MATCH_1}")
endif ()
set(KF_MAJOR_VERSION 5)
if (KF_PACKAGE_PREFIX MATCHES ".*KF([0-9]+).*")
set(KF_MAJOR_VERSION "${CMAKE_MATCH_1}")
endif ()
# add options for partial build
option(NO_LIBSYNCTHING "whether building Syncthing itself as a library should be skipped" "${LIBSYNCTHING_DISABLED_BY_DEFAULT}")
option(NO_CLI "whether building CLI should be skipped" OFF)
option(NO_TRAY "whether building the tray should be skipped" OFF)
option(NO_FILE_ITEM_ACTION_PLUGIN "whether building the file item action plugin should be skipped" "${FILE_ITEM_ACTION_PLUGIN_DISABLED_BY_DEFAULT}")
option(NO_MODEL "whether building models should be skipped, implies NO_TRAY" OFF)
option(NO_WIDGETS "whether building widgets should be skipped, implies NO_TRAY" OFF)
option(NO_PLASMOID "whether building the Plasmoid for the Plasma desktop should be skipped" "${PLASMOID_DISABLED_BY_DEFAULT}")
option(WIDGETS_GUI "enables/disables building the Qt Widgets GUI (disabled by default)" ${WIDGET_GUI_ENABLED_BY_DEFAULT})
option(QUICK_GUI "enables/disables building the experimental Qt Quick GUI (disabled by default)" ${QUICK_GUI_ENABLED_BY_DEFAULT})
# allow using non-default configuration
set(CONFIGURATION_PACKAGE_SUFFIX "" CACHE STRING "sets the suffix for find_package() calls to packages configured via c++utilities")
set(CONFIGURATION_PACKAGE_SUFFIX_QTUTILITIES "${CONFIGURATION_PACKAGE_SUFFIX}" CACHE STRING "sets the suffix for qtutilities")
set(CONFIGURATION_PACKAGE_SUFFIX_QTFORKAWESOME "${CONFIGURATION_PACKAGE_SUFFIX_QTUTILITIES}" CACHE STRING "sets the suffix for qtforkawesome")
# allow building qtforkawesome as part of this project
set(BUNDLED_QT_FORK_AWESOME_PATH OFF CACHE PATH "specifies the (relative) path to the qtforkawesome sources for building it together with ${META_PROJECT_NAME}")
if(NOT BUNDLED_QT_FORK_AWESOME_PATH)
message(STATUS "Using system qtforkawesome")
else()
if(IS_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/${BUNDLED_QT_FORK_AWESOME_PATH}" OR IS_DIRECTORY "${BUNDLED_QT_FORK_AWESOME_PATH}")
add_subdirectory("${BUNDLED_QT_FORK_AWESOME_PATH}" qtforkawesome)
set(${NAMESPACE_PREFIX}qtforkawesome${CONFIGURATION_PACKAGE_SUFFIX_QTFORKAWESOME}_DIR "${CMAKE_CURRENT_BINARY_DIR}/qtforkawesome/qtforkawesome")
set(${NAMESPACE_PREFIX}qtquickforkawesome${CONFIGURATION_PACKAGE_SUFFIX_QTFORKAWESOME}_DIR "${CMAKE_CURRENT_BINARY_DIR}/qtforkawesome/qtquickforkawesome")
set(${NAMESPACE_PREFIX}qtforkawesomeiconengine${CONFIGURATION_PACKAGE_SUFFIX_QTFORKAWESOME}_DIR "${CMAKE_CURRENT_BINARY_DIR}/qtforkawesome/iconengineplugin")
else()
message(FATAL_ERROR "Specified directory for qtforkawesome sources \"${BUNDLED_QT_FORK_AWESOME_PATH}\" does not exist.")
endif()
endif()
set(PACKAGE_NAMESPACE "" CACHE STRING "sets the prefix for find_package() calls to packages configured via c++utilities")
if (PACKAGE_NAMESPACE)
set(PACKAGE_NAMESPACE_PREFIX "${PACKAGE_NAMESPACE}-")
endif ()
# add subdirectories
add_subdirectory(syncthingconnector)
add_subdirectory(testhelper)
if (NOT NO_LIBSYNCTHING)
add_subdirectory(syncthing)
endif()
link_directories(${LIB_SYNCTHING_CONNECTOR_BINARY_DIR})
if(NOT NO_CLI)
add_subdirectory(cli)
endif()
if(NOT NO_MODEL)
add_subdirectory(syncthingmodel)
link_directories(${LIB_SYNCTHING_MODEL_BINARY_DIR})
if(NOT NO_WIDGETS)
add_subdirectory(syncthingwidgets)
if(NOT NO_TRAY)
add_subdirectory(tray)
endif()
if(NOT NO_PLASMOID)
add_subdirectory(plasmoid)
endif()
endif()
endif()
if(NOT NO_FILE_ITEM_ACTION_PLUGIN)
add_subdirectory(fileitemactionplugin)
endif()