Skip to content

Commit

Permalink
Make ASAN demo also run the library under asan
Browse files Browse the repository at this point in the history
  • Loading branch information
DavidSchinazi committed Jan 14, 2025
1 parent 0b0efae commit 3e74020
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions extras/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,34 @@ file(GLOB_RECURSE BENCH_SOURCES
find_package(glfw3 3.2 REQUIRED)
find_package(OpenGL REQUIRED)

set(JLCompileOptions "-std=c++20;-DJL_CONFIG=NONE;-DJL_CONTROLLER=NATIVE;-fPIC;-Wall;-Wextra;-Werror;-Wno-deprecated-declarations")
set(JLCompileOptions
"-std=c++20;-DJL_CONFIG=NONE;-DJL_CONTROLLER=NATIVE;-fPIC;-Wall;-Wextra;-Werror;-Wno-deprecated-declarations"
)

# LIBRARY
add_library(jazzlights SHARED ${LIB_SOURCES})
target_include_directories(jazzlights PUBLIC ../src .)
set_target_properties(jazzlights PROPERTIES COMPILE_OPTIONS "${JLCompileOptions}")

# LIBRARY-ASAN
add_library(jazzlights-asan SHARED ${LIB_SOURCES})
target_include_directories(jazzlights-asan PUBLIC ../src .)
set_target_properties(jazzlights-asan PROPERTIES COMPILE_OPTIONS "${JLCompileOptions};-fsanitize=address")
set_target_properties(jazzlights-asan PROPERTIES LINK_OPTIONS "-fsanitize=address")

# DEMO-LIB
add_library(jazzlights-demo-lib INTERFACE)
target_link_libraries(jazzlights-demo-lib INTERFACE jazzlights glfw OpenGL::GL)
target_link_libraries(jazzlights-demo-lib INTERFACE glfw OpenGL::GL)
target_include_directories(jazzlights-demo-lib INTERFACE ../src ${GLFW_INCLUDE_DIR} ${OPENGL_INCLUDE_DIR})

# DEMO
add_executable(jazzlights-demo ${DEMO_SOURCES})
target_link_libraries(jazzlights-demo PRIVATE jazzlights-demo-lib)
target_link_libraries(jazzlights-demo PRIVATE jazzlights jazzlights-demo-lib)
set_target_properties(jazzlights-demo PROPERTIES COMPILE_OPTIONS "${JLCompileOptions}")

# DEMO-ASAN
add_executable(jazzlights-demo-asan ${DEMO_SOURCES})
target_link_libraries(jazzlights-demo-asan PRIVATE jazzlights-demo-lib)
target_link_libraries(jazzlights-demo-asan PRIVATE jazzlights-asan jazzlights-demo-lib)
set_target_properties(jazzlights-demo-asan PROPERTIES COMPILE_OPTIONS "${JLCompileOptions};-fsanitize=address")
set_target_properties(jazzlights-demo-asan PROPERTIES LINK_OPTIONS "-fsanitize=address")

Expand Down

0 comments on commit 3e74020

Please sign in to comment.