mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 06:57:45 +00:00
Meta+Userland: Add ENABLE_USERSPACE_COVERAGE_COLLECTION CMake option
This option sets -fprofile-instr-generate -fcoverage-mapping for Clang builds only on almost all of Userland. Loader and LibTimeZone are exempt. This can be used for generating code coverage reports, or even PGO in the future.
This commit is contained in:
parent
a6b2c34746
commit
5120b39d0e
9 changed files with 39 additions and 2 deletions
|
@ -1,5 +1,21 @@
|
|||
add_compile_options(-O2)
|
||||
|
||||
# Escape hatch target to prevent runtime startup libraries from having coverage enabled
|
||||
# at awkward points in program initialization
|
||||
add_library(NoCoverage INTERFACE)
|
||||
|
||||
if (ENABLE_USERSPACE_COVERAGE_COLLECTION)
|
||||
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang$")
|
||||
add_compile_options(-fprofile-instr-generate -fcoverage-mapping)
|
||||
add_link_options(-fprofile-instr-generate -fcoverage-mapping)
|
||||
|
||||
target_compile_options(NoCoverage INTERFACE -fno-profile-generate -fno-profile-instr-use -fno-profile-instr-generate -fno-coverage-mapping)
|
||||
target_link_options(NoCoverage INTERFACE -fno-profile-generate -fno-profile-instr-use -fno-profile-instr-generate -fno-coverage-mapping)
|
||||
else()
|
||||
message(FATAL_ERROR "ENABLE_USERSPACE_COVERAGE_COLLECTION not supported yet for ${CMAKE_CXX_COMPILER_ID}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_subdirectory(Applications)
|
||||
add_subdirectory(Demos)
|
||||
add_subdirectory(DevTools)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue