Skip to content

Commit

Permalink
Added lots of warnings to our build. Also enabled undefined behavior
Browse files Browse the repository at this point in the history
and address sanitizers for the debug build.
  • Loading branch information
ddement committed Feb 13, 2024
1 parent f8a4ade commit 08bcaf0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
cmake --build . -j 2
./openturbine -h
./openturbine_unit_tests
Debug-GCC:
Debug:
runs-on: ubuntu-latest
steps:
- name: Install dependencies
Expand Down Expand Up @@ -130,6 +130,7 @@ jobs:
cd build
cmake .. \
-DOTURB_ENABLE_TESTS:BOOL=ON \
-DOTURB_ENABLE_BASIC_SANITIZERS=ON \
-DCMAKE_BUILD_TYPE=Debug
cmake --build . -j 2
./openturbine -h
Expand Down
13 changes: 7 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,13 @@ include(openturbine-utils)
########################## OPTIONS #####################################

# General options for the project
option(OTURB_ENABLE_ALL_WARNINGS "Show most warnings for most compilers" ON)
add_compile_options(-Wall -Wextra -Wshadow -Wnon-virtual-dtor -Wpedantic -Werror)
option(OTURB_ENABLE_BASIC_SANITIZERS "Compile with addrss and undefined behavior sanitizers", OFF)
if(OTURB_ENABLE_BASIC_SANITIZERS)
add_compile_options(-fsanitize=address,undefined)
add_link_options(-fsanitize=address,undefined)
endif

# option(OTURB_ENABLE_CLANG_TIDY "Compile with clang-tidy static analysis" OFF)
# option(OTURB_ENABLE_CPPCHECK "Enable cppcheck static analysis target" OFF)
# option(OTURB_ENABLE_FCOMPARE "Enable building fcompare when not testing" OFF)
Expand Down Expand Up @@ -52,10 +58,7 @@ elseif(BUILD_TYPE_UPPER STREQUAL "DEBUG" OR BUILD_TYPE_UPPER STREQUAL "RELWITHDE
endif()

# Enabling tests overrides the executable options
# option(OTURB_ENABLE_UNIT_TESTS "Enable unit testing" ON)
option(OTURB_ENABLE_TESTS "Enable testing suite" OFF)
# option(OTURB_SAVE_GOLDS "Provide a directory in which to save golds during testing" OFF)
# option(OTURB_ENABLE_FPE_TRAP_FOR_TESTS "Enable FPE trapping in tests" ON)

# Options for the executable
option(OTURB_ENABLE_OPENMP "Enable OpenMP" OFF)
Expand Down Expand Up @@ -123,8 +126,6 @@ if(CLANG_TIDY_EXE)
)
endif()

include(set_compile_flags)

# Build OpenTurbine
add_subdirectory(src)

Expand Down

0 comments on commit 08bcaf0

Please sign in to comment.