2022-11-12 10:34:51 +00:00
|
|
|
cmake_minimum_required(VERSION 3.10)
|
|
|
|
project(webfuse VERSION 2.0.0)
|
|
|
|
|
2023-01-07 17:55:06 +00:00
|
|
|
option(WITHOUT_PROVIDER "Disabled build of webfuse provider" OFF)
|
2023-01-06 15:50:32 +00:00
|
|
|
option(WITHOUT_TEST "Disables unit and integration tests" OFF)
|
|
|
|
option(WITHOUT_CLANG_TIDY "Disables clang tidy" OFF)
|
|
|
|
|
2022-11-13 13:22:11 +00:00
|
|
|
set (CMAKE_CXX_STANDARD 17)
|
|
|
|
|
2022-11-12 11:29:30 +00:00
|
|
|
find_package(PkgConfig REQUIRED)
|
|
|
|
pkg_check_modules(FUSE REQUIRED IMPORTED_TARGET fuse3)
|
|
|
|
pkg_check_modules(LWS REQUIRED IMPORTED_TARGET libwebsockets)
|
|
|
|
|
2023-01-04 21:05:39 +00:00
|
|
|
configure_file(src/webfuse/version.cpp.in version.cpp)
|
|
|
|
|
2022-11-12 11:29:30 +00:00
|
|
|
add_library(webfuse_static STATIC
|
2023-01-04 21:05:39 +00:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/version.cpp
|
2022-11-13 13:17:47 +00:00
|
|
|
src/webfuse/webfuse.cpp
|
2022-12-30 18:44:55 +00:00
|
|
|
src/webfuse/provider.cpp
|
2022-11-13 17:18:44 +00:00
|
|
|
src/webfuse/fuse.cpp
|
2022-12-30 22:06:47 +00:00
|
|
|
src/webfuse/request_type.cpp
|
|
|
|
src/webfuse/response_type.cpp
|
2023-01-14 18:48:41 +00:00
|
|
|
src/webfuse/util/commandline_args.cpp
|
|
|
|
src/webfuse/util/commandline_reader.cpp
|
2023-01-15 13:55:31 +00:00
|
|
|
src/webfuse/util/authenticator.cpp
|
2022-11-14 18:02:46 +00:00
|
|
|
src/webfuse/filesystem.cpp
|
2022-11-13 13:17:47 +00:00
|
|
|
src/webfuse/filesystem/status.cpp
|
|
|
|
src/webfuse/filesystem/accessmode.cpp
|
|
|
|
src/webfuse/filesystem/openflags.cpp
|
|
|
|
src/webfuse/filesystem/filemode.cpp
|
2022-11-13 17:18:44 +00:00
|
|
|
src/webfuse/filesystem/filesystem_statistics.cpp
|
|
|
|
src/webfuse/filesystem/empty_filesystem.cpp
|
2022-11-13 21:22:35 +00:00
|
|
|
src/webfuse/ws/config.cpp
|
|
|
|
src/webfuse/ws/server.cpp
|
2022-12-30 18:44:55 +00:00
|
|
|
src/webfuse/ws/client.cpp
|
2022-11-20 12:29:34 +00:00
|
|
|
src/webfuse/ws/messagewriter.cpp
|
|
|
|
src/webfuse/ws/messagereader.cpp
|
2023-01-14 22:58:22 +00:00
|
|
|
src/webfuse/ws/url.cpp
|
2022-11-13 13:17:47 +00:00
|
|
|
)
|
2022-11-12 11:29:30 +00:00
|
|
|
|
|
|
|
target_include_directories(webfuse_static PUBLIC src)
|
|
|
|
target_link_libraries(webfuse_static PUBLIC PkgConfig::FUSE PkgConfig::LWS)
|
|
|
|
|
2023-01-06 15:50:32 +00:00
|
|
|
if(NOT(WITHOUT_CLANG_TIDY))
|
|
|
|
set_property(
|
|
|
|
TARGET webfuse_static
|
2023-01-06 16:10:56 +00:00
|
|
|
PROPERTY CXX_CLANG_TIDY clang-tidy -checks=readability-*,-readability-identifier-length -warnings-as-errors=*)
|
2023-01-06 15:50:32 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
|
2023-01-07 17:55:06 +00:00
|
|
|
add_executable(webfuse src/main.cpp)
|
2022-11-12 11:29:30 +00:00
|
|
|
target_link_libraries(webfuse PRIVATE webfuse_static)
|
2023-01-07 17:55:06 +00:00
|
|
|
install(TARGETS webfuse DESTINATION bin)
|
2022-11-12 11:29:30 +00:00
|
|
|
|
2022-12-30 18:44:55 +00:00
|
|
|
|
2023-01-07 17:55:06 +00:00
|
|
|
if(NOT(WITHOUT_PROVIDER))
|
2022-12-30 18:44:55 +00:00
|
|
|
|
2023-01-07 17:55:06 +00:00
|
|
|
add_executable(webfuse_provider src/provider_main.cpp)
|
2022-12-30 18:44:55 +00:00
|
|
|
target_link_libraries(webfuse_provider PRIVATE webfuse_static)
|
2023-01-07 17:55:06 +00:00
|
|
|
install(TARGETS webfuse_provider DESTINATION bin)
|
2022-12-30 18:44:55 +00:00
|
|
|
|
|
|
|
endif()
|
|
|
|
|
2022-11-12 11:29:30 +00:00
|
|
|
if(NOT(WITHOUT_TEST))
|
|
|
|
|
2022-11-12 12:32:13 +00:00
|
|
|
pkg_check_modules(GTEST REQUIRED gtest_main)
|
|
|
|
pkg_check_modules(GMOCK REQUIRED gmock)
|
2022-11-12 11:29:30 +00:00
|
|
|
|
2023-01-01 12:01:35 +00:00
|
|
|
add_executable(unit_tests
|
|
|
|
test-src/unit/webfuse/test_app.cpp
|
|
|
|
test-src/unit/webfuse/test_request_type.cpp
|
|
|
|
test-src/unit/webfuse/test_response_type.cpp
|
|
|
|
test-src/unit/webfuse/filesystem/test_status.cpp
|
|
|
|
test-src/unit/webfuse/filesystem/test_accessmode.cpp
|
|
|
|
test-src/unit/webfuse/filesystem/test_openflags.cpp
|
|
|
|
test-src/unit/webfuse/filesystem/test_filemode.cpp
|
2022-11-12 11:29:30 +00:00
|
|
|
)
|
|
|
|
|
2023-01-01 12:01:35 +00:00
|
|
|
target_include_directories(unit_tests PRIVATE test-src/unit ${GTEST_INCLUDE_DIRS} ${GMOCK_INCLUDE_DIRS})
|
|
|
|
target_compile_options(unit_tests PRIVATE
|
2022-11-12 12:32:13 +00:00
|
|
|
${GTEST_CFLAGS} ${GTEST_CFLAGS_OTHER}
|
|
|
|
${GMOCK_CFLAGS} ${GMOCK_CFLAGS_OTHER}
|
|
|
|
)
|
2023-01-01 12:01:35 +00:00
|
|
|
target_link_libraries(unit_tests PRIVATE webfuse_static ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES})
|
|
|
|
|
|
|
|
add_executable(integration_tests
|
|
|
|
test-src/integration/webfuse/test/tempdir.cpp
|
|
|
|
test-src/integration/webfuse/test/fixture.cpp
|
|
|
|
test-src/integration/webfuse/test/process.cpp
|
|
|
|
test-src/integration/webfuse/test/daemon.cpp
|
|
|
|
test-src/integration/test_access.cpp
|
2023-01-01 13:48:19 +00:00
|
|
|
test-src/integration/test_readdir.cpp
|
2023-01-01 15:22:44 +00:00
|
|
|
test-src/integration/test_readlink.cpp
|
2023-01-01 16:05:42 +00:00
|
|
|
test-src/integration/test_symlink.cpp
|
2023-01-01 16:45:39 +00:00
|
|
|
test-src/integration/test_link.cpp
|
2023-01-01 18:15:38 +00:00
|
|
|
test-src/integration/test_rename.cpp
|
2023-01-01 18:44:10 +00:00
|
|
|
test-src/integration/test_chmod.cpp
|
2023-01-01 18:50:29 +00:00
|
|
|
test-src/integration/test_chown.cpp
|
2023-01-02 17:27:44 +00:00
|
|
|
test-src/integration/test_truncate.cpp
|
2023-01-02 18:47:29 +00:00
|
|
|
test-src/integration/test_fsync.cpp
|
2023-01-02 19:18:19 +00:00
|
|
|
test-src/integration/test_utimens.cpp
|
2023-01-03 18:55:27 +00:00
|
|
|
test-src/integration/test_open.cpp
|
2023-01-03 19:42:07 +00:00
|
|
|
test-src/integration/test_mknod.cpp
|
2023-01-03 19:56:07 +00:00
|
|
|
test-src/integration/test_unlink.cpp
|
2023-01-03 20:38:33 +00:00
|
|
|
test-src/integration/test_read.cpp
|
2023-01-04 18:24:14 +00:00
|
|
|
test-src/integration/test_write.cpp
|
2023-01-04 18:33:01 +00:00
|
|
|
test-src/integration/test_mkdir.cpp
|
2023-01-04 18:43:57 +00:00
|
|
|
test-src/integration/test_rmdir.cpp
|
2023-01-04 19:51:57 +00:00
|
|
|
test-src/integration/test_statfs.cpp
|
2023-01-01 12:01:35 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
target_include_directories(integration_tests PRIVATE test-src/integration ${GTEST_INCLUDE_DIRS} ${GMOCK_INCLUDE_DIRS})
|
|
|
|
target_compile_options(integration_tests PRIVATE
|
|
|
|
${GTEST_CFLAGS} ${GTEST_CFLAGS_OTHER}
|
|
|
|
${GMOCK_CFLAGS} ${GMOCK_CFLAGS_OTHER}
|
|
|
|
)
|
|
|
|
target_link_libraries(integration_tests PRIVATE webfuse_static ${GTEST_LIBRARIES} ${GMOCK_LIBRARIES})
|
2022-11-12 11:29:30 +00:00
|
|
|
|
|
|
|
enable_testing()
|
2023-01-01 12:01:35 +00:00
|
|
|
add_test(NAME unit_tests COMMAND unit_tests)
|
|
|
|
add_test(NAME integration_tests COMMAND integration_tests)
|
2022-11-12 11:29:30 +00:00
|
|
|
|
2022-11-12 12:32:13 +00:00
|
|
|
find_program(VALGRIND valgrind REQUIRED)
|
|
|
|
if(VALGRIND)
|
2023-01-01 12:01:35 +00:00
|
|
|
add_custom_target(memcheck COMMAND valgrind --leak-check=full --error-exitcode=1 ./unit_tests)
|
2022-11-12 12:32:13 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
endif()
|