Skip to content

Commit 3699cc0

Browse files
committed
Coverage
1 parent 4a8e7e8 commit 3699cc0

File tree

74 files changed

+4277
-139
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+4277
-139
lines changed

.github/workflows/cmake-multi-platform.yml

Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ jobs:
3232
sudo apt-get install -y git build-essential cmake ninja-build \
3333
zip unzip curl pkg-config ca-certificates \
3434
clang-21 lld-21 libc++-21-dev libc++abi-21-dev
35-
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-21 100
36-
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-21 100
35+
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/clang-21 100
36+
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-21 100
3737
sudo update-alternatives --install /usr/bin/lld lld /usr/bin/lld-21 100
3838
- name: Linux (Clang) (x86-linux)
3939
triplet: x86-linux
@@ -56,8 +56,8 @@ jobs:
5656
# Install GCC 15 with multilib support
5757
sudo apt-get install -y gcc-15-multilib g++-15-multilib
5858
# Set up alternatives for Clang
59-
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-21 100
60-
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-21 100
59+
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/clang-21 100
60+
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-21 100
6161
sudo update-alternatives --install /usr/bin/lld lld /usr/bin/lld-21 100
6262
# Set up alternatives for GCC
6363
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-15 100
@@ -73,8 +73,8 @@ jobs:
7373
sudo apt-get install -y git build-essential cmake ninja-build \
7474
zip unzip curl pkg-config ca-certificates \
7575
clang-21 lld-21 libc++-21-dev libc++abi-21-dev
76-
sudo update-alternatives --install /usr/bin/clang clang /usr/bin/clang-21 100
77-
sudo update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-21 100
76+
sudo update-alternatives --install /usr/bin/cc cc /usr/bin/clang-21 100
77+
sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/clang++-21 100
7878
sudo update-alternatives --install /usr/bin/lld lld /usr/bin/lld-21 100
7979
fail-fast: false
8080
env:
@@ -115,13 +115,21 @@ jobs:
115115
-DOMATH_BUILD_BENCHMARK=OFF \
116116
-DVCPKG_MANIFEST_FEATURES="imgui;avx2;tests"
117117
118-
- name: Build
118+
- name: Build and Run (non-coverage)
119+
if: ${{ matrix.triplet != 'x64-linux' }}
119120
shell: bash
120-
run: cmake --build cmake-build/build/${{ matrix.preset }} --target unit_tests omath
121+
run: |
122+
cmake --build cmake-build/build/${{ matrix.preset }} --target unit_tests omath
123+
./out/Release/unit_tests
121124
122-
- name: Run unit_tests
125+
- name: Run clang coverage (x64-linux)
126+
if: ${{ matrix.triplet == 'x64-linux' }}
123127
shell: bash
124-
run: ./out/Release/unit_tests
128+
run: |
129+
sudo apt-get update
130+
sudo apt-get install -y lcov llvm-21
131+
export PATH="/usr/lib/llvm-21/bin:$PATH"
132+
NO_AVX=1 ./scripts/run_clang_coverage.sh build/clang-coverage-lcov
125133
126134
- name: Upload logs on failure
127135
if: ${{ failure() }}

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,6 @@
22
/out
33
*.DS_Store
44
/extlibs/vcpkg
5-
.idea/workspace.xml
5+
.idea/workspace.xml
6+
/build/
7+
*.gcov

CMakeLists.txt

Lines changed: 68 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ project(omath VERSION ${OMATH_VERSION} LANGUAGES CXX)
66
include(CMakePackageConfigHelpers)
77
include(CheckCXXCompilerFlag)
88

9+
include(cmake/Coverage.cmake)
10+
911
if (MSVC)
1012
check_cxx_compiler_flag("/arch:AVX2" COMPILER_SUPPORTS_AVX2)
1113
else ()
@@ -23,7 +25,7 @@ option(OMATH_STATIC_MSVC_RUNTIME_LIBRARY "Force Omath to link static runtime" OF
2325
option(OMATH_SUPRESS_SAFETY_CHECKS "Supress some safety checks in release build to improve general performance" ON)
2426
option(OMATH_USE_UNITY_BUILD "Will enable unity build to speed up compilation" OFF)
2527
option(OMATH_ENABLE_LEGACY "Will enable legacy classes that MUST be used ONLY for backward compatibility" ON)
26-
28+
option(OMATH_ENABLE_COVERAGE "Enable compiling tests with coverage. (Linux only)" ON)
2729

2830
if (VCPKG_MANIFEST_FEATURES)
2931
foreach (omath_feature IN LISTS VCPKG_MANIFEST_FEATURES)
@@ -60,6 +62,7 @@ if (${PROJECT_IS_TOP_LEVEL})
6062
message(STATUS "[${PROJECT_NAME}]: ImGUI integration feature status ${OMATH_IMGUI_INTEGRATION}")
6163
message(STATUS "[${PROJECT_NAME}]: Legacy features support ${OMATH_ENABLE_LEGACY}")
6264
message(STATUS "[${PROJECT_NAME}]: Building using vcpkg ${OMATH_BUILD_VIA_VCPKG}")
65+
message(STATUS "[${PROJECT_NAME}]: Coverage is ${OMATH_ENABLE_COVERAGE}")
6366
endif ()
6467

6568
file(GLOB_RECURSE OMATH_SOURCES CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/source/*.cpp")
@@ -76,6 +79,13 @@ add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME})
7679

7780
target_compile_definitions(${PROJECT_NAME} PUBLIC OMATH_VERSION="${PROJECT_VERSION}")
7881

82+
# If forward_helpers.cpp is present, compile it with inlining disabled so that
83+
# emitted symbols/debug-info are produced in that TU (helpful for coverage attribution).
84+
# Delegate coverage-related configuration to cmake/Coverage.cmake
85+
if(OMATH_ENABLE_COVERAGE AND CMAKE_HOST_LINUX AND OMATH_BUILD_TESTS)
86+
omath_setup_coverage_for_root(${PROJECT_NAME})
87+
endif()
88+
7989
if (OMATH_IMGUI_INTEGRATION)
8090
target_compile_definitions(${PROJECT_NAME} PUBLIC OMATH_IMGUI_INTEGRATION)
8191

@@ -135,6 +145,11 @@ if (OMATH_USE_AVX2)
135145
endif ()
136146
endif ()
137147

148+
if(EMSCRIPTEN)
149+
target_compile_options(${PROJECT_NAME} PRIVATE -fexceptions)
150+
target_link_options(${PROJECT_NAME} PRIVATE -fexceptions)
151+
endif()
152+
138153
target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_23)
139154

140155
if (OMATH_BUILD_TESTS)
@@ -150,6 +165,56 @@ if (OMATH_BUILD_EXAMPLES)
150165
add_subdirectory(examples)
151166
endif ()
152167

168+
if(OMATH_ENABLE_COVERAGE AND CMAKE_HOST_LINUX AND OMATH_BUILD_TESTS)
169+
# Configure coverage flags per-compiler:
170+
# - For Clang/AppleClang use LLVM's instrumentation flags so the build
171+
# produces .profraw files usable by llvm-profdata/llvm-cov.
172+
# - For GCC use the traditional gcov flags (-fprofile-arcs -ftest-coverage).
173+
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang|AppleClang")
174+
target_compile_options(${PROJECT_NAME} PRIVATE
175+
$<$<CONFIG:Debug>:-g>
176+
$<$<CONFIG:Debug>:-fprofile-instr-generate>
177+
$<$<CONFIG:Debug>:-fcoverage-mapping>
178+
)
179+
# No special link flags needed for Clang llvm profile instrumentation.
180+
else()
181+
# Default to GCC-style gcov instrumentation for other compilers.
182+
target_compile_options(${PROJECT_NAME} PRIVATE
183+
$<$<CONFIG:Debug>:-g>
184+
$<$<CONFIG:Debug>:-fprofile-arcs>
185+
$<$<CONFIG:Debug>:-ftest-coverage>
186+
)
187+
# Link-time flags to ensure coverage support for gcov
188+
target_link_libraries(${PROJECT_NAME} PRIVATE
189+
$<$<CONFIG:Debug>:-fprofile-arcs>
190+
$<$<CONFIG:Debug>:-ftest-coverage>
191+
)
192+
endif()
193+
194+
# Normalize recorded source file paths in debug info and coverage by
195+
# rewriting build/source prefixes to a stable value. This helps tools
196+
# like geninfo/gcov map execution addresses to canonical header paths.
197+
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang")
198+
# Map the absolute source and binary paths to a short placeholder
199+
file(TO_CMAKE_PATH "${CMAKE_CURRENT_SOURCE_DIR}" OMATH_SRC_PATH)
200+
file(TO_CMAKE_PATH "${CMAKE_CURRENT_BINARY_DIR}" OMATH_BUILD_PATH)
201+
string(REPLACE "/" "\\/" OMATH_SRC_PATH_ESCAPED "${OMATH_SRC_PATH}")
202+
string(REPLACE "/" "\\/" OMATH_BUILD_PATH_ESCAPED "${OMATH_BUILD_PATH}")
203+
204+
# Add compiler flags that rewrite recorded paths in debug info.
205+
# Map them to '.' so geninfo can find sources relative to the
206+
# build working directory used when collecting coverage.
207+
target_compile_options(${PROJECT_NAME} PRIVATE
208+
# Map source tree to one level up so geninfo running from the
209+
# binary directory can find ../include/... and ../source/...
210+
$<$<CONFIG:Debug>:-ffile-prefix-map=${OMATH_SRC_PATH}=..>
211+
$<$<CONFIG:Debug>:-ffile-prefix-map=${OMATH_BUILD_PATH}=.>
212+
$<$<CONFIG:Debug>:-fdebug-prefix-map=${OMATH_SRC_PATH}=..>
213+
$<$<CONFIG:Debug>:-fdebug-prefix-map=${OMATH_BUILD_PATH}=.>
214+
)
215+
endif()
216+
endif ()
217+
153218
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" AND OMATH_THREAT_WARNING_AS_ERROR)
154219
target_compile_options(${PROJECT_NAME} PRIVATE /W4 /WX)
155220
elseif (OMATH_THREAT_WARNING_AS_ERROR)
@@ -167,6 +232,8 @@ target_include_directories(${PROJECT_NAME}
167232
$<INSTALL_INTERFACE:include> # Use this path when the project is installed
168233
)
169234

235+
# Coverage targets are configured by cmake/Coverage.cmake via
236+
# omath_setup_coverage_for_root().
170237

171238
# Installation rules
172239

@@ -188,7 +255,6 @@ install(EXPORT ${PROJECT_NAME}Targets
188255
DESTINATION lib/cmake/${PROJECT_NAME} COMPONENT ${PROJECT_NAME}
189256
)
190257

191-
192258
# Generate the omathConfigVersion.cmake file
193259
write_basic_package_version_file(
194260
"${CMAKE_CURRENT_BINARY_DIR}/omathConfigVersion.cmake"

CMakePresets.json

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -134,10 +134,6 @@
134134
"name": "linux-base",
135135
"hidden": true,
136136
"inherits": "base",
137-
"cacheVariables": {
138-
"CMAKE_C_COMPILER": "clang-21",
139-
"CMAKE_CXX_COMPILER": "clang++-21"
140-
},
141137
"condition": {
142138
"type": "equals",
143139
"lhs": "${hostSystemName}",

cmake/Coverage.cmake

Lines changed: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,186 @@
1+
function(omath_setup_coverage_for_root OMATH_PROJECT)
2+
# Configure compilation properties for coverage helper translation units
3+
# (use project root paths so this behaves the same regardless of where
4+
# the file is included from).
5+
set(OMATH_SRC_DIR "${CMAKE_SOURCE_DIR}")
6+
set(OMATH_BIN_DIR "${CMAKE_BINARY_DIR}")
7+
8+
# If forward_helpers.cpp is present, compile it with inlining disabled.
9+
if (EXISTS "${OMATH_SRC_DIR}/source/coverage/forward_helpers.cpp")
10+
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang")
11+
set_source_files_properties(${OMATH_SRC_DIR}/source/coverage/forward_helpers.cpp PROPERTIES COMPILE_FLAGS "-fno-inline")
12+
elseif (MSVC)
13+
set_source_files_properties(${OMATH_SRC_DIR}/source/coverage/forward_helpers.cpp PROPERTIES COMPILE_FLAGS "/Ob0")
14+
endif()
15+
endif()
16+
17+
# Always provide the coverage_coalescer tool target if the source exists.
18+
if (EXISTS "${OMATH_SRC_DIR}/tools/coverage_coalescer.cpp" AND NOT TARGET coverage_coalescer)
19+
add_executable(coverage_coalescer ${OMATH_SRC_DIR}/tools/coverage_coalescer.cpp)
20+
set_target_properties(coverage_coalescer PROPERTIES
21+
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/tools"
22+
OUTPUT_NAME "coverage_coalescer"
23+
)
24+
endif()
25+
26+
# Also disable inlining for other coverage helper translation units.
27+
if (EXISTS "${OMATH_SRC_DIR}/source/coverage/linear_algebra_wrappers.cpp")
28+
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang")
29+
set_source_files_properties(${OMATH_SRC_DIR}/source/coverage/linear_algebra_wrappers.cpp PROPERTIES COMPILE_FLAGS "-fno-inline")
30+
elseif (MSVC)
31+
set_source_files_properties(${OMATH_SRC_DIR}/source/coverage/linear_algebra_wrappers.cpp PROPERTIES COMPILE_FLAGS "/Ob0")
32+
endif()
33+
endif()
34+
35+
if (EXISTS "${OMATH_SRC_DIR}/source/coverage/extra_linear_algebra_coverage.cpp")
36+
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang")
37+
set_source_files_properties(${OMATH_SRC_DIR}/source/coverage/extra_linear_algebra_coverage.cpp PROPERTIES COMPILE_FLAGS "-fno-inline")
38+
elseif (MSVC)
39+
set_source_files_properties(${OMATH_SRC_DIR}/source/coverage/extra_linear_algebra_coverage.cpp PROPERTIES COMPILE_FLAGS "/Ob0")
40+
endif()
41+
endif()
42+
43+
if (EXISTS "${OMATH_SRC_DIR}/source/coverage/explicit_instantiations.cpp")
44+
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang")
45+
set_source_files_properties(${OMATH_SRC_DIR}/source/coverage/explicit_instantiations.cpp PROPERTIES COMPILE_FLAGS "-fno-inline")
46+
elseif (MSVC)
47+
set_source_files_properties(${OMATH_SRC_DIR}/source/coverage/explicit_instantiations.cpp PROPERTIES COMPILE_FLAGS "/Ob0")
48+
endif()
49+
endif()
50+
51+
# Add additional debug-related flags to coverage-related TUs
52+
set(COVERAGE_TUS
53+
${OMATH_SRC_DIR}/source/coverage/forward_helpers.cpp
54+
${OMATH_SRC_DIR}/source/coverage/explicit_instantiations.cpp
55+
${OMATH_SRC_DIR}/source/coverage/force_instantiations.cpp
56+
${OMATH_SRC_DIR}/source/coverage/linear_algebra_wrappers.cpp
57+
${OMATH_SRC_DIR}/source/coverage/extra_linear_algebra_coverage.cpp)
58+
59+
foreach(_tu IN LISTS COVERAGE_TUS)
60+
if (EXISTS "${_tu}")
61+
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang")
62+
set_source_files_properties(${_tu} PROPERTIES COMPILE_FLAGS "-g -O0 -fno-omit-frame-pointer -fno-inline")
63+
elseif (MSVC)
64+
set_source_files_properties(${_tu} PROPERTIES COMPILE_FLAGS "/Zo /Oy- /Ob0")
65+
endif()
66+
endif()
67+
endforeach()
68+
69+
# Project-level coverage configuration (compiler/linker flags and coverage targets)
70+
if(CMAKE_HOST_LINUX AND OMATH_BUILD_TESTS)
71+
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang|AppleClang")
72+
target_compile_options(${OMATH_PROJECT} PRIVATE
73+
$<$<CONFIG:Debug>:-g>
74+
$<$<CONFIG:Debug>:-fprofile-instr-generate>
75+
$<$<CONFIG:Debug>:-fcoverage-mapping>
76+
)
77+
else()
78+
target_compile_options(${OMATH_PROJECT} PRIVATE
79+
$<$<CONFIG:Debug>:-g>
80+
$<$<CONFIG:Debug>:-fprofile-arcs>
81+
$<$<CONFIG:Debug>:-ftest-coverage>
82+
)
83+
target_link_libraries(${OMATH_PROJECT} PRIVATE
84+
$<$<CONFIG:Debug>:-fprofile-arcs>
85+
$<$<CONFIG:Debug>:-ftest-coverage>
86+
)
87+
endif()
88+
89+
if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang|AppleClang")
90+
file(TO_CMAKE_PATH "${OMATH_SRC_DIR}" OMATH_SRC_PATH)
91+
file(TO_CMAKE_PATH "${OMATH_BIN_DIR}" OMATH_BUILD_PATH)
92+
string(REPLACE "/" "\\/" OMATH_SRC_PATH_ESCAPED "${OMATH_SRC_PATH}")
93+
string(REPLACE "/" "\\/" OMATH_BUILD_PATH_ESCAPED "${OMATH_BUILD_PATH}")
94+
95+
target_compile_options(${OMATH_PROJECT} PRIVATE
96+
$<$<CONFIG:Debug>:-ffile-prefix-map=${OMATH_SRC_PATH}=..>
97+
$<$<CONFIG:Debug>:-ffile-prefix-map=${OMATH_BUILD_PATH}=.>
98+
$<$<CONFIG:Debug>:-fdebug-prefix-map=${OMATH_SRC_PATH}=..>
99+
$<$<CONFIG:Debug>:-fdebug-prefix-map=${OMATH_BUILD_PATH}=.>
100+
)
101+
endif()
102+
103+
# Expose variables for coverage script substitution and configure script
104+
set(OMATH_LCOV_IGNORE_ERRORS "mismatch,inconsistent")
105+
set(OMATH_BR_EXCLUSION "LCOV_EXCL_BR_LINE|assert\\(")
106+
set(OMATH_LCOV_EXTRACT_PATHS "\"${OMATH_SRC_DIR}/include/omath/linear_algebra/*\" \"${OMATH_SRC_DIR}/include/omath/*\" \"${OMATH_SRC_DIR}/include/*\" \"${OMATH_SRC_DIR}/source/*\"")
107+
108+
set(LCOV_IGNORE_ERRORS "${OMATH_LCOV_IGNORE_ERRORS}")
109+
set(BR_EXCLUSION "${OMATH_BR_EXCLUSION}")
110+
set(LCOV_EXTRACT_PATHS "${OMATH_LCOV_EXTRACT_PATHS}")
111+
112+
configure_file(
113+
"${OMATH_SRC_DIR}/scripts/coverage.sh.in"
114+
"${OMATH_BIN_DIR}/scripts/coverage.sh"
115+
@ONLY)
116+
117+
# Ensure the coverage_coalescer tool is available (guard already above).
118+
119+
# Add coverage helper make clean files and targets
120+
set_property(
121+
DIRECTORY
122+
APPEND
123+
PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "coverage.info")
124+
set_property(
125+
DIRECTORY
126+
APPEND
127+
PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "coverage.cleaned.info")
128+
set_property(
129+
DIRECTORY
130+
APPEND
131+
PROPERTY ADDITIONAL_MAKE_CLEAN_FILES "coverage")
132+
add_custom_target(
133+
coverage
134+
DEPENDS unit_tests
135+
COMMAND bash "${OMATH_BIN_DIR}/scripts/coverage.sh"
136+
"${OMATH_SRC_DIR}" "${OMATH_BIN_DIR}"
137+
WORKING_DIRECTORY "${OMATH_BIN_DIR}"
138+
COMMENT "Run coverage: run tests, collect via gcov, postprocess and generate HTML")
139+
add_custom_target(
140+
clean-coverage
141+
COMMAND lcov --rc branch_coverage=1 --directory
142+
'${OMATH_BIN_DIR}' --zerocounters
143+
COMMENT "Zeroing counters")
144+
endif()
145+
endfunction()
146+
147+
function(omath_setup_coverage_for_test TEST_TARGET)
148+
# Called from tests/CMakeLists; CMAKE_CURRENT_SOURCE_DIR will be the tests/ dir
149+
set(TEST_SRC_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
150+
151+
# Compile specific TU without inlining to help coverage attribute header lines
152+
set_source_files_properties(
153+
${TEST_SRC_DIR}/general/coverage_instantiations.cpp
154+
${TEST_SRC_DIR}/general/coverage_utility_instantiations.cpp
155+
PROPERTIES COMPILE_OPTIONS "-fno-inline")
156+
157+
# If building with Clang and coverage enabled, remove any GCC-style
158+
# coverage link flags that might have been propagated to the test target
159+
# so that Clang's instrumentation flags control the coverage output.
160+
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang|AppleClang")
161+
string(REPLACE "-fprofile-arcs" "" _tmp_link_opts "${CMAKE_SHARED_LINKER_FLAGS}")
162+
string(REPLACE "-ftest-coverage" "" _tmp_link_opts "${_tmp_link_opts}")
163+
set_target_properties(${TEST_TARGET} PROPERTIES LINK_FLAGS "${_tmp_link_opts}")
164+
target_compile_options(${TEST_TARGET} PRIVATE
165+
$<$<CONFIG:Debug>:-fprofile-instr-generate>
166+
$<$<CONFIG:Debug>:-fcoverage-mapping>
167+
$<$<CONFIG:Debug>:-g>
168+
)
169+
if(EMSCRIPTEN)
170+
target_compile_options(${TEST_TARGET} PRIVATE -fexceptions)
171+
target_link_options(${TEST_TARGET} PRIVATE -fexceptions)
172+
endif()
173+
if (CMAKE_VERSION VERSION_GREATER "3.13")
174+
target_link_options(${TEST_TARGET} PRIVATE $<$<CONFIG:Debug>:-fprofile-instr-generate> $<$<CONFIG:Debug>:-fcoverage-mapping>)
175+
else()
176+
string(APPEND _tmp_link_flags " -fprofile-instr-generate -fcoverage-mapping")
177+
set_target_properties(${TEST_TARGET} PROPERTIES LINK_FLAGS "${_tmp_link_flags}")
178+
endif()
179+
endif()
180+
181+
# Discover tests except on platforms where test binaries cannot run
182+
if (NOT (ANDROID OR IOS OR EMSCRIPTEN))
183+
include(GoogleTest)
184+
gtest_discover_tests(${TEST_TARGET})
185+
endif()
186+
endfunction()

0 commit comments

Comments
 (0)