mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2025-12-15 20:37:24 +08:00
cmake: use atomic profile updates for coverage
Signed-off-by: Ramon Roche <mrpollo@gmail.com>
This commit is contained in:
@@ -240,6 +240,20 @@ if(NOT CMAKE_BUILD_TYPE)
|
|||||||
set(CMAKE_BUILD_TYPE ${PX4_BUILD_TYPE} CACHE STRING "Build type" FORCE)
|
set(CMAKE_BUILD_TYPE ${PX4_BUILD_TYPE} CACHE STRING "Build type" FORCE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (CMAKE_BUILD_TYPE STREQUAL Coverage)
|
||||||
|
# Coverage instrumentation plus atomic updates
|
||||||
|
set(COVERAGE_FLAGS
|
||||||
|
--coverage
|
||||||
|
-fprofile-update=atomic
|
||||||
|
)
|
||||||
|
|
||||||
|
# Apply to every compile and link invocation
|
||||||
|
add_compile_options(${COVERAGE_FLAGS})
|
||||||
|
add_link_options(${COVERAGE_FLAGS})
|
||||||
|
|
||||||
|
message(STATUS "Coverage instrumentation enabled with flags: ${COVERAGE_FLAGS}")
|
||||||
|
endif()
|
||||||
|
|
||||||
if((CMAKE_BUILD_TYPE STREQUAL "Debug") OR (CMAKE_BUILD_TYPE STREQUAL "Coverage"))
|
if((CMAKE_BUILD_TYPE STREQUAL "Debug") OR (CMAKE_BUILD_TYPE STREQUAL "Coverage"))
|
||||||
set(MAX_CUSTOM_OPT_LEVEL -O0)
|
set(MAX_CUSTOM_OPT_LEVEL -O0)
|
||||||
elseif(CMAKE_BUILD_TYPE MATCHES "Sanitizer")
|
elseif(CMAKE_BUILD_TYPE MATCHES "Sanitizer")
|
||||||
@@ -426,7 +440,6 @@ if(BUILD_TESTING)
|
|||||||
set_target_properties(test_results PROPERTIES EXCLUDE_FROM_ALL TRUE)
|
set_target_properties(test_results PROPERTIES EXCLUDE_FROM_ALL TRUE)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
#=============================================================================
|
#=============================================================================
|
||||||
# subdirectories
|
# subdirectories
|
||||||
#
|
#
|
||||||
|
|||||||
Reference in New Issue
Block a user