You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
falk-werner_webfuse/CMakeLists.txt

278 lines
7.6 KiB

cmake_minimum_required (VERSION 3.10)
project(fuse-wsfs VERSION 0.1.0 DESCRIPTION "Websocket filesystem based on libfuse")
6 years ago
option(WITHOUT_TESTS "disable unit tests" OFF)
option(WITHOUT_EXAMPLE "disable example" OFF)
6 years ago
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
find_package(PkgConfig REQUIRED)
pkg_check_modules(FUSE3 REQUIRED fuse3)
pkg_check_modules(LWS REQUIRED libwebsockets)
pkg_check_modules(JANSSON REQUIRED jansson)
add_definitions(-D_FILE_OFFSET_BITS=64)
6 years ago
set(CMAKE_C_STANDARD 99)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
6 years ago
set(C_WARNINGS -Wall -Wextra)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
6 years ago
set(EXTRA_INCLUDE_DIRS
"include"
6 years ago
${FUSE3_INCLUDE_DIRS}
${LWS_INCLUDE_DIRS}
${JANSSON_INCLUDE_DIRS}
)
set(EXTRA_LIBS
${EXTRA_LIBS}
${FUSE3_LIBRARIES}
${LWS_LIBRARIES}
${JANSSON_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
)
set(EXTRA_CFLAGS
6 years ago
${C_WARNINGS}
6 years ago
${FUSE3_CFLAGS_OTHER}
${LWS_CFLAGS_OTHER}
${JANSSON_CFLAGS_OTHER}
"-pthread"
)
# libwsfs-common
6 years ago
set(WSFS_COMMON_SOURCES
lib/wsfs/message.c
lib/wsfs/message_queue.c
lib/wsfs/status.c
)
6 years ago
install(FILES include/wsfs/status.h DESTINATION include/wsfs)
# libwsfs-adapter
set(WSFS_ADAPTER_SOURCES
lib/wsfs/adapter/filesystem.c
lib/wsfs/adapter/server.c
Feature/authentication (#14) * makes wsfs_server_config opaque * feature: try to create mount point, if not present * fixes server start failure due to existing mountpoint * added basic authentication infrastructure * makes wsfs_server_config opaque * feature: try to create mount point, if not present * fixes server start failure due to existing mountpoint * added basic authentication infrastructure * added unit tests for credentials * added unit tests for authenticators * propagates authenticators to server protocol * enabled username authentication in daemon example * adds example to compute password hash * adds infrastructure to execute commands * added userdb to encapsulate authentication stuff * adds session and session_manager * fixes warning about unused param * moves some logic from server_protocol to session * makes wsfs_server_config opaque * feature: try to create mount point, if not present * fixes server start failure due to existing mountpoint * added basic authentication infrastructure * makes wsfs_server_config opaque * added unit tests for credentials * added unit tests for authenticators * propagates authenticators to server protocol * enabled username authentication in daemon example * adds example to compute password hash * adds infrastructure to execute commands * added userdb to encapsulate authentication stuff * adds session and session_manager * fixes warning about unused param * moves some logic from server_protocol to session * updates libcrypto to version 1.1.0
6 years ago
lib/wsfs/adapter/server_config.c
lib/wsfs/adapter/server_protocol.c
lib/wsfs/adapter/session.c
lib/wsfs/adapter/session_manager.c
lib/wsfs/adapter/authenticator.c
lib/wsfs/adapter/authenticators.c
lib/wsfs/adapter/credentials.c
lib/wsfs/adapter/time/timepoint.c
lib/wsfs/adapter/time/timer.c
lib/wsfs/adapter/time/timeout_manager.c
lib/wsfs/adapter/operation/lookup.c
lib/wsfs/adapter/operation/getattr.c
lib/wsfs/adapter/operation/readdir.c
lib/wsfs/adapter/operation/open.c
lib/wsfs/adapter/operation/close.c
lib/wsfs/adapter/operation/read.c
lib/wsfs/adapter/jsonrpc/server.c
lib/wsfs/adapter/jsonrpc/method.c
lib/wsfs/adapter/jsonrpc/request.c
lib/wsfs/adapter/jsonrpc/response.c
lib/wsfs/adapter/jsonrpc/util.c
6 years ago
)
add_library(wsfs-adapter SHARED ${WSFS_ADAPTER_SOURCES} ${WSFS_COMMON_SOURCES})
set_target_properties(wsfs-adapter PROPERTIES VERSION ${PROJECT_VERSION})
set_target_properties(wsfs-adapter PROPERTIES SOVERSION 0)
set_target_properties(wsfs-adapter PROPERTIES C_VISIBILITY_PRESET hidden)
set_target_properties(wsfs-adapter PROPERTIES COMPILE_DEFINITIONS "WSFSA_API=WSFSA_EXPORT")
target_include_directories(wsfs-adapter PUBLIC lib ${EXTRA_INCLUDE_DIRS})
target_compile_options(wsfs-adapter PUBLIC ${EXTRA_CFLAGS})
6 years ago
file(WRITE "${PROJECT_BINARY_DIR}/libwsfs-adapter.pc"
"prefix=\"${CMAKE_INSTALL_PREFIX}\"
exec_prefix=\${prefix}
libdir=\${exec_prefix}/lib${LIB_SUFFIX}
includedir=\${prefix}/include
Name: libwsfs
Description: Websockets filesystem server library
Version: ${PROJECT_VERSION}
Libs: -L\${libdir} -lwsfs-adapter -l${FUSE3_LIBRARIES} -l${LWS_LIBRARIES} -l${JANSSON_LIBRARIES}
Cflags: -I\${includedir}"
)
install(TARGETS wsfs-adapter DESTINATION lib${LIB_SUFFIX})
install(FILES include/wsfs_adapter.h DESTINATION include)
install(DIRECTORY include/wsfs/adapter DESTINATION include/wsfs)
install(FILES "${PROJECT_BINARY_DIR}/libwsfs-adapter.pc" DESTINATION lib${LIB_SUFFIX}/pkgconfig)
#libwsfs-provider
set(WSFS_PROVIDER_SOURCES
lib/wsfs/provider/url.c
lib/wsfs/provider/client.c
lib/wsfs/provider/client_config.c
lib/wsfs/provider/client_protocol.c
lib/wsfs/provider/provider.c
lib/wsfs/provider/request.c
lib/wsfs/provider/dirbuffer.c
lib/wsfs/provider/operation/lookup.c
lib/wsfs/provider/operation/getattr.c
lib/wsfs/provider/operation/readdir.c
lib/wsfs/provider/operation/open.c
lib/wsfs/provider/operation/close.c
lib/wsfs/provider/operation/read.c
)
add_library(wsfs-provider SHARED ${WSFS_PROVIDER_SOURCES} ${WSFS_COMMON_SOURCES})
set_target_properties(wsfs-provider PROPERTIES VERSION ${PROJECT_VERSION})
set_target_properties(wsfs-provider PROPERTIES SOVERSION 0)
set_target_properties(wsfs-provider PROPERTIES C_VISIBILITY_PRESET hidden)
set_target_properties(wsfs-provider PROPERTIES COMPILE_DEFINITIONS "WSFSP_API=WSFSP_EXPORT")
target_include_directories(wsfs-provider PUBLIC lib ${EXTRA_INCLUDE_DIRS})
target_compile_options(wsfs-provider PUBLIC ${EXTRA_CFLAGS})
file(WRITE "${PROJECT_BINARY_DIR}/libwsfs-provider.pc"
"prefix=\"${CMAKE_INSTALL_PREFIX}\"
exec_prefix=\${prefix}
libdir=\${exec_prefix}/lib${LIB_SUFFIX}
includedir=\${prefix}/include
Name: libwsfs-provider
Description: Provider library for websockets filesystem
Version: ${PROJECT_VERSION}
Libs: -L\${libdir} -lwsfs-provider -l${LWS_LIBRARIES} -l${JANSSON_LIBRARIES}
Cflags: -I\${includedir}"
)
install(TARGETS wsfs-provider DESTINATION lib${LIB_SUFFIX})
install(FILES include/wsfs_provider.h DESTINATION include)
install(DIRECTORY include/wsfs/provider DESTINATION include/wsfs)
install(FILES "${PROJECT_BINARY_DIR}/libwsfs-provider.pc" DESTINATION lib${LIB_SUFFIX}/pkgconfig)
# examples
6 years ago
if(NOT WITHOUT_EXAMPLE)
Feature/authentication (#14) * makes wsfs_server_config opaque * feature: try to create mount point, if not present * fixes server start failure due to existing mountpoint * added basic authentication infrastructure * makes wsfs_server_config opaque * feature: try to create mount point, if not present * fixes server start failure due to existing mountpoint * added basic authentication infrastructure * added unit tests for credentials * added unit tests for authenticators * propagates authenticators to server protocol * enabled username authentication in daemon example * adds example to compute password hash * adds infrastructure to execute commands * added userdb to encapsulate authentication stuff * adds session and session_manager * fixes warning about unused param * moves some logic from server_protocol to session * makes wsfs_server_config opaque * feature: try to create mount point, if not present * fixes server start failure due to existing mountpoint * added basic authentication infrastructure * makes wsfs_server_config opaque * added unit tests for credentials * added unit tests for authenticators * propagates authenticators to server protocol * enabled username authentication in daemon example * adds example to compute password hash * adds infrastructure to execute commands * added userdb to encapsulate authentication stuff * adds session and session_manager * fixes warning about unused param * moves some logic from server_protocol to session * updates libcrypto to version 1.1.0
6 years ago
# libuserdb
add_library(userdb STATIC
example/lib/userdb/src/userdb.c
)
target_include_directories(userdb PUBLIC
example/lib/userdb/include
${OPENSSL_INCLUDE_DIRS}
${JANSSON_INCLUDE_DIRS}
)
target_compile_options(userdb PUBLIC
${C_WARNINGS}
${OPENSSL_CFLAGS_OTHER}
${JANSSON_CFLAGS_OTHER}
)
# daemon
add_executable(wsfsd
example/daemon/main.c
6 years ago
)
target_link_libraries(wsfsd PUBLIC wsfs-adapter ${EXTRA_LIBS})
target_include_directories(wsfsd PUBLIC ${EXTRA_INCLUDE_DIRS})
target_compile_options(wsfsd PUBLIC ${EXTRA_CFLAGS})
6 years ago
# provider
add_executable(wsfs-provider-app
example/provider/main.c
)
set_target_properties(wsfs-provider-app PROPERTIES OUTPUT_NAME wsfs-provider)
target_link_libraries(wsfs-provider-app PUBLIC wsfs-provider ${EXTRA_LIBS})
target_include_directories(wsfs-provider-app PUBLIC ${EXTRA_INCLUDE_DIRS})
target_compile_options(wsfs-provider-app PUBLIC ${EXTRA_CFLAGS})
Feature/authentication (#14) * makes wsfs_server_config opaque * feature: try to create mount point, if not present * fixes server start failure due to existing mountpoint * added basic authentication infrastructure * makes wsfs_server_config opaque * feature: try to create mount point, if not present * fixes server start failure due to existing mountpoint * added basic authentication infrastructure * added unit tests for credentials * added unit tests for authenticators * propagates authenticators to server protocol * enabled username authentication in daemon example * adds example to compute password hash * adds infrastructure to execute commands * added userdb to encapsulate authentication stuff * adds session and session_manager * fixes warning about unused param * moves some logic from server_protocol to session * makes wsfs_server_config opaque * feature: try to create mount point, if not present * fixes server start failure due to existing mountpoint * added basic authentication infrastructure * makes wsfs_server_config opaque * added unit tests for credentials * added unit tests for authenticators * propagates authenticators to server protocol * enabled username authentication in daemon example * adds example to compute password hash * adds infrastructure to execute commands * added userdb to encapsulate authentication stuff * adds session and session_manager * fixes warning about unused param * moves some logic from server_protocol to session * updates libcrypto to version 1.1.0
6 years ago
# wsfs-passwd
pkg_check_modules(OPENSSL REQUIRED openssl)
add_executable(wsfs-passwd
example/passwd/main.c
)
target_link_libraries(wsfs-passwd PUBLIC
userdb
${OPENSSL_LIBRARIES}
${JANSSON_LIBRARIES}
)
target_include_directories(wsfs-passwd PUBLIC
example/passwd
example/lib/userdb/include
${OPENSSL_INCLUDE_DIRS}
${JANSSON_INCLUDE_DIRS}
)
target_compile_options(wsfs-passwd PUBLIC
${C_WARNINGS}
${OPENSSL_CFLAGS_OTHER}
${JANSSON_CFLAGS_OTHER}
)
endif(NOT WITHOUT_EXAMPLE)
6 years ago
# tests
if(NOT WITHOUT_TESTS)
include (CTest)
pkg_check_modules(GTEST gtest_main)
include(GoogleTest)
Feature/authentication (#14) * makes wsfs_server_config opaque * feature: try to create mount point, if not present * fixes server start failure due to existing mountpoint * added basic authentication infrastructure * makes wsfs_server_config opaque * feature: try to create mount point, if not present * fixes server start failure due to existing mountpoint * added basic authentication infrastructure * added unit tests for credentials * added unit tests for authenticators * propagates authenticators to server protocol * enabled username authentication in daemon example * adds example to compute password hash * adds infrastructure to execute commands * added userdb to encapsulate authentication stuff * adds session and session_manager * fixes warning about unused param * moves some logic from server_protocol to session * makes wsfs_server_config opaque * feature: try to create mount point, if not present * fixes server start failure due to existing mountpoint * added basic authentication infrastructure * makes wsfs_server_config opaque * added unit tests for credentials * added unit tests for authenticators * propagates authenticators to server protocol * enabled username authentication in daemon example * adds example to compute password hash * adds infrastructure to execute commands * added userdb to encapsulate authentication stuff * adds session and session_manager * fixes warning about unused param * moves some logic from server_protocol to session * updates libcrypto to version 1.1.0
6 years ago
pkg_check_modules(GMOCK gmock)
add_library(wsfs-adapter-static STATIC ${WSFS_ADAPTER_SOURCES})
set_target_properties(wsfs-adapter-static PROPERTIES OUTPUT_NAME wsfs-adapter)
target_include_directories(wsfs-adapter-static PUBLIC lib ${EXTRA_INCLUDE_DIRS})
target_compile_options(wsfs-adapter-static PUBLIC ${EXTRA_CFLAGS})
add_library(wsfs-provider-static STATIC ${WSFS_PROVIDER_SOURCES})
set_target_properties(wsfs-provider-static PROPERTIES OUTPUT_NAME wsfs-provider)
target_include_directories(wsfs-provider-static PUBLIC lib ${EXTRA_INCLUDE_DIRS})
target_compile_options(wsfs-provider-static PUBLIC ${EXTRA_CFLAGS})
6 years ago
add_executable(alltests
test/msleep.cc
Feature/authentication (#14) * makes wsfs_server_config opaque * feature: try to create mount point, if not present * fixes server start failure due to existing mountpoint * added basic authentication infrastructure * makes wsfs_server_config opaque * feature: try to create mount point, if not present * fixes server start failure due to existing mountpoint * added basic authentication infrastructure * added unit tests for credentials * added unit tests for authenticators * propagates authenticators to server protocol * enabled username authentication in daemon example * adds example to compute password hash * adds infrastructure to execute commands * added userdb to encapsulate authentication stuff * adds session and session_manager * fixes warning about unused param * moves some logic from server_protocol to session * makes wsfs_server_config opaque * feature: try to create mount point, if not present * fixes server start failure due to existing mountpoint * added basic authentication infrastructure * makes wsfs_server_config opaque * added unit tests for credentials * added unit tests for authenticators * propagates authenticators to server protocol * enabled username authentication in daemon example * adds example to compute password hash * adds infrastructure to execute commands * added userdb to encapsulate authentication stuff * adds session and session_manager * fixes warning about unused param * moves some logic from server_protocol to session * updates libcrypto to version 1.1.0
6 years ago
test/mock_authenticator.cc
test/test_response_parser.cc
test/test_server.cc
test/test_timepoint.cc
test/test_timer.cc
test/test_url.cc
Feature/authentication (#14) * makes wsfs_server_config opaque * feature: try to create mount point, if not present * fixes server start failure due to existing mountpoint * added basic authentication infrastructure * makes wsfs_server_config opaque * feature: try to create mount point, if not present * fixes server start failure due to existing mountpoint * added basic authentication infrastructure * added unit tests for credentials * added unit tests for authenticators * propagates authenticators to server protocol * enabled username authentication in daemon example * adds example to compute password hash * adds infrastructure to execute commands * added userdb to encapsulate authentication stuff * adds session and session_manager * fixes warning about unused param * moves some logic from server_protocol to session * makes wsfs_server_config opaque * feature: try to create mount point, if not present * fixes server start failure due to existing mountpoint * added basic authentication infrastructure * makes wsfs_server_config opaque * added unit tests for credentials * added unit tests for authenticators * propagates authenticators to server protocol * enabled username authentication in daemon example * adds example to compute password hash * adds infrastructure to execute commands * added userdb to encapsulate authentication stuff * adds session and session_manager * fixes warning about unused param * moves some logic from server_protocol to session * updates libcrypto to version 1.1.0
6 years ago
test/test_credentials.cc
test/test_authenticator.cc
test/test_authenticators.cc
${WSFS_COMMON_SOURCES}
6 years ago
)
Feature/authentication (#14) * makes wsfs_server_config opaque * feature: try to create mount point, if not present * fixes server start failure due to existing mountpoint * added basic authentication infrastructure * makes wsfs_server_config opaque * feature: try to create mount point, if not present * fixes server start failure due to existing mountpoint * added basic authentication infrastructure * added unit tests for credentials * added unit tests for authenticators * propagates authenticators to server protocol * enabled username authentication in daemon example * adds example to compute password hash * adds infrastructure to execute commands * added userdb to encapsulate authentication stuff * adds session and session_manager * fixes warning about unused param * moves some logic from server_protocol to session * makes wsfs_server_config opaque * feature: try to create mount point, if not present * fixes server start failure due to existing mountpoint * added basic authentication infrastructure * makes wsfs_server_config opaque * added unit tests for credentials * added unit tests for authenticators * propagates authenticators to server protocol * enabled username authentication in daemon example * adds example to compute password hash * adds infrastructure to execute commands * added userdb to encapsulate authentication stuff * adds session and session_manager * fixes warning about unused param * moves some logic from server_protocol to session * updates libcrypto to version 1.1.0
6 years ago
target_link_libraries(alltests PUBLIC wsfs-adapter-static wsfs-provider-static ${EXTRA_LIBS} ${GMOCK_LIBRARIES} ${GTEST_LIBRARIES})
target_include_directories(alltests PUBLIC lib ${EXTRA_INCLUDE_DIRS} ${GMOCK_INCLUDE_DIRS} ${GTEST_INCLUDE_DIRS})
target_compile_options(alltests PUBLIC ${EXTRA_CFLAGS} ${GMOCK_CFLAGS} ${GTEST_CFLAGS})
enable_testing()
gtest_discover_tests(alltests TEST_PREFIX alltests:)
6 years ago
endif(NOT WITHOUT_TESTS)