Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion .github/workflows/buildci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ jobs:
matrix:
os: [ubuntu-latest, windows-latest]
build_type: [Release, Debug]
extra-cmake-flags: [""]
include:
- os: ubuntu-latest
build_type: RelWithDebInfo
extra-cmake-flags: "-DSANITIZER=address"
- os: ubuntu-latest
build_type: RelWithDebInfo
extra-cmake-flags: "-DSANITIZER=undefined"

steps:
- uses: actions/checkout@v4
Expand All @@ -41,7 +49,7 @@ jobs:
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: >
cmake -B ${{ steps.strings.outputs.build-output-dir }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }} ${{ matrix.extra-cmake-flags }}
-S ${{ github.workspace }}

- name: Build
Expand Down
20 changes: 20 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,29 @@ set (TRIESTE_ENABLE_TESTING OFF)
FetchContent_MakeAvailable_ExcludeFromAll(trieste)
set(CMAKE_CXX_STANDARD 20)

if(SANITIZER)
message(STATUS "Run-time sanitizer=${SANITIZER}")
endif()
macro(add_san target)
# ASAN must be added first, or it gets upset.
if(SANITIZER)
if(MSVC)
message(FATAL_ERROR "MSVC does not support sanitizers")
endif()
target_compile_definitions(${target} INTERFACE -DSNMALLOC_PASS_THROUGH)
target_compile_options(${target} INTERFACE -g -fsanitize=${SANITIZER} -fno-omit-frame-pointer)
target_link_libraries(${target} INTERFACE -fsanitize=${SANITIZER})
endif()
endmacro()

add_library(
rt OBJECT
src/rt/rt.cc
src/rt/objects/region.cc
src/rt/ui/mermaid.cc
src/rt/core/builtin.cc
)
add_san(rt)

add_library(
lang OBJECT
Expand All @@ -44,9 +60,13 @@ add_library(
src/lang/passes/flatten.cc
src/lang/passes/bytecode.cc
)
add_san(lang)

target_link_libraries(lang PRIVATE trieste::trieste)

add_executable(verona_dyn src/main.cc)
add_san(verona_dyn)

target_link_libraries(verona_dyn PRIVATE rt lang)

set_property(TARGET verona_dyn PROPERTY COMPILE_WARNING_AS_ERROR ON)
Expand Down