mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 21:57:35 +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
|
@ -93,24 +93,32 @@ endif()
|
|||
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unknown-warning-option")
|
||||
|
||||
# Note: We link all these against NoCoverage so that we don't break ports by requiring coverage symbols
|
||||
# in runtime/startup objects.
|
||||
# Since all native serenity applications use dynamic libraries, prevent coverage on libc.a as well
|
||||
|
||||
add_library(crt0 STATIC crt0.cpp)
|
||||
target_link_libraries(crt0 PRIVATE NoCoverage)
|
||||
add_custom_command(
|
||||
TARGET crt0
|
||||
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_OBJECTS:crt0> ${CMAKE_INSTALL_PREFIX}/usr/lib/crt0.o
|
||||
)
|
||||
add_library(crt0_shared STATIC crt0_shared.cpp)
|
||||
target_link_libraries(crt0_shared PRIVATE NoCoverage)
|
||||
add_custom_command(
|
||||
TARGET crt0_shared
|
||||
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_OBJECTS:crt0_shared> ${CMAKE_INSTALL_PREFIX}/usr/lib/crt0_shared.o
|
||||
)
|
||||
|
||||
add_library(crti STATIC ${CRTI_SOURCE})
|
||||
target_link_libraries(crti PRIVATE NoCoverage)
|
||||
add_custom_command(
|
||||
TARGET crti
|
||||
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_OBJECTS:crti> ${CMAKE_INSTALL_PREFIX}/usr/lib/crti.o
|
||||
)
|
||||
|
||||
add_library(crtn STATIC ${CRTN_SOURCE})
|
||||
target_link_libraries(crtn PRIVATE NoCoverage)
|
||||
add_custom_command(
|
||||
TARGET crtn
|
||||
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_OBJECTS:crtn> ${CMAKE_INSTALL_PREFIX}/usr/lib/crtn.o
|
||||
|
@ -119,6 +127,7 @@ add_custom_command(
|
|||
set_source_files_properties (ssp.cpp PROPERTIES COMPILE_FLAGS
|
||||
"-fno-stack-protector")
|
||||
add_library(ssp STATIC ssp.cpp)
|
||||
target_link_libraries(ssp PRIVATE NoCoverage)
|
||||
add_custom_command(
|
||||
TARGET ssp
|
||||
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_OBJECTS:ssp> ${CMAKE_INSTALL_PREFIX}/usr/lib/ssp.o
|
||||
|
@ -131,7 +140,7 @@ set(SOURCES ${LIBC_SOURCES} ${AK_SOURCES} ${ELF_SOURCES} ${ASM_SOURCES})
|
|||
set_source_files_properties(stdio.cpp PROPERTIES COMPILE_FLAGS "-fno-builtin-fputc -fno-builtin-fputs -fno-builtin-fwrite")
|
||||
|
||||
add_library(LibCStaticWithoutDeps STATIC ${SOURCES})
|
||||
target_link_libraries(LibCStaticWithoutDeps ssp LibTimeZone)
|
||||
target_link_libraries(LibCStaticWithoutDeps PUBLIC ssp LibTimeZone PRIVATE NoCoverage)
|
||||
add_dependencies(LibCStaticWithoutDeps LibM LibSystem LibUBSanitizer)
|
||||
|
||||
add_custom_target(LibCStatic
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue