Apply cmake-format

This commit is contained in:
Martchus 2019-02-06 17:36:14 +01:00
parent a1a9db30f9
commit 326f03b604
8 changed files with 120 additions and 207 deletions

View File

@ -8,21 +8,10 @@ set(META_PROJECT_TYPE application)
set(META_JS_SRC_DIR .)
# add project files
set(HEADER_FILES
helper.h
args.h
application.h
)
set(SRC_FILES
main.cpp
args.cpp
application.cpp
)
set(TEST_HEADER_FILES
)
set(TEST_SRC_FILES
tests/application.cpp
)
set(HEADER_FILES helper.h args.h application.h)
set(SRC_FILES main.cpp args.cpp application.cpp)
set(TEST_HEADER_FILES)
set(TEST_SRC_FILES tests/application.cpp)
# find c++utilities
find_package(c++utilities 4.17.0 REQUIRED)
@ -37,28 +26,28 @@ find_package(syncthingconnector ${META_APP_VERSION} REQUIRED)
use_syncthingconnector()
find_package(syncthingtesthelper ${META_APP_VERSION} REQUIRED)
if(SYNCTHINGTESTHELPER_HAS_SHARED_LIB)
if (SYNCTHINGTESTHELPER_HAS_SHARED_LIB)
list(APPEND TEST_LIBRARIES syncthingtesthelper)
elseif(SYNCTHINGTESTHELPER_HAS_STATIC_LIB)
elseif (SYNCTHINGTESTHELPER_HAS_STATIC_LIB)
list(APPEND TEST_LIBRARIES syncthingtesthelper_static)
else()
else ()
message(WARNING "Unable to build tests. Testhelper not found.")
endif()
endif ()
# include modules to apply configuration
include(BasicConfig)
include(JsProviderConfig)
if(JS_PROVIDER)
if (JS_PROVIDER)
list(APPEND HEADER_FILES jsconsole.h)
list(APPEND SRC_FILES jsconsole.cpp)
list(APPEND RES_FILES resources/js/js.qrc)
endif()
endif ()
include(QtConfig)
include(WindowsResources)
include(AppTarget)
if(SYNCTHINGTESTHELPER_HAS_SHARED_LIB OR SYNCTHINGTESTHELPER_HAS_STATIC_LIB)
if (SYNCTHINGTESTHELPER_HAS_SHARED_LIB OR SYNCTHINGTESTHELPER_HAS_STATIC_LIB)
include(TestTarget)
endif()
endif ()
include(ShellCompletion)
include(Doxygen)
include(ConfigHeader)

View File

@ -18,8 +18,7 @@ set(HEADER_FILES
syncthingconfig.h
syncthingprocess.h
syncthingservice.h
utils.h
)
utils.h)
set(SRC_FILES
syncthingdir.cpp
syncthingdev.cpp
@ -30,20 +29,12 @@ set(SRC_FILES
syncthingconfig.cpp
syncthingprocess.cpp
syncthingservice.cpp
utils.cpp
)
utils.cpp)
set(TEST_HEADER_FILES
)
set(TEST_SRC_FILES
tests/connectiontests.cpp
tests/misctests.cpp
)
set(TEST_HEADER_FILES)
set(TEST_SRC_FILES tests/connectiontests.cpp tests/misctests.cpp)
set(TS_FILES
translations/${META_PROJECT_NAME}_de_DE.ts
translations/${META_PROJECT_NAME}_en_US.ts
)
set(TS_FILES translations/${META_PROJECT_NAME}_de_DE.ts translations/${META_PROJECT_NAME}_en_US.ts)
# find c++utilities
find_package(c++utilities 4.17.0 REQUIRED)
@ -62,76 +53,67 @@ list(APPEND ADDITIONAL_QT_MODULES Network)
set(META_PUBLIC_QT_MODULES Core ${ADDITIONAL_QT_MODULES})
# configure support for controlling Syncthing via systemd service
if(UNIX AND NOT APPLE)
if (UNIX AND NOT APPLE)
set(ENABLE_SYSTEMD_SUPPORT_BY_DEFAULT ON)
else()
else ()
set(ENABLE_SYSTEMD_SUPPORT_BY_DEFAULT OFF)
endif()
endif ()
option(SYSTEMD_SUPPORT "enables support for controlling Syncthing systemd service" ${ENABLE_SYSTEMD_SUPPORT_BY_DEFAULT})
if(SYSTEMD_SUPPORT)
if (SYSTEMD_SUPPORT)
list(APPEND DBUS_FILES
org.freedesktop.DBus.Properties.xml
org.freedesktop.login1.LoginManager.xml
org.freedesktop.systemd1.Manager.xml
org.freedesktop.systemd1.Service.xml
org.freedesktop.systemd1.Unit.xml
)
set_source_files_properties(
org.freedesktop.systemd1.Manager.xml
PROPERTIES INCLUDE syncthingservice.h
)
org.freedesktop.DBus.Properties.xml
org.freedesktop.login1.LoginManager.xml
org.freedesktop.systemd1.Manager.xml
org.freedesktop.systemd1.Service.xml
org.freedesktop.systemd1.Unit.xml)
set_source_files_properties(org.freedesktop.systemd1.Manager.xml PROPERTIES INCLUDE syncthingservice.h)
list(APPEND META_PUBLIC_COMPILE_DEFINITIONS ${META_PROJECT_VARNAME_UPPER}_SUPPORT_SYSTEMD)
message(STATUS "systemd support enabled")
else()
else ()
message(STATUS "systemd support disabled")
endif()
endif ()
# configure whether the connection should be mocked for test purposes
option(SYNCTHING_CONNECTION_MOCKED "enables mocking the SyncthingConnection class so it will provide only some fixed test data" OFF)
if(SYNCTHING_CONNECTION_MOCKED)
list(APPEND SRC_FILES
syncthingconnectionmockhelpers.h
syncthingconnectionmockhelpers.cpp
)
set_property(
SOURCE syncthingconnection.cpp
syncthingconnection_requests.cpp
syncthingconnectionmockhelpers.h
syncthingconnectionmockhelpers.cpp
APPEND PROPERTY COMPILE_DEFINITIONS ${META_PROJECT_VARNAME_UPPER}_CONNECTION_MOCKED
)
option(SYNCTHING_CONNECTION_MOCKED
"enables mocking the SyncthingConnection class so it will provide only some fixed test data" OFF)
if (SYNCTHING_CONNECTION_MOCKED)
list(APPEND SRC_FILES syncthingconnectionmockhelpers.h syncthingconnectionmockhelpers.cpp)
set_property(SOURCE syncthingconnection.cpp
syncthingconnection_requests.cpp
syncthingconnectionmockhelpers.h
syncthingconnectionmockhelpers.cpp
APPEND
PROPERTY COMPILE_DEFINITIONS ${META_PROJECT_VARNAME_UPPER}_CONNECTION_MOCKED)
message(WARNING "SyncthingConnection class will be mocked")
endif()
endif ()
# configure whether the service should be mocked for test purposes
option(SYNCTHING_SERVICE_MOCKED "enables mocking the SyncthingService class so it will provide some fake status" OFF)
if(SYNCTHING_SERVICE_MOCKED)
set_property(
SOURCE syncthingservice.cpp
APPEND PROPERTY COMPILE_DEFINITIONS ${META_PROJECT_VARNAME_UPPER}_SERVICE_MOCKED
)
if (SYNCTHING_SERVICE_MOCKED)
set_property(SOURCE syncthingservice.cpp
APPEND
PROPERTY COMPILE_DEFINITIONS ${META_PROJECT_VARNAME_UPPER}_SERVICE_MOCKED)
message(WARNING "SyncthingService class will be mocked")
endif()
endif ()
# configure whether events should be logged
option(SYNCTHING_CONNECTION_LOG_SYNCTHING_EVENTS "enables logging event data to stdout (enable only for debugging!)" OFF)
if(SYNCTHING_CONNECTION_LOG_SYNCTHING_EVENTS)
set_property(
SOURCE syncthingconnection_requests.cpp
APPEND PROPERTY COMPILE_DEFINITIONS ${META_PROJECT_VARNAME_UPPER}_LOG_SYNCTHING_EVENTS
)
if (SYNCTHING_CONNECTION_LOG_SYNCTHING_EVENTS)
set_property(SOURCE syncthingconnection_requests.cpp
APPEND
PROPERTY COMPILE_DEFINITIONS ${META_PROJECT_VARNAME_UPPER}_LOG_SYNCTHING_EVENTS)
message(WARNING "SyncthingConnection class will log event data to stdout")
endif()
endif ()
# configure whether POSTs should be logged
option(SYNCTHING_CONNECTION_LOG_API_CALLS "enables logging API calls done by the SyncthingConnector (enable only for debugging!)" OFF)
if(SYNCTHING_CONNECTION_LOG_API_CALLS)
set_property(
SOURCE syncthingconnection_requests.cpp
APPEND PROPERTY COMPILE_DEFINITIONS ${META_PROJECT_VARNAME_UPPER}_LOG_API_CALLS
)
option(SYNCTHING_CONNECTION_LOG_API_CALLS
"enables logging API calls done by the SyncthingConnector (enable only for debugging!)" OFF)
if (SYNCTHING_CONNECTION_LOG_API_CALLS)
set_property(SOURCE syncthingconnection_requests.cpp
APPEND
PROPERTY COMPILE_DEFINITIONS ${META_PROJECT_VARNAME_UPPER}_LOG_API_CALLS)
message(WARNING "SyncthingConnection class will log API calls data to stdout")
endif()
endif ()
# include modules to apply configuration
include(BasicConfig)
@ -139,13 +121,12 @@ include(QtConfig)
include(WindowsResources)
include(LibraryTarget)
# link tests against test helper (can't use find_package because testhelper target is not
# present at this point)
if(BUILD_SHARED_LIBS)
# link tests against test helper (can't use find_package because testhelper target is not present at this point)
if (BUILD_SHARED_LIBS)
list(APPEND TEST_LIBRARIES syncthingtesthelper)
else()
else ()
list(APPEND TEST_LIBRARIES syncthingtesthelper_static)
endif()
endif ()
include(TestTarget)
include(Doxygen)

View File

@ -11,20 +11,15 @@ set(HEADER_FILES
syncthinginfoaction.h
syncthingdiractions.h
syncthingfileitemactionstaticdata.h
syncthingfileitemaction.h
)
syncthingfileitemaction.h)
set(SRC_FILES
syncthingmenuaction.cpp
syncthinginfoaction.cpp
syncthingdiractions.cpp
syncthingfileitemactionstaticdata.cpp
syncthingfileitemaction.cpp
)
syncthingfileitemaction.cpp)
set(TS_FILES
translations/${META_PROJECT_NAME}_de_DE.ts
translations/${META_PROJECT_NAME}_en_US.ts
)
set(TS_FILES translations/${META_PROJECT_NAME}_de_DE.ts translations/${META_PROJECT_NAME}_en_US.ts)
# find c++utilities
find_package(c++utilities 4.6.0 REQUIRED)
@ -51,12 +46,12 @@ include(QtConfig)
include(WindowsResources)
# KIO libs can not be determined automatically
list(REMOVE_ITEM PRIVATE_LIBRARIES KF5::KIO)
list(APPEND PRIVATE_LIBRARIES KF5::KIOCore KF5::KIOFileWidgets KF5::KIOWidgets KF5::KIONTLM)
list(APPEND PRIVATE_LIBRARIES
KF5::KIOCore
KF5::KIOFileWidgets
KF5::KIOWidgets
KF5::KIONTLM)
include(LibraryTarget)
include(ConfigHeader)
install(
FILES ${META_PROJECT_NAME}.desktop
DESTINATION "share/kservices5"
COMPONENT desktop
)
install(FILES ${META_PROJECT_NAME}.desktop DESTINATION "share/kservices5" COMPONENT desktop)

View File

@ -18,24 +18,17 @@ set(HEADER_FILES
syncthingdownloadmodel.h
syncthingstatusselectionmodel.h
syncthingicons.h
colors.h
)
colors.h)
set(SRC_FILES
syncthingmodel.cpp
syncthingdirectorymodel.cpp
syncthingdevicemodel.cpp
syncthingdownloadmodel.cpp
syncthingstatusselectionmodel.cpp
syncthingicons.cpp
)
set(RES_FILES
resources/${META_PROJECT_NAME}icons.qrc
)
syncthingicons.cpp)
set(RES_FILES resources/${META_PROJECT_NAME}icons.qrc)
set(TS_FILES
translations/${META_PROJECT_NAME}_de_DE.ts
translations/${META_PROJECT_NAME}_en_US.ts
)
set(TS_FILES translations/${META_PROJECT_NAME}_de_DE.ts translations/${META_PROJECT_NAME}_en_US.ts)
# find c++utilities
find_package(c++utilities 4.0.0 REQUIRED)
@ -50,7 +43,11 @@ find_package(syncthingconnector ${META_APP_VERSION} REQUIRED)
use_syncthingconnector()
# link also explicitely against the following Qt 5 modules
list(APPEND ADDITIONAL_QT_MODULES Network Gui Widgets Svg)
list(APPEND ADDITIONAL_QT_MODULES
Network
Gui
Widgets
Svg)
# include modules to apply configuration
include(BasicConfig)

View File

@ -1,15 +1,7 @@
# source files
set(HEADER_FILES
syncthingapplet.h
settingsdialog.h
)
set(SRC_FILES
syncthingapplet.cpp
settingsdialog.cpp
)
set(WIDGETS_UI_FILES
appearanceoptionpage.ui
)
set(HEADER_FILES syncthingapplet.h settingsdialog.h)
set(SRC_FILES syncthingapplet.cpp settingsdialog.cpp)
set(WIDGETS_UI_FILES appearanceoptionpage.ui)
set(PLASMOID_FILES
../package/metadata.desktop
../package/contents/ui/CompactRepresentation.qml
@ -25,14 +17,10 @@ set(PLASMOID_FILES
../package/contents/ui/TinyButton.qml
../package/contents/ui/TinyButtonStyle.qml
../package/contents/ui/ButtonShadow.qml
../package/contents/ui/main.qml
)
../package/contents/ui/main.qml)
list(APPEND QML_SRC_FILES ${PLASMOID_FILES})
set(TS_FILES
../translations/${META_PROJECT_NAME}_de_DE.ts
../translations/${META_PROJECT_NAME}_en_US.ts
)
set(TS_FILES ../translations/${META_PROJECT_NAME}_de_DE.ts ../translations/${META_PROJECT_NAME}_en_US.ts)
# find c++utilities
find_package(c++utilities 4.10.0 REQUIRED)
@ -45,9 +33,11 @@ use_qt_utilities()
# check whether qtutilities supports DBus notifications
get_target_property(QT_UTILITIES_COMPILE_DEFINITIONS ${QT_UTILITIES_LIB} INTERFACE_COMPILE_DEFINITIONS)
list(FIND QT_UTILITIES_COMPILE_DEFINITIONS QT_UTILITIES_SUPPORT_DBUS_NOTIFICATIONS QT_UTILITIES_SUPPORT_DBUS_NOTIFICATIONS)
if(QT_UTILITIES_SUPPORT_DBUS_NOTIFICATIONS LESS 0)
message(FATAL_ERROR "The provided build of Qt Utilities does not support D-Bus notifications which is required for the Plasmoid.")
endif()
if (QT_UTILITIES_SUPPORT_DBUS_NOTIFICATIONS LESS 0)
message(
FATAL_ERROR
"The provided build of Qt Utilities does not support D-Bus notifications which is required for the Plasmoid.")
endif ()
# find backend libraries
find_package(syncthingconnector ${META_APP_VERSION} REQUIRED)

View File

@ -12,23 +12,13 @@ set(META_TEST_TARGET_IS_MANUAL ON)
set(META_ADD_DEFAULT_CPP_UNIT_TEST_APPLICATION OFF)
# add project files
set(HEADER_FILES
helper.h
syncthingtestinstance.h
)
set(SRC_FILES
helper.cpp
syncthingtestinstance.cpp
)
set(HEADER_FILES helper.h syncthingtestinstance.h)
set(SRC_FILES helper.cpp syncthingtestinstance.cpp)
set(TEST_HEADER_FILES
)
set(TEST_SRC_FILES
tests/manualtesting.cpp
)
set(TEST_HEADER_FILES)
set(TEST_SRC_FILES tests/manualtesting.cpp)
set(TS_FILES
)
set(TS_FILES)
# find c++utilities
find_package(c++utilities 4.16.0 REQUIRED)
@ -57,8 +47,9 @@ include(Doxygen)
include(ConfigHeader)
# exclude the targets from 'all' target so it is only built when tests are built
foreach(TESTHELPER_TARGET "${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}" "${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}_static")
if(TARGET "${TESTHELPER_TARGET}")
foreach (TESTHELPER_TARGET "${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}"
"${TARGET_PREFIX}${META_PROJECT_NAME}${TARGET_SUFFIX}_static")
if (TARGET "${TESTHELPER_TARGET}")
set_target_properties("${TESTHELPER_TARGET}" PROPERTIES EXCLUDE_FROM_ALL ON)
endif()
endforeach()
endif ()
endforeach ()

View File

@ -17,8 +17,7 @@ set(WIDGETS_HEADER_FILES
gui/downloaditemdelegate.h
gui/dirview.h
gui/devview.h
gui/downloadview.h
)
gui/downloadview.h)
set(WIDGETS_SRC_FILES
application/main.cpp
application/singleinstance.cpp
@ -30,29 +29,17 @@ set(WIDGETS_SRC_FILES
gui/downloaditemdelegate.cpp
gui/dirview.cpp
gui/devview.cpp
gui/downloadview.cpp
)
set(RES_FILES
resources/${META_PROJECT_NAME}icons.qrc
)
set(WIDGETS_UI_FILES
gui/traywidget.ui
)
gui/downloadview.cpp)
set(RES_FILES resources/${META_PROJECT_NAME}icons.qrc)
set(WIDGETS_UI_FILES gui/traywidget.ui)
set(TS_FILES
translations/${META_PROJECT_NAME}_de_DE.ts
translations/${META_PROJECT_NAME}_en_US.ts
)
set(TS_FILES translations/${META_PROJECT_NAME}_de_DE.ts translations/${META_PROJECT_NAME}_en_US.ts)
set(ICON_FILES
resources/icons/hicolor/scalable/app/${META_PROJECT_NAME}.svg
)
set(ICON_FILES resources/icons/hicolor/scalable/app/${META_PROJECT_NAME}.svg)
set(PNG_ICON_PATH "${CMAKE_CURRENT_SOURCE_DIR}/resources/icons/hicolor/scalable/app/${META_PROJECT_NAME}.png")
set(PNG_ICON_NO_CROP ON)
set(DOC_FILES
README.md
)
set(DOC_FILES README.md)
set(REQUIRED_ICONS
dialog-cancel
@ -89,10 +76,8 @@ set(REQUIRED_ICONS
text-plain
view-barcode
view-refresh
window-close
)
# fallback icons can not replace built-in Breeze icons (yet)
#set(FALLBACK_ICON_THEME breeze)
window-close)
# fallback icons can not replace built-in Breeze icons (yet) set(FALLBACK_ICON_THEME breeze)
# find c++utilities
find_package(c++utilities 4.11.0 REQUIRED)

View File

@ -23,8 +23,7 @@ set(WIDGETS_HEADER_FILES
misc/internalerror.h
misc/otherdialogs.h
misc/syncthinglauncher.h
misc/syncthingkiller.h
)
misc/syncthingkiller.h)
set(WIDGETS_SRC_FILES
settings/settings.cpp
settings/settingsdialog.cpp
@ -40,11 +39,8 @@ set(WIDGETS_SRC_FILES
misc/internalerror.cpp
misc/otherdialogs.cpp
misc/syncthinglauncher.cpp
misc/syncthingkiller.cpp
)
set(RES_FILES
resources/${META_PROJECT_NAME}icons.qrc
)
misc/syncthingkiller.cpp)
set(RES_FILES resources/${META_PROJECT_NAME}icons.qrc)
set(WIDGETS_UI_FILES
settings/connectionoptionpage.ui
settings/notificationsoptionpage.ui
@ -52,13 +48,9 @@ set(WIDGETS_UI_FILES
settings/autostartoptionpage.ui
settings/launcheroptionpage.ui
settings/systemdoptionpage.ui
settings/webviewoptionpage.ui
)
settings/webviewoptionpage.ui)
set(TS_FILES
translations/${META_PROJECT_NAME}_de_DE.ts
translations/${META_PROJECT_NAME}_en_US.ts
)
set(TS_FILES translations/${META_PROJECT_NAME}_de_DE.ts translations/${META_PROJECT_NAME}_en_US.ts)
set(REQUIRED_ICONS
preferences-other
@ -75,8 +67,7 @@ set(REQUIRED_ICONS
network-connect
emblem-remove
go-down
go-up
)
go-up)
# find c++utilities
find_package(c++utilities 4.6.0 REQUIRED)
@ -94,24 +85,18 @@ use_syncthingmodel()
# configure libsyncthing
option(USE_LIBSYNCTHING "whether libsyncthing should be included for the launcher" OFF)
if(USE_LIBSYNCTHING)
if (USE_LIBSYNCTHING)
find_package(syncthing ${META_APP_VERSION} REQUIRED)
use_syncthing()
set_source_files_properties(
misc/syncthinglauncher.cpp
PROPERTIES COMPILE_DEFINITIONS SYNCTHINGWIDGETS_USE_LIBSYNCTHING
)
endif()
set_source_files_properties(misc/syncthinglauncher.cpp PROPERTIES COMPILE_DEFINITIONS SYNCTHINGWIDGETS_USE_LIBSYNCTHING)
endif ()
# configure logging JavaScript events to stderr
option(SYNCTHING_WIDGETS_LOG_JAVASCRIPT_CONSOLE "enables logging JavaScript events of webview to stderr" OFF)
if(SYNCTHING_WIDGETS_LOG_JAVASCRIPT_CONSOLE)
set_property(
SOURCE webview/webpage.cpp
APPEND PROPERTY COMPILE_DEFINITIONS SYNCTHINGWIDGETS_LOG_JAVASCRIPT_CONSOLE
)
if (SYNCTHING_WIDGETS_LOG_JAVASCRIPT_CONSOLE)
set_property(SOURCE webview/webpage.cpp APPEND PROPERTY COMPILE_DEFINITIONS SYNCTHINGWIDGETS_LOG_JAVASCRIPT_CONSOLE)
message(WARNING "JavaScript console of web view will be logged to stderr")
endif()
endif ()
# link also explicitely against the following Qt 5 modules
list(APPEND ADDITIONAL_QT_MODULES Network Concurrent)