Skip to content

Commit

Permalink
init sanitizer
Browse files Browse the repository at this point in the history
  • Loading branch information
tigercosmos committed Nov 28, 2023
1 parent 4c1e00f commit 95efcef
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
12 changes: 12 additions & 0 deletions .github/workflows/devbuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,18 @@ jobs:
export LD_LIBRARY_PATH=$(python3 -c "import sys, os, shiboken6; sys.stdout.write(os.path.dirname(shiboken6.__file__))")
make run_viewer_pytest VERBOSE=0
- name: make cmake USE_SANITIZER=ON & make pytest
run: |
export ASAN_OPTIONS=verify_asan_link_order=0
rm -f build/*/Makefile
make cmake \
VERBOSE=1 USE_CLANG_TIDY=OFF \
BUILD_QT=OFF \
CMAKE_BUILD_TYPE=${{ matrix.cmake_build_type }} \
CMAKE_ARGS="-DPYTHON_EXECUTABLE=$(which python3) -DUSE_SANITIZER=ON"
make buildext VERBOSE=1
make pytest VERBOSE=1
build_macos:

if: ${{ github.event_name != '' || (github.event_name == '' && github.repository_owner == 'solvcon') }}
Expand Down
11 changes: 11 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ endif()
option(USE_CLANG_TIDY "use clang-tidy" OFF)
option(LINT_AS_ERRORS "clang-tidy warnings as errors" OFF)

option(USE_SANITIZER "use sanitizer" OFF)

if(BUILD_QT)
option(QT3D_USE_RHI "Qt use RHI" OFF)
message(STATUS "QT3D_USE_RHI: ${QT3D_USE_RHI}")
Expand All @@ -47,6 +49,15 @@ else()
message(STATUS "not use clang-tidy")
endif()

if(USE_SANITIZER)
message(STATUS "use sanitizer")
set(SANITIZER_LIST "undefined,leak,address")
add_compile_options(-fsanitize=${SANITIZER_LIST})
add_link_options(-fsanitize=${SANITIZER_LIST})
else()
message(STATUS "not use sanitizer")
endif()

include(Flake8)

set(CMAKE_CXX_STANDARD 17)
Expand Down

0 comments on commit 95efcef

Please sign in to comment.