File tree Expand file tree Collapse file tree 2 files changed +29
-1
lines changed
Expand file tree Collapse file tree 2 files changed +29
-1
lines changed Original file line number Diff line number Diff line change 2525 matrix :
2626 os : [ubuntu-latest, windows-latest]
2727 build_type : [Release, Debug]
28+ extra-cmake-flags : [""]
29+ include :
30+ - os : ubuntu-latest
31+ build_type : RelWithDebInfo
32+ extra-cmake-flags : " -DSANITIZER=address"
33+ - os : ubuntu-latest
34+ build_type : RelWithDebInfo
35+ extra-cmake-flags : " -DSANITIZER=undefined"
2836
2937 steps :
3038 - uses : actions/checkout@v4
4149 # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
4250 run : >
4351 cmake -B ${{ steps.strings.outputs.build-output-dir }}
44- -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
52+ -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ${{ matrix.extra-cmake-flags }}
4553 -S ${{ github.workspace }}
4654
4755 - name : Build
Original file line number Diff line number Diff line change @@ -26,13 +26,29 @@ set (TRIESTE_ENABLE_TESTING OFF)
2626FetchContent_MakeAvailable_ExcludeFromAll(trieste)
2727set (CMAKE_CXX_STANDARD 20)
2828
29+ if (SANITIZER)
30+ message (STATUS "Run-time sanitizer=${SANITIZER} " )
31+ endif ()
32+ macro (add_san target )
33+ # ASAN must be added first, or it gets upset.
34+ if (SANITIZER)
35+ if (MSVC )
36+ message (FATAL_ERROR "MSVC does not support sanitizers" )
37+ endif ()
38+ target_compile_definitions (${target} INTERFACE -DSNMALLOC_PASS_THROUGH)
39+ target_compile_options (${target} INTERFACE -g -fsanitize=${SANITIZER} -fno-omit-frame-pointer)
40+ target_link_libraries (${target} INTERFACE -fsanitize=${SANITIZER} )
41+ endif ()
42+ endmacro ()
43+
2944add_library (
3045 rt OBJECT
3146 src/rt/rt.cc
3247 src/rt/objects/region.cc
3348 src/rt/ui/mermaid.cc
3449 src/rt/core/builtin.cc
3550)
51+ add_san(rt)
3652
3753add_library (
3854 lang OBJECT
@@ -44,9 +60,13 @@ add_library(
4460 src/lang/passes/flatten.cc
4561 src/lang/passes/bytecode.cc
4662)
63+ add_san(lang)
64+
4765target_link_libraries (lang PRIVATE trieste::trieste)
4866
4967add_executable (verona_dyn src/main.cc)
68+ add_san(verona_dyn)
69+
5070target_link_libraries (verona_dyn PRIVATE rt lang)
5171
5272set_property (TARGET verona_dyn PROPERTY COMPILE_WARNING_AS_ERROR ON )
You can’t perform that action at this time.
0 commit comments