Skip to content

Commit

Permalink
Issue #583: Enable ASAN builds for debug to help catch issue.
Browse files Browse the repository at this point in the history
  • Loading branch information
rmpowell77 committed Jan 8, 2025
1 parent 7777c28 commit 350f56f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
9 changes: 3 additions & 6 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ on:
- main
- calchart-3.6

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release

jobs:
build:
name: ${{ matrix.config.name }}
Expand All @@ -45,6 +41,7 @@ jobs:
artifact_name: "CalChart-Windows",
os: windows-latest,
}
build_type: [Debug, Release]

steps:
- name: checkout
Expand Down Expand Up @@ -82,11 +79,11 @@ jobs:
- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{matrix.build_type}}

- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
run: cmake --build ${{github.workspace}}/build --config ${{matrix.build_type}}

# Codesigning for mac involves:
# 1. Creating a signing cert in p12 form (https://help.apple.com/xcode/mac/current/#/dev154b28f09)
Expand Down
3 changes: 3 additions & 0 deletions LATEST_RELEASE_NOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@ Bugs addressed in this release:

Other changes:

* [#583](../../issues/583) Enable ASAN builds for debug to help catch issue.


7 changes: 7 additions & 0 deletions cmake/compiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,10 @@ macro(SetupCompilerForTarget arg)
set_target_properties(${arg} PROPERTIES CXX_STANDARD 23)
endmacro()

option(ENABLE_ASAN "Enable AddressSanitizer in Debug" ON)
if (CMAKE_BUILD_TYPE STREQUAL "Debug" AND ENABLE_ASAN)
set(SANITIZER_FLAGS "-fsanitize=address")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${SANITIZER_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${SANITIZER_FLAGS}")
set(CMAKE_LINKER_FLAGS "${CMAKE_LINKER_FLAGS} ${SANITIZER_FLAGS}")
endif()

0 comments on commit 350f56f

Please sign in to comment.