1
0
mirror of https://github.com/falk-werner/webfuse-provider synced 2024-10-27 20:44:10 +00:00

changed build behavior: tests and example are enabled by default and can be disabled using cmake options

This commit is contained in:
Falk Werner 2019-02-15 16:16:24 +01:00
parent 66c60f3932
commit 95a0a4df59
3 changed files with 20 additions and 10 deletions

View File

@ -17,7 +17,7 @@ before_install:
before_script: before_script:
- mkdir .build - mkdir .build
- cd .build - cd .build
- cmake -DCMAKE_BUILD_TYPE=Debug -DWITH_EXAMPLE=ON -DWITH_TESTS=ON .. - cmake -DCMAKE_BUILD_TYPE=Debug ..
script: script:
- make - make

View File

@ -1,8 +1,8 @@
cmake_minimum_required (VERSION 3.1) cmake_minimum_required (VERSION 3.1)
project(fuse-wsfs VERSION 0.1.0 DESCRIPTION "Websocket filesystem based on libfuse") project(fuse-wsfs VERSION 0.1.0 DESCRIPTION "Websocket filesystem based on libfuse")
option(WITH_TESTS "enable unit tests" OFF) option(WITHOUT_TESTS "disable unit tests" OFF)
option(WITH_EXAMPLE "enable example" OFF) option(WITHOUT_EXAMPLE "disable example" OFF)
set(THREADS_PREFER_PTHREAD_FLAG ON) set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED) find_package(Threads REQUIRED)
@ -98,7 +98,7 @@ install(FILES "${PROJECT_BINARY_DIR}/libfuse-wsfs.pc" DESTINATION lib${LIB_SUFFI
# app # app
if(WITH_EXAMPLE) if(NOT WITHOUT_EXAMPLE)
add_executable(wsfs add_executable(wsfs
example/main.c example/main.c
@ -108,11 +108,11 @@ target_link_libraries(wsfs PUBLIC fuse-wsfs ${EXTRA_LIBS})
target_include_directories(wsfs PUBLIC ${EXTRA_INCLUDE_DIRS}) target_include_directories(wsfs PUBLIC ${EXTRA_INCLUDE_DIRS})
target_compile_options(wsfs PUBLIC ${EXTRA_CFLAGS}) target_compile_options(wsfs PUBLIC ${EXTRA_CFLAGS})
endif(WITH_EXAMPLE) endif(NOT WITHOUT_EXAMPLE)
# tests # tests
if(WITH_TESTS) if(NOT WITHOUT_TESTS)
pkg_check_modules(GTEST gtest_main) pkg_check_modules(GTEST gtest_main)
@ -139,4 +139,4 @@ target_compile_options(alltests PUBLIC ${EXTRA_CFLAGS} ${GTEST_CFLAGS})
enable_testing() enable_testing()
add_test(alltests alltests) add_test(alltests alltests)
endif(WITH_TESTS) endif(NOT WITHOUT_TESTS)

View File

@ -275,12 +275,22 @@ Read from an open file.
To install dependencies, see below. To install dependencies, see below.
cd fuse-wsfs cd fuse-wsfs
mkdir ./build mkdir .build
cd ./build cd .build
cmake -DWITH_EXAMPLE=ON .. cmake ..
mkdir test mkdir test
./wsfs -m test --document_root=../exmaple/www --port=4711 ./wsfs -m test --document_root=../exmaple/www --port=4711
### Build options
By default, unit tests and example application are enabled. You can disable them using the following cmake options:
- **WITHOUT_TESTS**: disable tests
`cmake -DWITHOUT_TESTS=ON ..`
- **WITHOUT_EXAMPLE**: disable example
`cmake -DWITHOUD_EXAMPLE=ON ..`
## Dependencies ## Dependencies
- [libfuse3](https://github.com/libfuse/libfuse/) - [libfuse3](https://github.com/libfuse/libfuse/)