diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index aef7498..0000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,63 +0,0 @@ -cmake_minimum_required (VERSION 3.10) -project(webfuse VERSION 0.4.0 DESCRIPTION "Websocket filesystem based on libfuse") - -option(WITHOUT_TESTS "disable unit tests" OFF) -option(WITHOUT_ADAPTER "disable adapter library" OFF) -option(WITHOUT_PROVIDER "disable provider library" OFF) - -set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_SOURCE_DIR}/cmake") -include(coverage) - -set(THREADS_PREFER_PTHREAD_FLAG ON) -find_package(Threads REQUIRED) - -find_package(PkgConfig REQUIRED) -pkg_check_modules(LWS REQUIRED libwebsockets) -pkg_check_modules(JANSSON REQUIRED jansson) - -add_definitions(-D_FILE_OFFSET_BITS=64) - -set(CMAKE_C_STANDARD 99) -set(CMAKE_CXX_STANDARD 14) -set(CMAKE_CXX_STANDARD_REQUIRED ON) - -set(C_WARNINGS -Wall -Wextra -Werror) -set(CMAKE_POSITION_INDEPENDENT_CODE ON) - -include_directories( - "include" - ${LWS_INCLUDE_DIRS} - ${JANSSON_INCLUDE_DIRS} -) - -add_compile_options( - ${C_WARNINGS} - ${LWS_CFLAGS_OTHER} - ${JANSSON_CFLAGS_OTHER} - "-pthread" -) - -include(webfuse_core) -include(webfuse_adapter) -include(webfuse_provider) -include(unit_tests) - -set(CPACK_SOURCE_GENERATOR "TGZ") -set(CPACK_GENERATOR "DEB") -set(CPACK_PACKAGE_VERSION_MAJOR "${PROJECT_VERSION_MAJOR}") -set(CPACK_PACKAGE_VERSION_MINOR "${PROJECT_VERSION_MINOR}") -set(CPACK_PACKAGE_VERSION_PATCH "${PROJECT_VERSION_PATCH}") -set(CPACK_DESCRIPTION "Websocket filesystem based on libfuse") -#set(CPACK_COMPONENTS_ALL libraries) -set(CPACK_DEB_COMPONENT_INSTALL ON) -set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Falk Werner") -set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON) - -set(CPACK_DEBIAN_LIBRARIES_FILE_NAME "webfuse_${PROJECT_VERSION}_${CMAKE_SYSTEM_NAME}.deb") -set(CPACK_DEBIAN_LIBRARIES_PACKAGE_NAME "webfuse") - -set(CPACK_DEBIAN_HEADERS_FILE_NAME "webfuse-dev_${PROJECT_VERSION}_${CMAKE_SYSTEM_NAME}.deb") -set(CPACK_DEBIAN_HEADERS_PACKAGE_NAME "webfuse-dev") -set(CPACK_DEBIAN_HEADERS_PACKAGE_DEPENDS "webfuse") - -include(CPack) \ No newline at end of file diff --git a/changelog.md b/changelog.md index cc9a9dd..51379dc 100644 --- a/changelog.md +++ b/changelog.md @@ -2,6 +2,10 @@ ## 0.4.0 _(unknown)_ +### Breaking Changes + +* Remove CMake support (change build system to meson) + ### Fixes * Fix meson build failure when gtest or jansson are not installed diff --git a/cmake/coverage.cmake b/cmake/coverage.cmake deleted file mode 100644 index 4660d6a..0000000 --- a/cmake/coverage.cmake +++ /dev/null @@ -1,30 +0,0 @@ -set(CMAKE_C_FLAGS_COVERAGE - "${CMAKE_C_FLAGS_DEBUG} -pg --coverage -fprofile-arcs -ftest-coverage" - CACHE STRING "Flags used by the C compiler during coverage builds" - FORCE -) - -set(CMAKE_CXX_FLAGS_COVERAGE - "${CMAKE_CXX_FLAGS_DEBUG} -pg --coverage -fprofile-arcs -ftest-coverage" - CACHE STRING "Flags used by the C++ compiler during coverage builds." - FORCE -) - -set(CMAKE_EXE_LINKER_FLAGS_COVERAGE - "" - CACHE STRING "Flags used for linking binaries during coverage builds." - FORCE -) - -set(CMAKE_SHARED_LINKER_FLAGS_COVERAGE - "" - CACHE STRING "Flags used by the shared libraries linker during coverage builds." - FORCE -) - -mark_as_advanced( - CMAKE_C_FLAGS_COVERAGE - CMAKE_CXX_FLAGS_COVERAGE - CMAKE_EXE_LINKER_FLAGS_COVERAGE - CMAKE_SHARED_LINKER_FLAGS_COVERAGE -) diff --git a/cmake/unit_tests.cmake b/cmake/unit_tests.cmake deleted file mode 100644 index 60023ee..0000000 --- a/cmake/unit_tests.cmake +++ /dev/null @@ -1,136 +0,0 @@ -if(NOT WITHOUT_TESTS AND NOT WITHOUT_ADAPTER AND NOT WITHOUT_PROVIDER) - -set(MEMORYCHECK_COMMAND_OPTIONS "--leak-check=full --error-exitcode=1") -include (CTest) - -add_executable(fs_check - test/webfuse/tests/integration/fs_check.c -) - -pkg_check_modules(GTEST gtest_main) -include(GoogleTest) -pkg_check_modules(GMOCK gmock) - -add_executable(alltests - test/webfuse/tests/core/jsonrpc/mock_timer_callback.cc - test/webfuse/tests/core/jsonrpc/mock_timer.cc - test/webfuse/tests/core/jsonrpc/test_is_request.cc - test/webfuse/tests/core/jsonrpc/test_request.cc - test/webfuse/tests/core/jsonrpc/test_is_response.cc - test/webfuse/tests/core/jsonrpc/test_response.cc - test/webfuse/tests/core/jsonrpc/test_server.cc - test/webfuse/tests/core/jsonrpc/test_proxy.cc - test/webfuse/tests/core/jsonrpc/test_response_parser.cc - test/webfuse/tests/core/timer/test_timepoint.cc - test/webfuse/tests/core/timer/test_timer.cc - test/webfuse/utils/tempdir.cc - test/webfuse/utils/file_utils.cc - test/webfuse/utils/timeout_watcher.cc - test/webfuse/utils/path.c - test/webfuse/utils/static_filesystem.c - test/webfuse/utils/ws_server.cc - test/webfuse/mocks/fake_invokation_context.cc - test/webfuse/mocks/mock_authenticator.cc - test/webfuse/mocks/mock_request.cc - test/webfuse/mocks/mock_provider_client.cc - test/webfuse/mocks/mock_provider.cc - test/webfuse/mocks/mock_fuse.cc - test/webfuse/mocks/mock_operation_context.cc - test/webfuse/mocks/mock_jsonrpc_proxy.cc - test/webfuse//tests/core/test_util.cc - test/webfuse/tests/core/test_container_of.cc - test/webfuse/tests/core/test_string.cc - test/webfuse/tests/core/test_slist.cc - test/webfuse/tests/core/test_base64.cc - test/webfuse/tests/core/test_status.cc - test/webfuse/tests/core/test_message.cc - test/webfuse/tests/core/test_message_queue.cc - test/webfuse/tests/adapter/test_server.cc - test/webfuse/tests/adapter/test_server_config.cc - test/webfuse/tests/adapter/test_credentials.cc - test/webfuse/tests/adapter/test_authenticator.cc - test/webfuse/tests/adapter/test_authenticators.cc - test/webfuse/tests/adapter/test_mountpoint.cc - test/webfuse/tests/adapter/test_fuse_req.cc - test/webfuse/tests/adapter/operation/test_context.cc - test/webfuse/tests/adapter/operation/test_open.cc - test/webfuse/tests/adapter/operation/test_close.cc - test/webfuse/tests/adapter/operation/test_read.cc - test/webfuse/tests/adapter/operation/test_readdir.cc - test/webfuse/tests/adapter/operation/test_getattr.cc - test/webfuse/tests/adapter/operation/test_lookup.cc - test/webfuse/tests/provider/test_url.cc - test/webfuse/tests/provider/test_client_protocol.cc - test/webfuse/tests/provider/operation/test_close.cc - test/webfuse/tests/provider/operation/test_getattr.cc - test/webfuse/tests/provider/operation/test_lookup.cc - test/webfuse/tests/provider/operation/test_open.cc - test/webfuse/tests/provider/operation/test_read.cc - test/webfuse/tests/provider/operation/test_readdir.cc - test/webfuse/tests/integration/test_lowlevel.cc - test/webfuse/tests/integration/test_integration.cc - test/webfuse/tests/integration/file.cc - test/webfuse/tests/integration/server.cc - test/webfuse/tests/integration/provider.cc -) - -target_link_libraries(alltests PUBLIC - -Wl,--wrap=wf_timer_manager_create - -Wl,--wrap=wf_timer_manager_dispose - -Wl,--wrap=wf_timer_manager_check - -Wl,--wrap=wf_timer_create - -Wl,--wrap=wf_timer_dispose - -Wl,--wrap=wf_timer_start - -Wl,--wrap=wf_timer_cancel - -Wl,--wrap=wf_impl_operation_context_get_proxy - -Wl,--wrap=wf_jsonrpc_proxy_vinvoke - -Wl,--wrap=wf_jsonrpc_proxy_vnotify - -Wl,--wrap=fuse_req_userdata - -Wl,--wrap=fuse_reply_open - -Wl,--wrap=fuse_reply_err - -Wl,--wrap=fuse_reply_buf - -Wl,--wrap=fuse_reply_attr - -Wl,--wrap=fuse_reply_entry - -Wl,--wrap=fuse_req_ctx - - webfuse-adapter-static - webfuse-provider-static - webfuse-core - ${FUSE3_LIBRARIES} - ${LWS_LIBRARIES} - ${JANSSON_LIBRARIES} - ${CMAKE_THREAD_LIBS_INIT} - ${GMOCK_LIBRARIES} - ${GTEST_LIBRARIES} -) - -target_include_directories(alltests PUBLIC test lib ${FUSE3_INCLUDE_DIRS} ${GMOCK_INCLUDE_DIRS} ${GTEST_INCLUDE_DIRS}) -target_compile_options(alltests PUBLIC ${FUSE3_CFLAGS_OTHER} ${GMOCK_CFLAGS} ${GTEST_CFLAGS}) - -add_custom_command(OUTPUT server-key.pem - COMMAND openssl req -x509 -newkey rsa:4096 -keyout server-key.pem -out server-cert.pem -days 365 -nodes -batch -subj '/CN=localhost' - COMMAND openssl req -x509 -newkey rsa:4096 -keyout client-key.pem -out client-cert.pem -days 365 -nodes -batch -subj '/CN=localhost' -) - -add_custom_target(gen-tls DEPENDS server-key.pem) -add_dependencies(alltests gen-tls) - -enable_testing() -gtest_discover_tests(alltests TEST_PREFIX alltests:) - -add_custom_target(coverage - mkdir -p coverage - COMMAND lcov --initial --capture --directory . --output-file coverage/lcov_base.info --rc lcov_branch_coverage=1 - COMMAND ./alltests - COMMAND lcov --capture --directory . --output-file coverage/lcov.info --rc lcov_branch_coverage=1 - COMMAND lcov --remove coverage/lcov.info '/usr/*' --output-file coverage/lcov.info --rc lcov_branch_coverage=1 - COMMAND lcov --remove coverage/lcov.info '*/test/*' --output-file coverage/lcov.info --rc lcov_branch_coverage=1 -) -add_dependencies(coverage alltests) - -add_custom_target(coverage-report - COMMAND genhtml --branch-coverage --highlight --legend coverage/lcov.info --output-directory coverage/report -) -add_dependencies(coverage-report coverage) - -endif(NOT WITHOUT_TESTS AND NOT WITHOUT_ADAPTER AND NOT WITHOUT_PROVIDER) diff --git a/cmake/webfuse_adapter.cmake b/cmake/webfuse_adapter.cmake deleted file mode 100644 index b15b655..0000000 --- a/cmake/webfuse_adapter.cmake +++ /dev/null @@ -1,79 +0,0 @@ -if(NOT WITHOUT_ADAPTER) - -pkg_check_modules(FUSE3 REQUIRED fuse3) - -add_library(webfuse-adapter-static STATIC - lib/webfuse/adapter/api.c - lib/webfuse/adapter/impl/filesystem.c - lib/webfuse/adapter/impl/server.c - lib/webfuse/adapter/impl/server_config.c - lib/webfuse/adapter/impl/server_protocol.c - lib/webfuse/adapter/impl/session.c - lib/webfuse/adapter/impl/session_manager.c - lib/webfuse/adapter/impl/authenticator.c - lib/webfuse/adapter/impl/authenticators.c - lib/webfuse/adapter/impl/credentials.c - lib/webfuse/adapter/impl/mountpoint.c - lib/webfuse/adapter/impl/mountpoint_factory.c - lib/webfuse/adapter/impl/operation/context.c - lib/webfuse/adapter/impl/operation/lookup.c - lib/webfuse/adapter/impl/operation/getattr.c - lib/webfuse/adapter/impl/operation/readdir.c - lib/webfuse/adapter/impl/operation/open.c - lib/webfuse/adapter/impl/operation/close.c - lib/webfuse/adapter/impl/operation/read.c -) - -target_include_directories(webfuse-adapter-static PRIVATE - lib - ${FUSE3_INCLUDE_DIRS} -) - -target_compile_options(webfuse-adapter-static PUBLIC - ${FUSE3_CFLAGS_OTHER} -) - -set_target_properties(webfuse-adapter-static PROPERTIES OUTPUT_NAME webfuse-adapter) -set_target_properties(webfuse-adapter-static PROPERTIES C_VISIBILITY_PRESET hidden) - -add_library(webfuse-adapter SHARED - lib/webfuse/adapter/api.c -) - -target_include_directories(webfuse-adapter PRIVATE - ${FUSE3_INCLUDE_DIRS} -) - -target_compile_options(webfuse-adapter PUBLIC - ${FUSE3_CFLAGS_OTHER} -) - - -set_target_properties(webfuse-adapter PROPERTIES VERSION ${PROJECT_VERSION}) -set_target_properties(webfuse-adapter PROPERTIES SOVERSION 0) -set_target_properties(webfuse-adapter PROPERTIES C_VISIBILITY_PRESET hidden) -set_target_properties(webfuse-adapter PROPERTIES COMPILE_DEFINITIONS "WF_API=WF_EXPORT") - -target_link_libraries(webfuse-adapter PRIVATE webfuse-adapter-static webfuse-core) - -file(WRITE "${PROJECT_BINARY_DIR}/libwebfuse-adapter.pc" -"prefix=\"${CMAKE_INSTALL_PREFIX}\" - -exec_prefix=\${prefix} -libdir=\${exec_prefix}/lib${LIB_SUFFIX} -includedir=\${prefix}/include -Name: libwebfuse -Description: Websockets filesystem server library -Version: ${PROJECT_VERSION} - -Libs: -L\${libdir} -lwebfuse-adapter -l${FUSE3_LIBRARIES} -l${LWS_LIBRARIES} -l${JANSSON_LIBRARIES} -Cflags: -I\${includedir}" -) - -install(TARGETS webfuse-adapter DESTINATION lib${LIB_SUFFIX} COMPONENT libraries) -install(FILES "${PROJECT_BINARY_DIR}/libwebfuse-adapter.pc" DESTINATION lib${LIB_SUFFIX}/pkgconfig COMPONENT libraries) - -install(FILES include/webfuse_adapter.h DESTINATION include COMPONENT headers) -install(DIRECTORY include/webfuse/adapter DESTINATION include/webfuse COMPONENT headers) - -endif(NOT WITHOUT_ADAPTER) diff --git a/cmake/webfuse_core.cmake b/cmake/webfuse_core.cmake deleted file mode 100644 index c0b1b88..0000000 --- a/cmake/webfuse_core.cmake +++ /dev/null @@ -1,29 +0,0 @@ -# libwebfuse-core - -add_library(webfuse-core STATIC - lib/webfuse/core/slist.c - lib/webfuse/core/message.c - lib/webfuse/core/message_queue.c - lib/webfuse/core/status.c - lib/webfuse/core/string.c - lib/webfuse/core/base64.c - lib/webfuse/core/lws_log.c - lib/webfuse/core/json_util.c - lib/webfuse/core/timer/manager.c - lib/webfuse/core/timer/timepoint.c - lib/webfuse/core/timer/timer.c - lib/webfuse/core/jsonrpc/proxy.c - lib/webfuse/core/jsonrpc/proxy_variadic.c - lib/webfuse/core/jsonrpc/server.c - lib/webfuse/core/jsonrpc/method.c - lib/webfuse/core/jsonrpc/request.c - lib/webfuse/core/jsonrpc/response.c - lib/webfuse/core/jsonrpc/error.c - -) - -set_target_properties(webfuse-core PROPERTIES OUTPUT_NAME webfuse-core) -target_include_directories(webfuse-core PUBLIC lib lib/wf/jsonrpc/include) -set_target_properties(webfuse-core PROPERTIES C_VISIBILITY_PRESET hidden) - -install(DIRECTORY include/webfuse/core DESTINATION include/webfuse COMPONENT headers) diff --git a/cmake/webfuse_provider.cmake b/cmake/webfuse_provider.cmake deleted file mode 100644 index fbfa104..0000000 --- a/cmake/webfuse_provider.cmake +++ /dev/null @@ -1,58 +0,0 @@ -if(NOT WITHOUT_PROVIDER) - -add_library(webfuse-provider-static STATIC - lib/webfuse/provider/api.c - lib/webfuse/provider/impl/url.c - lib/webfuse/provider/impl/client.c - lib/webfuse/provider/impl/client_config.c - lib/webfuse/provider/impl/client_protocol.c - lib/webfuse/provider/impl/provider.c - lib/webfuse/provider/impl/request.c - lib/webfuse/provider/impl/dirbuffer.c - lib/webfuse/provider/impl/credentials.c - lib/webfuse/provider/impl/operation/lookup.c - lib/webfuse/provider/impl/operation/getattr.c - lib/webfuse/provider/impl/operation/readdir.c - lib/webfuse/provider/impl/operation/open.c - lib/webfuse/provider/impl/operation/close.c - lib/webfuse/provider/impl/operation/read.c -) - -set_target_properties(webfuse-provider-static PROPERTIES OUTPUT_NAME webfuse-provider) -set_target_properties(webfuse-provider-static PROPERTIES C_VISIBILITY_PRESET hidden) -target_include_directories(webfuse-provider-static PRIVATE - lib -) - -add_library(webfuse-provider SHARED - lib/webfuse/provider/api.c -) - -set_target_properties(webfuse-provider PROPERTIES VERSION ${PROJECT_VERSION}) -set_target_properties(webfuse-provider PROPERTIES SOVERSION 0) -set_target_properties(webfuse-provider PROPERTIES C_VISIBILITY_PRESET hidden) -set_target_properties(webfuse-provider PROPERTIES COMPILE_DEFINITIONS "WFP_API=WFP_EXPORT") - -target_include_directories(webfuse-provider PUBLIC lib) -target_link_libraries(webfuse-provider PRIVATE webfuse-provider-static webfuse-core) - -file(WRITE "${PROJECT_BINARY_DIR}/libwebfuse-provider.pc" -"prefix=\"${CMAKE_INSTALL_PREFIX}\" -exec_prefix=\${prefix} -libdir=\${exec_prefix}/lib${LIB_SUFFIX} -includedir=\${prefix}/include -Name: libwebfuse-provider -Description: Provider library for websockets filesystem -Version: ${PROJECT_VERSION} - -Libs: -L\${libdir} -lwebfuse-provider -l${LWS_LIBRARIES} -l${JANSSON_LIBRARIES} -Cflags: -I\${includedir}" -) - -install(TARGETS webfuse-provider DESTINATION lib${LIB_SUFFIX} COMPONENT libraries) -install(FILES "${PROJECT_BINARY_DIR}/libwebfuse-provider.pc" DESTINATION lib${LIB_SUFFIX}/pkgconfig COMPONENT libraries) - -install(FILES include/webfuse_provider.h DESTINATION include COMPONENT headers) -install(DIRECTORY include/webfuse/provider DESTINATION include/webfuse COMPONENT headers) - -endif(NOT WITHOUT_PROVIDER) diff --git a/doc/build.md b/doc/build.md index a100114..18ff474 100644 --- a/doc/build.md +++ b/doc/build.md @@ -1,39 +1,13 @@ # Build Instructions -To install dependencies, see below. - - cd webfuse - mkdir .build - cd .build - cmake .. - make - -## Build options - -By default, unit tests are enabled. You can disable them using the following cmake options: - -- **WITHOUT_TESTS**: disable tests - `cmake -DWITHOUT_TESTS=ON ..` - -Since webfuse consists of two libraries, it is possible to disable one of them -in order to reduce build dependencies. -*Note that unit tests are only available, when both libraries are built.* - -- **WITHOUT_ADAPTER**: omit adapter library - `cmake -DWITHOUT_ADAPTER=ON` - -- **WIHTOUT_PROVIDER**: omit provider library - `cmake -DWITHOUT_PROVIDER=ON` - -## Build using Meson (experimental) - -_Note: Meson build support is experimental. Do not rely on it._ +To build webfuse from source, meson is needed. +Please refer to [meson quick guide](https://mesonbuild.com/Quick-guide.html) for setup instructions. meson .build cd .build ninja build -### Meson Build options +## Build options Build options can be specified during meson setup or later via meson configure. @@ -72,8 +46,6 @@ After that, you will find the API documentation in the doc/api subdirectory. #### libfuse -To install libfuse, meson is needed. Please refer to [meson quick guide](https://mesonbuild.com/Quick-guide.html) for setup instructions. - wget -O fuse-3.9.1.tar.gz https://github.com/libfuse/libfuse/archive/fuse-3.9.1.tar.gz tar -xf fuse-3.9.1.tar.gz cd libfuse-fuse-3.9.1