mirror of
https://github.com/thunderbrewhq/squall.git
synced 2026-02-04 00:49:08 +00:00
chore(build): clean up debug build options
This commit is contained in:
parent
e16ccdb1e7
commit
511c40aaa4
3 changed files with 56 additions and 32 deletions
|
|
@ -25,6 +25,12 @@ list(APPEND CMAKE_MODULE_PATH
|
|||
|
||||
include(system)
|
||||
|
||||
# Standalone builds
|
||||
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
|
||||
set(WHOA_STANDALONE 1)
|
||||
message(STATUS "Building Storm as a standalone project")
|
||||
endif()
|
||||
|
||||
if(WHOA_ASSERTIONS_ENABLED)
|
||||
add_definitions(-DWHOA_ASSERTIONS_ENABLED)
|
||||
endif()
|
||||
|
|
@ -60,7 +66,10 @@ endif()
|
|||
|
||||
add_subdirectory(lib)
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
# Code coverage reporting
|
||||
if(WHOA_STANDALONE AND CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
# GCC coverage configuration
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
# Running coverage on linux+gcc:
|
||||
#
|
||||
# sudo apt install lcov
|
||||
|
|
@ -79,6 +88,9 @@ if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|||
LCOV_ARGS --rc branch_coverage=1
|
||||
GENHTML_ARGS --rc genhtml_branch_coverage=1
|
||||
)
|
||||
|
||||
message(STATUS "Code coverage reporting enabled")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(WHOA_TEST_STORMDLL)
|
||||
|
|
@ -94,7 +106,7 @@ else()
|
|||
add_subdirectory(storm)
|
||||
endif()
|
||||
|
||||
# Only build tests when standalone
|
||||
if(CMAKE_SOURCE_DIR STREQUAL PROJECT_SOURCE_DIR)
|
||||
if(WHOA_STANDALONE)
|
||||
# Add tests when standalone
|
||||
add_subdirectory(test)
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -62,10 +62,18 @@ if(HAS_NO_INVALID_OFFSETOF)
|
|||
)
|
||||
endif()
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
# Standalone builds
|
||||
if(WHOA_STANDALONE)
|
||||
# Debug build options
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
# GCC debug build options
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
# Enable coverage reporting
|
||||
include(CodeCoverage)
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE -g -fprofile-arcs -ftest-coverage -O0)
|
||||
|
||||
# Enable ASan for debug builds on gcc
|
||||
# Enable ASan
|
||||
target_compile_options(storm PRIVATE -fsanitize=address -fno-omit-frame-pointer)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
|
|
|||
|
|
@ -51,14 +51,18 @@ target_include_directories(StormTest
|
|||
${PROJECT_SOURCE_DIR}
|
||||
)
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCXX AND CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
# Debug build options
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
# GCC debug build options
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
# Enable coverage reporting
|
||||
include(CodeCoverage)
|
||||
|
||||
target_compile_options(${PROJECT_NAME} PRIVATE -g -fprofile-arcs -ftest-coverage -O0)
|
||||
|
||||
# Enable ASan for debug builds on gcc
|
||||
# Enable ASan
|
||||
target_compile_options(StormTest PRIVATE -fsanitize=address -fno-omit-frame-pointer)
|
||||
target_link_options(StormTest PRIVATE -fsanitize=address)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
install(TARGETS StormTest DESTINATION "bin")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue