Skip to content

Commit

Permalink
add coverage support
Browse files Browse the repository at this point in the history
  • Loading branch information
vipalade committed Aug 1, 2024
1 parent ebf94a8 commit 6638471
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 6 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/cmake-multi-platform.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
# To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list.
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
build_type: [Release]
build_type: [Release, coverage]
c_compiler: [gcc, clang, cl]
include:
- os: windows-latest
Expand All @@ -39,6 +39,8 @@ jobs:
exclude:
- os: windows-latest
c_compiler: gcc
- os: windows-latest
build_type: coverage
- os: windows-latest
c_compiler: clang
- os: ubuntu-latest
Expand Down
32 changes: 27 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,13 @@ if(NOT CMAKE_BUILD_TYPE)
message(STATUS "Setting build type to 'release' as none was specified.")
set(CMAKE_BUILD_TYPE "release" CACHE STRING "Choose the type of build." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"release" "debug" "maintain" "custom")
if(CMAKE_SYSTEM MATCHES "Windows*")
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"release" "debug" "maintain" "custom")
else()
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"release" "debug" "maintain" "custom" "coverage")
endif()
endif()

string(TOLOWER "${CMAKE_BUILD_TYPE}" CMAKE_BUILD_TYPE)
Expand Down Expand Up @@ -109,6 +114,21 @@ if(CMAKE_BUILD_TYPE STREQUAL "debug")
endif()


if((NOT CMAKE_SYSTEM MATCHES "Windows*") AND CMAKE_BUILD_TYPE STREQUAL "coverage")
#set(CMAKE_VERBOSE_MAKEFILE ON)
set(SOLID_HAS_DEBUG TRUE)
set(SOLID_HAS_NO_INLINES TRUE)
set(SOLID_HAS_STATISTICS TRUE)
set(SOLID_HAS_ASSERT TRUE)
#force a single configuration type on Windows builds
set(CMAKE_CONFIGURATION_TYPES "debug")
set(CONFIGURATION_TYPE "debug")
add_compile_options("SHELL: -coverage -fprofile-arcs -ftest-coverage")
add_link_options("SHELL: -fprofile-arcs -ftest-coverage")
elseif(CMAKE_SYSTEM MATCHES "Windows*" AND CMAKE_BUILD_TYPE STREQUAL "coverage")
message(FATAL_ERROR "\r\n === Coverage not yet supported for Windows systems ===\r\n")
endif()

if(CMAKE_BUILD_TYPE STREQUAL "custom")
#force a single configuration type on Windows builds
set(CMAKE_CONFIGURATION_TYPES "custom")
Expand Down Expand Up @@ -190,7 +210,10 @@ if(CMAKE_SYSTEM MATCHES "Linux*")
set(SOLID_ON_POSIX TRUE)



if(CMAKE_BUILD_TYPE STREQUAL "coverage")
add_link_options("SHELL: -lgcov")
endif()

if(CMAKE_CXX_COMPILER MATCHES "clang")
add_compile_options(
"$<$<CONFIG:MAINTAIN>:SHELL: ${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -Wall -Wshorten-64-to-32 -Wunreachable-code -Wconditional-uninitialized -Wdelete-non-virtual-dtor -Wnon-virtual-dtor>"
Expand Down Expand Up @@ -252,8 +275,7 @@ if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm")
endif()

if(NOT ON_FOUND)
message("\r\n === Unsupported system - please contact project owner ===\r\n")
return()
message(FATAL_ERROR "\r\n === Unsupported system - please contact project owner ===\r\n")
endif(NOT ON_FOUND)

#-----------------------------------------------------------------
Expand Down
5 changes: 5 additions & 0 deletions solid/frame/mprpc/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ if(OPENSSL_FOUND)
test_clientserver_timeout_secure.cpp
test_clientserver_topic.cpp
)

if(SOLID_ON_WINDOWS)
set_source_files_properties(test_clientserver_versioning.cpp PROPERTIES COMPILE_OPTIONS "/bigobj")
endif()

#
create_test_sourcelist( mprpcClientServerTests test_mprpc_clientserver.cpp ${mprpcClientServerTestSuite})

Expand Down

0 comments on commit 6638471

Please sign in to comment.