Skip to content

Commit

Permalink
cmake: roll with ASan for debug builds
Browse files Browse the repository at this point in the history
Because I can.

While we're here, make sure we're running debug builds in CI and add a
FreeBSD 14.0 test instance.

Standardize on add_compile_options().

Signed-off-by: Kyle Evans <[email protected]>
  • Loading branch information
kevans91 committed Jan 28, 2024
1 parent e9d63af commit 7afd2c2
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
5 changes: 4 additions & 1 deletion .cirrus.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ build_task:
- name: FreeBSD 13
freebsd_instance:
image: freebsd-13-2-release-amd64
- name: FreeBSD 14
freebsd_instance:
image: freebsd-14-0-release-amd64-ufs
setup_script:
sudo pkg install -y lua54 cmake
configure_script:
- mkdir build
- cd build && cmake ..
- cd build && cmake -DCMAKE_BUILD_TYPE=Debug ..
build_script:
make -C build
test_script:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ jobs:
- name: configure
run: |
mkdir build
cd build && cmake ..
cd build && cmake -DCMAKE_BUILD_TYPE=Debug ..
- name: build orch(1)
run: make -C build
- name: Run self-tests
Expand Down
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,11 @@ option(EXAMPLES "Install examples" ON)
option(MANPAGES "Install manpages" ON)
option(BUILD_DRIVER "Build the orch(1) driver" ON)

if(CMAKE_BUILD_TYPE STREQUAL "Debug")
add_compile_options(-fsanitize=address)
add_link_options(-fsanitize=address)
endif()

if(EXAMPLES)
add_subdirectory(examples)
endif()
Expand Down
2 changes: 1 addition & 1 deletion lib/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ file(GLOB core_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.c)

set(warnings "-Wall -Wextra -Werror")
if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GNU_SOURCE")
add_compile_options(-D_GNU_SOURCE)
endif()

add_library(core SHARED ${core_SOURCES})
Expand Down

0 comments on commit 7afd2c2

Please sign in to comment.