2019-03-03 14:14:32 +00:00
|
|
|
cmake_minimum_required (VERSION 3.10)
|
2019-04-27 10:34:45 +00:00
|
|
|
project(webfuse VERSION 0.2.0 DESCRIPTION "Websocket filesystem based on libfuse")
|
2019-01-27 02:45:03 +00:00
|
|
|
|
2019-05-25 01:18:25 +00:00
|
|
|
option(WITHOUT_TESTS "disable unit tests" OFF)
|
|
|
|
option(WITHOUT_EXAMPLE "disable example" OFF)
|
2019-12-01 10:01:00 +00:00
|
|
|
|
|
|
|
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_SOURCE_DIR}/cmake")
|
|
|
|
include(coverage)
|
2019-01-30 20:53:57 +00:00
|
|
|
|
2019-01-27 02:45:03 +00:00
|
|
|
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)
|
2019-04-17 20:51:16 +00:00
|
|
|
pkg_check_modules(UUID REQUIRED uuid)
|
2019-01-27 02:45:03 +00:00
|
|
|
|
2019-03-23 14:13:07 +00:00
|
|
|
add_definitions(-D_FILE_OFFSET_BITS=64)
|
|
|
|
|
2019-02-10 08:22:58 +00:00
|
|
|
set(CMAKE_C_STANDARD 99)
|
2019-12-01 10:05:50 +00:00
|
|
|
set(CMAKE_CXX_STANDARD 14)
|
2019-02-10 08:38:31 +00:00
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
|
2019-02-10 08:22:58 +00:00
|
|
|
set(C_WARNINGS -Wall -Wextra)
|
2019-02-25 20:28:31 +00:00
|
|
|
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
|
2019-01-27 02:45:03 +00:00
|
|
|
|
2019-04-27 07:49:43 +00:00
|
|
|
include_directories(
|
2019-02-10 13:19:15 +00:00
|
|
|
"include"
|
2019-01-27 02:45:03 +00:00
|
|
|
${FUSE3_INCLUDE_DIRS}
|
|
|
|
${LWS_INCLUDE_DIRS}
|
|
|
|
${JANSSON_INCLUDE_DIRS}
|
2019-04-17 20:51:16 +00:00
|
|
|
${UUID_INCLUDE_DIRS}
|
2019-01-27 02:45:03 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
set(EXTRA_LIBS
|
|
|
|
${EXTRA_LIBS}
|
|
|
|
${FUSE3_LIBRARIES}
|
|
|
|
${LWS_LIBRARIES}
|
|
|
|
${JANSSON_LIBRARIES}
|
2019-04-17 20:51:16 +00:00
|
|
|
${UUID_LIBRARIES}
|
2019-01-27 02:45:03 +00:00
|
|
|
${CMAKE_THREAD_LIBS_INIT}
|
|
|
|
)
|
|
|
|
|
2019-04-27 07:49:43 +00:00
|
|
|
add_compile_options(
|
2019-02-10 08:22:58 +00:00
|
|
|
${C_WARNINGS}
|
2019-01-27 02:45:03 +00:00
|
|
|
${FUSE3_CFLAGS_OTHER}
|
|
|
|
${LWS_CFLAGS_OTHER}
|
|
|
|
${JANSSON_CFLAGS_OTHER}
|
2019-04-17 20:51:16 +00:00
|
|
|
${UUID_CFLAGS_OTHER}
|
2019-01-27 02:45:03 +00:00
|
|
|
"-pthread"
|
|
|
|
)
|
|
|
|
|
2019-03-26 22:04:53 +00:00
|
|
|
# libwebfuse-core
|
2019-03-26 14:35:33 +00:00
|
|
|
|
2019-03-26 22:04:53 +00:00
|
|
|
add_library(webfuse-core STATIC
|
2019-04-17 20:51:16 +00:00
|
|
|
lib/webfuse/core/slist.c
|
2019-03-26 22:04:53 +00:00
|
|
|
lib/webfuse/core/message.c
|
|
|
|
lib/webfuse/core/message_queue.c
|
|
|
|
lib/webfuse/core/status.c
|
2019-04-26 18:49:09 +00:00
|
|
|
lib/webfuse/core/string.c
|
|
|
|
lib/webfuse/core/path.c
|
2019-12-01 16:17:21 +00:00
|
|
|
lib/webfuse/core/base64.c
|
2019-05-19 12:33:42 +00:00
|
|
|
lib/webfuse/core/lws_log.c
|
2019-02-25 20:28:31 +00:00
|
|
|
)
|
2019-01-27 02:45:03 +00:00
|
|
|
|
2019-03-26 22:04:53 +00:00
|
|
|
set_target_properties(webfuse-core PROPERTIES OUTPUT_NAME webfuse-core)
|
2019-04-27 07:49:43 +00:00
|
|
|
target_include_directories(webfuse-core PUBLIC lib)
|
2019-03-26 22:04:53 +00:00
|
|
|
set_target_properties(webfuse-core PROPERTIES C_VISIBILITY_PRESET hidden)
|
|
|
|
|
|
|
|
install(DIRECTORY include/webfuse/core DESTINATION include/webfuse)
|
|
|
|
|
|
|
|
|
|
|
|
# libwebfuse-adapter
|
|
|
|
|
|
|
|
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
|
2019-04-01 20:15:12 +00:00
|
|
|
lib/webfuse/adapter/impl/operations.c
|
2019-03-26 22:04:53 +00:00
|
|
|
lib/webfuse/adapter/impl/time/timepoint.c
|
|
|
|
lib/webfuse/adapter/impl/time/timer.c
|
|
|
|
lib/webfuse/adapter/impl/time/timeout_manager.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
|
2019-04-01 20:15:12 +00:00
|
|
|
lib/webfuse/adapter/impl/jsonrpc/proxy.c
|
2019-03-26 22:04:53 +00:00
|
|
|
lib/webfuse/adapter/impl/jsonrpc/server.c
|
|
|
|
lib/webfuse/adapter/impl/jsonrpc/method.c
|
|
|
|
lib/webfuse/adapter/impl/jsonrpc/request.c
|
|
|
|
lib/webfuse/adapter/impl/jsonrpc/response.c
|
|
|
|
lib/webfuse/adapter/impl/jsonrpc/util.c
|
2019-01-27 02:45:03 +00:00
|
|
|
)
|
|
|
|
|
2019-03-26 22:04:53 +00:00
|
|
|
set_target_properties(webfuse-adapter-static PROPERTIES OUTPUT_NAME webfuse-adapter)
|
|
|
|
set_target_properties(webfuse-adapter-static PROPERTIES C_VISIBILITY_PRESET hidden)
|
2019-04-27 07:49:43 +00:00
|
|
|
target_include_directories(webfuse-adapter-static PUBLIC lib)
|
2019-03-26 14:35:33 +00:00
|
|
|
|
2019-03-26 22:04:53 +00:00
|
|
|
add_library(webfuse-adapter SHARED
|
|
|
|
lib/webfuse/adapter/api.c
|
2019-03-26 14:35:33 +00:00
|
|
|
)
|
2019-02-09 19:08:42 +00:00
|
|
|
|
2019-03-26 22:04:53 +00:00
|
|
|
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")
|
2019-02-09 19:08:42 +00:00
|
|
|
|
2019-03-26 22:04:53 +00:00
|
|
|
target_link_libraries(webfuse-adapter PRIVATE webfuse-adapter-static webfuse-core)
|
2019-01-27 02:45:03 +00:00
|
|
|
|
2019-03-26 22:04:53 +00:00
|
|
|
file(WRITE "${PROJECT_BINARY_DIR}/libwebfuse-adapter.pc"
|
2019-02-10 14:06:46 +00:00
|
|
|
"prefix=\"${CMAKE_INSTALL_PREFIX}\"
|
2019-02-25 20:28:31 +00:00
|
|
|
|
2019-02-10 14:06:46 +00:00
|
|
|
exec_prefix=\${prefix}
|
|
|
|
libdir=\${exec_prefix}/lib${LIB_SUFFIX}
|
|
|
|
includedir=\${prefix}/include
|
2019-03-26 22:04:53 +00:00
|
|
|
Name: libwebfuse
|
2019-02-10 14:06:46 +00:00
|
|
|
Description: Websockets filesystem server library
|
|
|
|
Version: ${PROJECT_VERSION}
|
|
|
|
|
2019-03-26 22:04:53 +00:00
|
|
|
Libs: -L\${libdir} -lwebfuse-adapter -l${FUSE3_LIBRARIES} -l${LWS_LIBRARIES} -l${JANSSON_LIBRARIES}
|
2019-02-10 14:06:46 +00:00
|
|
|
Cflags: -I\${includedir}"
|
|
|
|
)
|
2019-02-09 19:08:42 +00:00
|
|
|
|
2019-03-26 22:04:53 +00:00
|
|
|
install(TARGETS webfuse-adapter DESTINATION lib${LIB_SUFFIX})
|
|
|
|
install(FILES include/webfuse_adapter.h DESTINATION include)
|
|
|
|
install(DIRECTORY include/webfuse/adapter DESTINATION include/webfuse)
|
|
|
|
install(FILES "${PROJECT_BINARY_DIR}/libwebfuse-adapter.pc" DESTINATION lib${LIB_SUFFIX}/pkgconfig)
|
|
|
|
|
|
|
|
#libwebfuse-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/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
|
2019-04-26 18:49:09 +00:00
|
|
|
lib/webfuse/provider/impl/static_filesystem.c
|
2019-02-16 15:08:17 +00:00
|
|
|
)
|
|
|
|
|
2019-03-26 22:04:53 +00:00
|
|
|
set_target_properties(webfuse-provider-static PROPERTIES OUTPUT_NAME webfuse-provider)
|
|
|
|
set_target_properties(webfuse-provider-static PROPERTIES C_VISIBILITY_PRESET hidden)
|
2019-04-27 07:49:43 +00:00
|
|
|
target_include_directories(webfuse-provider-static PUBLIC lib)
|
2019-03-26 14:35:33 +00:00
|
|
|
|
2019-03-26 22:04:53 +00:00
|
|
|
add_library(webfuse-provider SHARED
|
|
|
|
lib/webfuse/provider/api.c
|
2019-03-26 14:35:33 +00:00
|
|
|
)
|
2019-02-16 15:08:17 +00:00
|
|
|
|
2019-03-26 22:04:53 +00:00
|
|
|
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")
|
2019-02-16 15:08:17 +00:00
|
|
|
|
2019-04-27 07:49:43 +00:00
|
|
|
target_include_directories(webfuse-provider PUBLIC lib)
|
2019-03-26 22:04:53 +00:00
|
|
|
target_link_libraries(webfuse-provider PRIVATE webfuse-provider-static webfuse-core)
|
2019-02-16 15:08:17 +00:00
|
|
|
|
2019-03-26 22:04:53 +00:00
|
|
|
file(WRITE "${PROJECT_BINARY_DIR}/libwebfuse-provider.pc"
|
2019-02-16 15:08:17 +00:00
|
|
|
"prefix=\"${CMAKE_INSTALL_PREFIX}\"
|
|
|
|
exec_prefix=\${prefix}
|
|
|
|
libdir=\${exec_prefix}/lib${LIB_SUFFIX}
|
|
|
|
includedir=\${prefix}/include
|
2019-03-26 22:04:53 +00:00
|
|
|
Name: libwebfuse-provider
|
2019-02-16 15:08:17 +00:00
|
|
|
Description: Provider library for websockets filesystem
|
|
|
|
Version: ${PROJECT_VERSION}
|
|
|
|
|
2019-03-26 22:04:53 +00:00
|
|
|
Libs: -L\${libdir} -lwebfuse-provider -l${LWS_LIBRARIES} -l${JANSSON_LIBRARIES}
|
2019-02-16 15:08:17 +00:00
|
|
|
Cflags: -I\${includedir}"
|
|
|
|
)
|
|
|
|
|
2019-03-26 22:04:53 +00:00
|
|
|
install(TARGETS webfuse-provider DESTINATION lib${LIB_SUFFIX})
|
|
|
|
install(FILES include/webfuse_provider.h DESTINATION include)
|
|
|
|
install(DIRECTORY include/webfuse/provider DESTINATION include/webfuse)
|
|
|
|
install(FILES "${PROJECT_BINARY_DIR}/libwebfuse-provider.pc" DESTINATION lib${LIB_SUFFIX}/pkgconfig)
|
2019-02-16 15:08:17 +00:00
|
|
|
|
|
|
|
|
2019-02-16 15:28:14 +00:00
|
|
|
# examples
|
2019-01-27 02:45:03 +00:00
|
|
|
|
2019-04-01 20:15:12 +00:00
|
|
|
pkg_check_modules(OPENSSL REQUIRED openssl)
|
|
|
|
|
2019-02-15 15:16:24 +00:00
|
|
|
if(NOT WITHOUT_EXAMPLE)
|
2019-02-10 13:19:15 +00:00
|
|
|
|
2019-03-23 21:53:14 +00:00
|
|
|
# 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}
|
|
|
|
)
|
|
|
|
|
2019-04-27 07:49:43 +00:00
|
|
|
target_compile_options(userdb PUBLIC ${OPENSSL_CFLAGS_OTHER})
|
2019-03-23 21:53:14 +00:00
|
|
|
|
2019-02-16 15:28:14 +00:00
|
|
|
# daemon
|
|
|
|
|
2019-03-26 22:04:53 +00:00
|
|
|
add_executable(webfused
|
2019-02-16 15:28:14 +00:00
|
|
|
example/daemon/main.c
|
2019-01-27 02:45:03 +00:00
|
|
|
)
|
|
|
|
|
2019-04-01 20:15:12 +00:00
|
|
|
target_link_libraries(webfused PUBLIC webfuse-adapter userdb ${OPENSSL_LIBRARIES} ${EXTRA_LIBS})
|
2019-04-27 07:49:43 +00:00
|
|
|
target_compile_options(webfused PUBLIC ${OPENSSL_CFLAGS_OTHER})
|
2019-01-27 02:45:03 +00:00
|
|
|
|
2019-02-16 15:28:14 +00:00
|
|
|
# provider
|
|
|
|
|
2019-03-26 22:04:53 +00:00
|
|
|
add_executable(webfuse-provider-app
|
2019-02-16 15:28:14 +00:00
|
|
|
example/provider/main.c
|
|
|
|
)
|
|
|
|
|
2019-03-26 22:04:53 +00:00
|
|
|
set_target_properties(webfuse-provider-app PROPERTIES OUTPUT_NAME webfuse-provider)
|
2019-02-16 15:28:14 +00:00
|
|
|
|
2019-03-26 22:04:53 +00:00
|
|
|
target_link_libraries(webfuse-provider-app PUBLIC webfuse-provider ${EXTRA_LIBS})
|
|
|
|
target_include_directories(webfuse-provider-app PUBLIC ${EXTRA_INCLUDE_DIRS})
|
2019-02-16 15:28:14 +00:00
|
|
|
|
2019-04-26 18:49:09 +00:00
|
|
|
# static-filesystem-provider
|
|
|
|
|
|
|
|
add_executable(static-filesystem-provider
|
|
|
|
example/provider/static_filesystem.c
|
|
|
|
)
|
|
|
|
|
|
|
|
target_link_libraries(static-filesystem-provider PUBLIC webfuse-provider ${EXTRA_LIBS})
|
|
|
|
target_include_directories(static-filesystem-provider PUBLIC ${EXTRA_INCLUDE_DIRS})
|
|
|
|
target_compile_options(static-filesystem-provider PUBLIC ${EXTRA_CFLAGS})
|
|
|
|
|
2019-03-26 22:04:53 +00:00
|
|
|
# webfuse-passwd
|
2019-03-23 21:53:14 +00:00
|
|
|
|
2019-03-26 22:04:53 +00:00
|
|
|
add_executable(webfuse-passwd
|
2019-03-23 21:53:14 +00:00
|
|
|
example/passwd/main.c
|
|
|
|
)
|
|
|
|
|
2019-03-26 22:04:53 +00:00
|
|
|
target_link_libraries(webfuse-passwd PUBLIC
|
2019-03-23 21:53:14 +00:00
|
|
|
userdb
|
|
|
|
${OPENSSL_LIBRARIES}
|
|
|
|
${JANSSON_LIBRARIES}
|
|
|
|
)
|
|
|
|
|
2019-03-26 22:04:53 +00:00
|
|
|
target_include_directories(webfuse-passwd PUBLIC
|
2019-03-23 21:53:14 +00:00
|
|
|
example/passwd
|
|
|
|
example/lib/userdb/include
|
|
|
|
${OPENSSL_INCLUDE_DIRS}
|
|
|
|
${JANSSON_INCLUDE_DIRS}
|
|
|
|
)
|
|
|
|
|
2019-04-27 07:49:43 +00:00
|
|
|
target_compile_options(webfuse-passwd PUBLIC ${OPENSSL_CFLAGS_OTHER})
|
2019-03-23 21:53:14 +00:00
|
|
|
|
|
|
|
|
2019-02-15 15:16:24 +00:00
|
|
|
endif(NOT WITHOUT_EXAMPLE)
|
2019-02-10 13:19:15 +00:00
|
|
|
|
2019-01-27 02:45:03 +00:00
|
|
|
# tests
|
2019-01-30 20:53:57 +00:00
|
|
|
|
2019-02-15 15:16:24 +00:00
|
|
|
if(NOT WITHOUT_TESTS)
|
2019-01-30 20:53:57 +00:00
|
|
|
|
2019-03-23 17:16:31 +00:00
|
|
|
include (CTest)
|
|
|
|
|
2019-01-30 20:53:57 +00:00
|
|
|
pkg_check_modules(GTEST gtest_main)
|
2019-03-03 14:14:32 +00:00
|
|
|
include(GoogleTest)
|
2019-03-23 21:53:14 +00:00
|
|
|
pkg_check_modules(GMOCK gmock)
|
2019-01-30 20:53:57 +00:00
|
|
|
|
2019-01-27 02:45:03 +00:00
|
|
|
add_executable(alltests
|
2019-02-13 19:49:05 +00:00
|
|
|
test/msleep.cc
|
2019-05-19 12:33:42 +00:00
|
|
|
test/die_if.cc
|
2019-03-23 21:53:14 +00:00
|
|
|
test/mock_authenticator.cc
|
2019-04-26 18:49:09 +00:00
|
|
|
test/mock_request.cc
|
2019-05-19 12:33:42 +00:00
|
|
|
test/core/test_container_of.cc
|
|
|
|
test/core/test_string.cc
|
|
|
|
test/core/test_slist.cc
|
|
|
|
test/core/test_path.cc
|
2019-12-01 16:17:21 +00:00
|
|
|
test/core/test_base64.cc
|
2019-05-19 12:33:42 +00:00
|
|
|
test/core/test_status.cc
|
|
|
|
test/core/test_message.cc
|
|
|
|
test/core/test_message_queue.cc
|
|
|
|
test/adapter/test_response_parser.cc
|
|
|
|
test/adapter/test_server.cc
|
|
|
|
test/adapter/test_timepoint.cc
|
|
|
|
test/adapter/test_timer.cc
|
|
|
|
test/adapter/test_credentials.cc
|
|
|
|
test/adapter/test_authenticator.cc
|
|
|
|
test/adapter/test_authenticators.cc
|
|
|
|
test/adapter/test_fuse_req.cc
|
|
|
|
test/adapter/jsonrpc/test_util.cc
|
|
|
|
test/adapter/jsonrpc/test_is_request.cc
|
|
|
|
test/adapter/jsonrpc/test_request.cc
|
|
|
|
test/adapter/jsonrpc/test_is_response.cc
|
|
|
|
test/adapter/jsonrpc/test_response.cc
|
|
|
|
test/adapter/jsonrpc/test_server.cc
|
|
|
|
test/adapter/jsonrpc/test_proxy.cc
|
|
|
|
test/provider/test_url.cc
|
|
|
|
test/provider/test_static_filesystem.cc
|
|
|
|
test/integration/test_integration.cc
|
|
|
|
test/integration/server.cc
|
|
|
|
test/integration/provider.cc
|
2019-01-27 02:45:03 +00:00
|
|
|
)
|
|
|
|
|
2019-03-26 22:04:53 +00:00
|
|
|
target_link_libraries(alltests PUBLIC webfuse-adapter-static webfuse-provider-static webfuse-core ${EXTRA_LIBS} ${GMOCK_LIBRARIES} ${GTEST_LIBRARIES})
|
2019-05-19 12:33:42 +00:00
|
|
|
target_include_directories(alltests PUBLIC test lib ${GMOCK_INCLUDE_DIRS} ${GTEST_INCLUDE_DIRS})
|
2019-04-27 07:49:43 +00:00
|
|
|
target_compile_options(alltests PUBLIC ${GMOCK_CFLAGS} ${GTEST_CFLAGS})
|
2019-01-30 20:53:57 +00:00
|
|
|
|
|
|
|
enable_testing()
|
2019-03-03 14:14:32 +00:00
|
|
|
gtest_discover_tests(alltests TEST_PREFIX alltests:)
|
2019-01-27 02:45:03 +00:00
|
|
|
|
2019-04-27 07:49:43 +00:00
|
|
|
add_custom_target(coverage
|
|
|
|
./alltests
|
|
|
|
COMMAND mkdir -p coverage
|
|
|
|
COMMAND lcov --capture --directory . --output-file coverage/lcov.info
|
|
|
|
COMMAND lcov --remove coverage/lcov.info '/usr/*' --output-file coverage/lcov.info
|
2019-05-19 12:33:42 +00:00
|
|
|
COMMAND lcov --remove coverage/lcov.info '*/test/*' --output-file coverage/lcov.info
|
2019-04-27 07:49:43 +00:00
|
|
|
)
|
|
|
|
add_dependencies(coverage alltests)
|
|
|
|
|
|
|
|
add_custom_target(coverage-report
|
|
|
|
COMMAND genhtml coverage/lcov.info --output-directory coverage/report
|
|
|
|
)
|
|
|
|
add_dependencies(coverage-report coverage)
|
|
|
|
|
2019-03-03 14:14:32 +00:00
|
|
|
endif(NOT WITHOUT_TESTS)
|