Skip to content

Commit

Permalink
Cleaned up the asan support in the build system.
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Bruse committed May 8, 2024
1 parent 80ad19b commit 3e098ad
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 15 deletions.
15 changes: 2 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,6 @@ include(cmake/deps.cmake)
enable_testing()
include(GoogleTest)

option(ZIMTOHRLI_ASAN "Build Zimtohrli with address sanitizer." OFF)
macro(asan_target TARGET)
if (ZIMTOHRLI_ASAN)
target_compile_options(${TARGET} PRIVATE -fsanitize=address)
target_link_options(${TARGET} PRIVATE -fsanitize=address)
endif()
endmacro()

add_library(zimtohrli_base STATIC
cpp/zimt/audio.cc
cpp/zimt/audio.h
Expand All @@ -34,10 +26,11 @@ add_library(zimtohrli_base STATIC
cpp/zimt/masking.h
cpp/zimt/mos.cc
cpp/zimt/mos.h
cpp/zimt/nsim.cc
cpp/zimt/nsim.h
cpp/zimt/zimtohrli.cc
cpp/zimt/zimtohrli.h
)
asan_target(zimtohrli_base)
target_include_directories(zimtohrli_base PUBLIC cpp)
target_link_libraries(zimtohrli_base PRIVATE absl::check)
target_link_libraries(zimtohrli_base PUBLIC hwy portaudio absl::statusor absl::span sndfile)
Expand All @@ -49,7 +42,6 @@ add_library(zimtohrli_visqol_adapter STATIC
cpp/zimt/visqol.cc
cpp/zimt/resample.h
)
asan_target(zimtohrli_visqol_adapter)
target_include_directories(zimtohrli_visqol_adapter PUBLIC cpp)
target_link_libraries(zimtohrli_visqol_adapter PRIVATE visqol samplerate hwy)
target_link_libraries(zimtohrli_visqol_adapter PUBLIC absl::span)
Expand All @@ -69,7 +61,6 @@ add_library(zimtohrli_goohrli_glue STATIC
cpp/zimt/goohrli.cc
go/goohrli/goohrli.h
)
asan_target(zimtohrli_goohrli_glue)
target_include_directories(zimtohrli_goohrli_glue PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/go/goohrli ${CMAKE_CURRENT_SOURCE_DIR}/go/gosqol)
target_link_libraries(zimtohrli_goohrli_glue zimtohrli_base zimtohrli_visqol_adapter)

Expand Down Expand Up @@ -100,15 +91,13 @@ add_library(zimtohrli_ux STATIC
cpp/zimt/ux.cc
cpp/zimt/ux.h
)
asan_target(zimtohrli_ux)
target_include_directories(zimtohrli_ux PRIVATE ${imgui_SOURCE_DIR}/backends ${gles_INCLUDE_DIRS})
target_include_directories(zimtohrli_ux PUBLIC ${imgui_SOURCE_DIR})
target_link_libraries(zimtohrli_ux zimtohrli_base glfw OpenGL::GL imgui)

add_executable(zimtohrli_compare
cpp/zimt/compare.cc
)
asan_target(zimtohrli_compare)
target_link_libraries(zimtohrli_compare zimtohrli_ux zimtohrli_base absl::flags_parse)
set_target_properties(zimtohrli_compare PROPERTIES
PREFIX ""
Expand Down
4 changes: 2 additions & 2 deletions cmake/tests.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ add_executable(zimtohrli_test
cpp/zimt/loudness_test.cc
cpp/zimt/masking_test.cc
cpp/zimt/mos_test.cc
cpp/zimt/nsim_test.cc
cpp/zimt/zimtohrli_test.cc
cpp/zimt/test_file_paths.cc
)
asan_target(zimtohrli_test)
target_link_libraries(zimtohrli_test zimtohrli_base gtest gmock_main benchmark)
target_compile_definitions(zimtohrli_test PRIVATE CMAKE_CURRENT_SOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR})
gtest_discover_tests(zimtohrli_test)
Expand Down Expand Up @@ -55,7 +55,7 @@ add_executable(zimtohrli_benchmark
cpp/zimt/filterbank_test.cc
cpp/zimt/loudness_test.cc
cpp/zimt/masking_test.cc
cpp/zimt/nsim_test.cc
cpp/zimt/zimtohrli_test.cc
)
asan_target(zimtohrli_benchmark)
target_link_libraries(zimtohrli_benchmark zimtohrli_base gtest gmock benchmark_main)

0 comments on commit 3e098ad

Please sign in to comment.