cmake : apply only sanitizer flags at top level
ggml-ci
This commit is contained in:
parent
9d1b20ad1a
commit
e872097c35
6 changed files with 26 additions and 25 deletions
|
@ -83,9 +83,6 @@ include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/build-info.cmake)
|
||||||
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/common.cmake)
|
include(${CMAKE_CURRENT_SOURCE_DIR}/cmake/common.cmake)
|
||||||
|
|
||||||
# override ggml options
|
# override ggml options
|
||||||
set(GGML_SANITIZE_THREAD ${LLAMA_SANITIZE_THREAD})
|
|
||||||
set(GGML_SANITIZE_ADDRESS ${LLAMA_SANITIZE_ADDRESS})
|
|
||||||
set(GGML_SANITIZE_UNDEFINED ${LLAMA_SANITIZE_UNDEFINED})
|
|
||||||
set(GGML_ALL_WARNINGS ${LLAMA_ALL_WARNINGS})
|
set(GGML_ALL_WARNINGS ${LLAMA_ALL_WARNINGS})
|
||||||
set(GGML_FATAL_WARNINGS ${LLAMA_FATAL_WARNINGS})
|
set(GGML_FATAL_WARNINGS ${LLAMA_FATAL_WARNINGS})
|
||||||
|
|
||||||
|
@ -117,6 +114,23 @@ llama_option_depr(WARNING LLAMA_SYCL GGML_SYCL)
|
||||||
llama_option_depr(WARNING LLAMA_SYCL_F16 GGML_SYCL_F16)
|
llama_option_depr(WARNING LLAMA_SYCL_F16 GGML_SYCL_F16)
|
||||||
llama_option_depr(WARNING LLAMA_CANN GGML_CANN)
|
llama_option_depr(WARNING LLAMA_CANN GGML_CANN)
|
||||||
|
|
||||||
|
if (NOT MSVC)
|
||||||
|
if (LLAMA_SANITIZE_THREAD)
|
||||||
|
add_compile_options(-fsanitize=thread)
|
||||||
|
link_libraries (-fsanitize=thread)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (LLAMA_SANITIZE_ADDRESS)
|
||||||
|
add_compile_options(-fsanitize=address -fno-omit-frame-pointer)
|
||||||
|
link_libraries (-fsanitize=address)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if (LLAMA_SANITIZE_UNDEFINED)
|
||||||
|
add_compile_options(-fsanitize=undefined)
|
||||||
|
link_libraries (-fsanitize=undefined)
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
#
|
#
|
||||||
# 3rd party
|
# 3rd party
|
||||||
#
|
#
|
||||||
|
@ -130,8 +144,6 @@ endif()
|
||||||
# build the library
|
# build the library
|
||||||
#
|
#
|
||||||
|
|
||||||
llama_add_compile_flags() # llama-only flags
|
|
||||||
|
|
||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
|
|
||||||
#
|
#
|
||||||
|
|
|
@ -30,21 +30,4 @@ function(llama_add_compile_flags)
|
||||||
set(CXX_FLAGS "" PARENT_SCOPE)
|
set(CXX_FLAGS "" PARENT_SCOPE)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (NOT MSVC)
|
|
||||||
if (LLAMA_SANITIZE_THREAD)
|
|
||||||
add_compile_options(-fsanitize=thread)
|
|
||||||
link_libraries (-fsanitize=thread)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (LLAMA_SANITIZE_ADDRESS)
|
|
||||||
add_compile_options(-fsanitize=address -fno-omit-frame-pointer)
|
|
||||||
link_libraries (-fsanitize=address)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if (LLAMA_SANITIZE_UNDEFINED)
|
|
||||||
add_compile_options(-fsanitize=undefined)
|
|
||||||
link_libraries (-fsanitize=undefined)
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
|
@ -2,6 +2,8 @@
|
||||||
|
|
||||||
find_package(Threads REQUIRED)
|
find_package(Threads REQUIRED)
|
||||||
|
|
||||||
|
llama_add_compile_flags()
|
||||||
|
|
||||||
# Build info header
|
# Build info header
|
||||||
#
|
#
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ find_package(Threads REQUIRED)
|
||||||
|
|
||||||
# flags
|
# flags
|
||||||
|
|
||||||
# ...
|
llama_add_compile_flags()
|
||||||
|
|
||||||
# examples
|
# examples
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
llama_add_compile_flags()
|
||||||
|
|
||||||
#
|
#
|
||||||
# libraries
|
# libraries
|
||||||
#
|
#
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
llama_add_compile_flags()
|
||||||
|
|
||||||
function(llama_test target)
|
function(llama_test target)
|
||||||
include(CMakeParseArguments)
|
include(CMakeParseArguments)
|
||||||
set(options)
|
set(options)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue