Skip to content

Commit

Permalink
[misc] move asan options to hpcc
Browse files Browse the repository at this point in the history
  • Loading branch information
ouonline committed Mar 26, 2024
1 parent bcc1628 commit a5c0ad8
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 30 deletions.
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ option(PPLNN_ENABLE_PYTHON_API "enable python api support" OFF)

option(PPLNN_HOLD_DEPS "don't update dependencies" OFF)

option(PPLNN_ENABLE_SANITIZE_OPTIONS "use -fsanitize options to check memory errors. Note that this option is only available for GCC and Clang." OFF)

if(MSVC)
option(PPLNN_USE_MSVC_STATIC_RUNTIME "" ON)
endif()
Expand All @@ -44,6 +42,9 @@ endif()
if(HPCC_USE_RISCV)
message(FATAL_ERROR "`HPCC_USE_RISCV` is deprecated. use `PPLNN_USE_RISCV64` instead.")
endif()
if(PPLNN_ENABLE_SANITIZE_OPTIONS)
message(FATAL_ERROR "`PPLNN_ENABLE_SANITIZE_OPTIONS` is deprecated. use `HPCC_ENABLE_SANITIZE_OPTIONS` instead.")
endif()

# --------------------------------------------------------------------------- #

Expand Down
14 changes: 0 additions & 14 deletions cmake/arm.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -86,20 +86,6 @@ if (PPLNN_USE_NUMA)
target_compile_definitions(pplnn_arm_static PUBLIC PPLNN_USE_NUMA)
endif()

if(PPLNN_ENABLE_SANITIZE_OPTIONS)
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(__ASAN_FLAGS__ "-fsanitize=undefined -fsanitize=address -fsanitize=leak -fno-omit-frame-pointer")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${__ASAN_FLAGS__}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${__ASAN_FLAGS__}")
unset(__ASAN_FLAGS__)
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
add_link_options("-static-libasan")
endif()
else()
message(FATAL_ERROR "UNSUPPORTED: `PPLNN_USE_SANITIZE` is ON when using compiler `${CMAKE_CXX_COMPILER_ID}`.")
endif()
endif()

target_link_libraries(pplnn_static INTERFACE pplnn_arm_static)

if(PPLNN_INSTALL)
Expand Down
14 changes: 0 additions & 14 deletions cmake/x86.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,6 @@ target_link_libraries(pplnn_x86_static PUBLIC pplnn_basic_static pplkernelx86_st

target_compile_definitions(pplnn_x86_static PUBLIC PPLNN_USE_X86)

if(PPLNN_ENABLE_SANITIZE_OPTIONS)
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU" OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(__ASAN_FLAGS__ "-fsanitize=undefined -fsanitize=address -fsanitize=leak -fno-omit-frame-pointer")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${__ASAN_FLAGS__}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${__ASAN_FLAGS__}")
unset(__ASAN_FLAGS__)
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
add_link_options("-static-libasan")
endif()
else()
message(FATAL_ERROR "UNSUPPORTED: `PPLNN_USE_SANITIZE` is ON when using compiler `${CMAKE_CXX_COMPILER_ID}`.")
endif()
endif()

target_link_libraries(pplnn_static INTERFACE pplnn_x86_static)

if(PPLNN_INSTALL)
Expand Down

0 comments on commit a5c0ad8

Please sign in to comment.