Skip to content

Commit

Permalink
fix build of xattr vfs plugin and the automated tests
Browse files Browse the repository at this point in the history
Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
  • Loading branch information
mgallien committed Jun 25, 2021
1 parent ad47fd8 commit 9f168ba
Show file tree
Hide file tree
Showing 8 changed files with 70 additions and 42 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.6)
cmake_minimum_required(VERSION 3.16)
set(CMAKE_CXX_STANDARD 14)

project(client)
Expand Down
2 changes: 1 addition & 1 deletion src/libsync/vfs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# that create directories for the build.
#file(GLOB VIRTUAL_FILE_SYSTEM_PLUGINS RELATIVE ${CMAKE_CURRENT_LIST_DIR} "*")

list(APPEND VIRTUAL_FILE_SYSTEM_PLUGINS "suffix" "cfapi")
list(APPEND VIRTUAL_FILE_SYSTEM_PLUGINS "suffix" "cfapi" "xattr")

message("list of plugins ${VIRTUAL_FILE_SYSTEM_PLUGINS}")

Expand Down
4 changes: 2 additions & 2 deletions src/libsync/vfs/cfapi/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
if (WIN32)
add_definitions(-D_WIN32_WINNT=_WIN32_WINNT_WIN10)

include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})

add_library("${synclib_NAME}_vfs_cfapi" SHARED
cfapiwrapper.cpp
hydrationjob.cpp
Expand All @@ -21,6 +19,8 @@ if (WIN32)
AUTOMOC TRUE
)

target_include_directories("${synclib_NAME}_vfs_cfapi" BEFORE PUBLIC ${CMAKE_CURRENT_BINARY_DIR} INTERFACE ${CMAKE_BINARY_DIR})

if(APPLE)
# for being loadable when client run from build dir
set(vfs_buildoutputdir "${BIN_OUTPUT_DIRECTORY}/${OWNCLOUD_OSX_BUNDLE}/Contents/PlugIns/")
Expand Down
79 changes: 44 additions & 35 deletions src/libsync/vfs/xattr/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,41 +1,50 @@
set(vfs_xattr_SRCS vfs_xattr.cpp)
if (APPLE)
set(vfs_xattr_SRCS ${vfs_xattr_SRCS} xattrwrapper_mac.cpp)
else()
set(vfs_xattr_SRCS ${vfs_xattr_SRCS} xattrwrapper_linux.cpp)
endif()

add_library("${synclib_NAME}_vfs_xattr" SHARED
${vfs_xattr_SRCS}
)
if (UNIX)
set(vfs_xattr_SRCS vfs_xattr.cpp)
if (APPLE)
set(vfs_xattr_SRCS ${vfs_xattr_SRCS} xattrwrapper_mac.cpp)
else()
set(vfs_xattr_SRCS ${vfs_xattr_SRCS} xattrwrapper_linux.cpp)
endif()

target_link_libraries("${synclib_NAME}_vfs_xattr"
"${synclib_NAME}"
)
add_library("${synclib_NAME}_vfs_xattr" SHARED
${vfs_xattr_SRCS}
)

set_target_properties("${synclib_NAME}_vfs_xattr" PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${BIN_OUTPUT_DIRECTORY}
RUNTIME_OUTPUT_DIRECTORY ${BIN_OUTPUT_DIRECTORY}
PREFIX ""
AUTOMOC TRUE
)
target_link_libraries("${synclib_NAME}_vfs_xattr"
"${synclib_NAME}"
)

if(APPLE)
# for being loadable when client run from build dir
set(vfs_buildoutputdir "${BIN_OUTPUT_DIRECTORY}/${OWNCLOUD_OSX_BUNDLE}/Contents/PlugIns/")
set_target_properties("${synclib_NAME}_vfs_xattr"
PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${vfs_buildoutputdir}
RUNTIME_OUTPUT_DIRECTORY ${vfs_buildoutputdir}
set_target_properties("${synclib_NAME}_vfs_xattr" PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${BIN_OUTPUT_DIRECTORY}
RUNTIME_OUTPUT_DIRECTORY ${BIN_OUTPUT_DIRECTORY}
PREFIX ""
AUTOMOC TRUE
)
# For being lodable when client run from install dir (after make macdeployqt)
set(vfs_installdir "${LIB_INSTALL_DIR}/../PlugIns")
else()
set(vfs_installdir "${PLUGINDIR}")
endif()

INSTALL(TARGETS "${synclib_NAME}_vfs_xattr"
LIBRARY DESTINATION "${vfs_installdir}"
RUNTIME DESTINATION "${vfs_installdir}"
)
target_include_directories("${synclib_NAME}_vfs_xattr" BEFORE PUBLIC ${CMAKE_CURRENT_BINARY_DIR} INTERFACE ${CMAKE_CURRENT_BINARY_DIR})

if(APPLE)
# for being loadable when client run from build dir
set(vfs_buildoutputdir "${BIN_OUTPUT_DIRECTORY}/${OWNCLOUD_OSX_BUNDLE}/Contents/PlugIns/")
set_target_properties("${synclib_NAME}_vfs_xattr"
PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${vfs_buildoutputdir}
RUNTIME_OUTPUT_DIRECTORY ${vfs_buildoutputdir}
)
# For being lodable when client run from install dir (after make macdeployqt)
set(vfs_installdir "${LIB_INSTALL_DIR}/../PlugIns")
else()
set(vfs_installdir "${PLUGINDIR}")
endif()

GENERATE_EXPORT_HEADER( "${synclib_NAME}_vfs_xattr"
BASE_NAME "${synclib_NAME}_vfs_xattr"
EXPORT_MACRO_NAME NEXTCLOUD_XATTR_EXPORT
EXPORT_FILE_NAME xattrexport.h
)

INSTALL(TARGETS "${synclib_NAME}_vfs_xattr"
LIBRARY DESTINATION "${vfs_installdir}"
RUNTIME DESTINATION "${vfs_installdir}"
)
endif()
2 changes: 0 additions & 2 deletions src/libsync/vfs/xattr/vfs_xattr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,5 +182,3 @@ void VfsXAttr::fileStatusChanged(const QString &, SyncFileStatus)
}

} // namespace OCC

OCC_DEFINE_VFS_FACTORY("xattr", OCC::VfsXAttr)
8 changes: 8 additions & 0 deletions src/libsync/vfs/xattr/vfs_xattr.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <QScopedPointer>

#include "common/vfs.h"
#include "common/plugin.h"

namespace OCC {

Expand Down Expand Up @@ -58,4 +59,11 @@ public slots:
void startImpl(const VfsSetupParams &params) override;
};

class XattrVfsPluginFactory : public QObject, public DefaultPluginFactory<VfsXAttr>
{
Q_OBJECT
Q_PLUGIN_METADATA(IID "org.owncloud.PluginFactory" FILE "vfspluginmetadata.json")
Q_INTERFACES(OCC::PluginFactory)
};

} // namespace OCC
2 changes: 2 additions & 0 deletions src/libsync/vfs/xattr/xattrwrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
#include "owncloudlib.h"
#include "common/result.h"

#include "xattrexport.h"

namespace OCC {

namespace XAttrWrapper
Expand Down
13 changes: 12 additions & 1 deletion test/nextcloud_add_test.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,22 @@ macro(nextcloud_add_test test_class)
testutils
nextcloudCore
cmdCore
"${synclib_NAME}_vfs_cfapi"
Qt5::Test
Qt5::Quick
)

if (WIN32)
target_link_libraries(${OWNCLOUD_TEST_CLASS}Test
"${synclib_NAME}_vfs_cfapi"
)
endif()

if (UNIX)
target_link_libraries(${OWNCLOUD_TEST_CLASS}Test
"${synclib_NAME}_vfs_xattr"
)
endif()

IF(BUILD_UPDATER)
target_link_libraries(${OWNCLOUD_TEST_CLASS}Test
updater
Expand Down

0 comments on commit 9f168ba

Please sign in to comment.