Apply cmake-format and clang-format
This commit is contained in:
parent
d88df866d2
commit
a30853cfeb
|
@ -38,12 +38,7 @@ use_syncthingmodel()
|
|||
# link also explicitely against the following Qt and KF modules
|
||||
list(APPEND ADDITIONAL_QT_MODULES Network)
|
||||
list(APPEND ADDITIONAL_KF_MODULES KIO)
|
||||
set(KIO_MODULE_TARGETS
|
||||
KF5::KIOCore
|
||||
KF5::KIOFileWidgets
|
||||
KF5::KIOWidgets
|
||||
KF5::KIONTLM
|
||||
)
|
||||
set(KIO_MODULE_TARGETS KF5::KIOCore KF5::KIOFileWidgets KF5::KIOWidgets KF5::KIONTLM)
|
||||
|
||||
# include modules to apply configuration
|
||||
include(BasicConfig)
|
||||
|
|
|
@ -8,19 +8,11 @@ set(META_APP_DESCRIPTION "Syncthing itself, built as a shared or static library"
|
|||
set(META_PROJECT_VARNAME_UPPER LIB_SYNCTHING)
|
||||
|
||||
# add project files
|
||||
set(HEADER_FILES
|
||||
interface.h
|
||||
)
|
||||
set(SRC_FILES
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/libsyncthinginternal.h"
|
||||
interface.cpp
|
||||
)
|
||||
set(HEADER_FILES interface.h)
|
||||
set(SRC_FILES "${CMAKE_CURRENT_BINARY_DIR}/libsyncthinginternal.h" interface.cpp)
|
||||
|
||||
set(TEST_HEADER_FILES
|
||||
)
|
||||
set(TEST_SRC_FILES
|
||||
tests/interfacetests.cpp
|
||||
)
|
||||
set(TEST_HEADER_FILES)
|
||||
set(TEST_SRC_FILES tests/interfacetests.cpp)
|
||||
|
||||
# find the go binary
|
||||
find_program(GO_BIN go)
|
||||
|
@ -66,67 +58,51 @@ message(STATUS "Using GOOS=${GO_TARGET_OS} and GOARCH=${GO_TARGET_ARCH}")
|
|||
|
||||
# locate the Syncthing checkout
|
||||
set(GO_DEVELOPMENT_PATH "${CMAKE_CURRENT_SOURCE_DIR}/go" CACHE PATH "the 'GOPATH'")
|
||||
set(SYNCTHING_PATH "${CMAKE_CURRENT_SOURCE_DIR}/go/src/github.com/syncthing/syncthing" CACHE PATH "path of Syncthing checkout")
|
||||
set(SYNCTHING_PATH "${CMAKE_CURRENT_SOURCE_DIR}/go/src/github.com/syncthing/syncthing"
|
||||
CACHE PATH "path of Syncthing checkout")
|
||||
|
||||
# find Syncthing's assets
|
||||
# caveat: newly added assets will not cause CMake to automatically regenerate
|
||||
file(GLOB_RECURSE SRC_FILES_SYNCTHING_ASSETS
|
||||
LIST_DIRECTORIES false
|
||||
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
"${SYNCTHING_PATH}/gui/*"
|
||||
)
|
||||
# find Syncthing's assets caveat: newly added assets will not cause CMake to automatically regenerate
|
||||
file(GLOB_RECURSE SRC_FILES_SYNCTHING_ASSETS LIST_DIRECTORIES false
|
||||
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${SYNCTHING_PATH}/gui/*")
|
||||
if (NOT SRC_FILES_SYNCTHING_ASSETS)
|
||||
message(FATAL_ERROR "No asset files found in Syncthing checkout \"${CMAKE_CURRENT_SOURCE_DIR}/go/src/github.com/syncthing/syncthing\".")
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"No asset files found in Syncthing checkout \"${CMAKE_CURRENT_SOURCE_DIR}/go/src/github.com/syncthing/syncthing\"."
|
||||
)
|
||||
endif ()
|
||||
|
||||
# find Syncthing's source code
|
||||
# caveat: newly added files will not cause CMake to automatically regenerate
|
||||
file(GLOB_RECURSE SRC_FILES_SYNCTHING
|
||||
LIST_DIRECTORIES false
|
||||
# find Syncthing's source code caveat: newly added files will not cause CMake to automatically regenerate
|
||||
file(GLOB_RECURSE SRC_FILES_SYNCTHING LIST_DIRECTORIES false
|
||||
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
|
||||
"${SYNCTHING_PATH}/cmd/*.go"
|
||||
"${SYNCTHING_PATH}/cmd/*.h"
|
||||
"${SYNCTHING_PATH}/cmd/*.c"
|
||||
)
|
||||
"${SYNCTHING_PATH}/cmd/*.c")
|
||||
if (NOT SRC_FILES_SYNCTHING)
|
||||
message(FATAL_ERROR "No *.go files found in Syncthing checkout \"${CMAKE_CURRENT_SOURCE_DIR}/go/src/github.com/syncthing/syncthing\".")
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"No *.go files found in Syncthing checkout \"${CMAKE_CURRENT_SOURCE_DIR}/go/src/github.com/syncthing/syncthing\"."
|
||||
)
|
||||
endif ()
|
||||
list(APPEND SRC_FILES_SYNCTHING "${SYNCTHING_PATH}/lib/auto/gui.files.go")
|
||||
message(STATUS "Syncthing's go files: ${SRC_FILES_SYNCTHING}")
|
||||
|
||||
# generate Syncthing's assets: don't set GOARCH/GOOS here, this is supposed to run on the host
|
||||
add_custom_command(
|
||||
OUTPUT
|
||||
"${SYNCTHING_PATH}/lib/auto/gui.files.go"
|
||||
COMMAND
|
||||
"GOPATH=${GO_DEVELOPMENT_PATH}"
|
||||
"${GO_BIN}" run ./script/genassets.go gui > lib/auto/gui.files.go
|
||||
add_custom_command(OUTPUT "${SYNCTHING_PATH}/lib/auto/gui.files.go"
|
||||
COMMAND "GOPATH=${GO_DEVELOPMENT_PATH}" "${GO_BIN}" run ./script/genassets.go gui > lib/auto/gui.files.go
|
||||
DEPENDS ${SRC_FILES_SYNCTHING_ASSETS}
|
||||
WORKING_DIRECTORY "${SYNCTHING_PATH}"
|
||||
COMMENT "Building Syncthing's assets"
|
||||
)
|
||||
COMMENT "Building Syncthing's assets")
|
||||
|
||||
# compile Syncthing as static library
|
||||
add_custom_command(
|
||||
OUTPUT
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/libsyncthinginternal.a"
|
||||
add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/libsyncthinginternal.a"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/libsyncthinginternal.h"
|
||||
COMMAND
|
||||
"CC=${CMAKE_C_COMPILER}"
|
||||
"CXX=${CMAKE_CXX_COMPILER}"
|
||||
"AR=${CMAKE_C_COMPILER_AR}"
|
||||
"GOOS=${GO_TARGET_OS}"
|
||||
"GOARCH=${GO_TARGET_ARCH}"
|
||||
"CGO_ENABLED=1"
|
||||
"GOPATH=${GO_DEVELOPMENT_PATH}"
|
||||
"${GO_BIN}" build -v -buildmode c-archive
|
||||
-o "${CMAKE_CURRENT_BINARY_DIR}/libsyncthinginternal.a"
|
||||
./cmd/syncthing
|
||||
&& "${CMAKE_RANLIB}" "${CMAKE_CURRENT_BINARY_DIR}/libsyncthinginternal.a"
|
||||
COMMAND "CC=${CMAKE_C_COMPILER}" "CXX=${CMAKE_CXX_COMPILER}" "AR=${CMAKE_C_COMPILER_AR}"
|
||||
"GOOS=${GO_TARGET_OS}" "GOARCH=${GO_TARGET_ARCH}" "CGO_ENABLED=1" "GOPATH=${GO_DEVELOPMENT_PATH}"
|
||||
"${GO_BIN}" build -v -buildmode c-archive -o "${CMAKE_CURRENT_BINARY_DIR}/libsyncthinginternal.a"
|
||||
./cmd/syncthing && "${CMAKE_RANLIB}" "${CMAKE_CURRENT_BINARY_DIR}/libsyncthinginternal.a"
|
||||
DEPENDS ${SRC_FILES_SYNCTHING}
|
||||
WORKING_DIRECTORY "${SYNCTHING_PATH}"
|
||||
COMMENT "Building Syncthing itself"
|
||||
)
|
||||
COMMENT "Building Syncthing itself")
|
||||
|
||||
# do not use this library directly but depend on it
|
||||
list(APPEND PRIVATE_LIBRARIES "${CMAKE_CURRENT_BINARY_DIR}/libsyncthinginternal.a")
|
||||
|
@ -156,9 +132,7 @@ include(ConfigHeader)
|
|||
|
||||
# create install target for static libsyncthinginternal.a if we're also creating a static libsyncthing.a
|
||||
if (BUILD_STATIC_LIBS AND NOT META_NO_INSTALL_TARGETS AND ENABLE_INSTALL_TARGETS)
|
||||
install(
|
||||
FILES "${CMAKE_CURRENT_BINARY_DIR}/libsyncthinginternal.a"
|
||||
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/libsyncthinginternal.a"
|
||||
DESTINATION "lib${SELECTED_LIB_SUFFIX}"
|
||||
COMPONENT binary
|
||||
)
|
||||
COMPONENT binary)
|
||||
endif ()
|
||||
|
|
|
@ -306,7 +306,10 @@ QVariant SyncthingDeviceModel::data(const QModelIndex &index, int role) const
|
|||
|
||||
bool SyncthingDeviceModel::setData(const QModelIndex &index, const QVariant &value, int role)
|
||||
{
|
||||
Q_UNUSED(index) Q_UNUSED(value) Q_UNUSED(role) return false;
|
||||
Q_UNUSED(index)
|
||||
Q_UNUSED(value)
|
||||
Q_UNUSED(role)
|
||||
return false;
|
||||
}
|
||||
|
||||
int SyncthingDeviceModel::rowCount(const QModelIndex &parent) const
|
||||
|
|
|
@ -364,7 +364,10 @@ QVariant SyncthingDirectoryModel::data(const QModelIndex &index, int role) const
|
|||
|
||||
bool SyncthingDirectoryModel::setData(const QModelIndex &index, const QVariant &value, int role)
|
||||
{
|
||||
Q_UNUSED(index) Q_UNUSED(value) Q_UNUSED(role) return false;
|
||||
Q_UNUSED(index)
|
||||
Q_UNUSED(value)
|
||||
Q_UNUSED(role)
|
||||
return false;
|
||||
}
|
||||
|
||||
int SyncthingDirectoryModel::rowCount(const QModelIndex &parent) const
|
||||
|
|
|
@ -189,7 +189,10 @@ QVariant SyncthingDownloadModel::data(const QModelIndex &index, int role) const
|
|||
|
||||
bool SyncthingDownloadModel::setData(const QModelIndex &index, const QVariant &value, int role)
|
||||
{
|
||||
Q_UNUSED(index) Q_UNUSED(value) Q_UNUSED(role) return false;
|
||||
Q_UNUSED(index)
|
||||
Q_UNUSED(value)
|
||||
Q_UNUSED(role)
|
||||
return false;
|
||||
}
|
||||
|
||||
int SyncthingDownloadModel::rowCount(const QModelIndex &parent) const
|
||||
|
|
|
@ -161,7 +161,8 @@ public:
|
|||
#endif
|
||||
}
|
||||
// register own handler to detect whether signal has been emitted
|
||||
m_emittedConnection = QObject::connect(sender, signal, sender, [this] { m_signalEmitted = true; }, Qt::DirectConnection);
|
||||
m_emittedConnection = QObject::connect(
|
||||
sender, signal, sender, [this] { m_signalEmitted = true; }, Qt::DirectConnection);
|
||||
#ifndef SYNCTHINGTESTHELPER_FOR_CLI
|
||||
if (!m_emittedConnection) {
|
||||
CPPUNIT_FAIL(argsToString("Unable to connect signal ", signalName().data(), " to check for signal emmitation"));
|
||||
|
|
Loading…
Reference in New Issue