aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJuan Ramos <juan@lunarg.com>2023-11-02 12:23:23 -0600
committerJuan Ramos <114601453+juan-lunarg@users.noreply.github.com>2023-11-02 13:09:23 -0600
commit20b2ff19588be983ae75f3f1e243b2fd2380872d (patch)
tree481e64d1a0d5c5ae6e1190cc432ed4a3c5522983
parent116b6b1513d33f2414ddc4db01a7244d6e021ba6 (diff)
downloadusermoji-20b2ff19588be983ae75f3f1e243b2fd2380872d.tar.xz
Cleanup ENABLE_ADDRESS_SANITIZER
Easier to manage and fixes MSVC ASAN
-rw-r--r--CMakeLists.txt7
-rw-r--r--cube/CMakeLists.txt15
-rw-r--r--icd/CMakeLists.txt5
-rw-r--r--tests/CMakeLists.txt5
-rw-r--r--vulkaninfo/CMakeLists.txt5
5 files changed, 7 insertions, 30 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8d726474..07f5f318 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -39,7 +39,14 @@ set(CMAKE_POSITION_INDEPENDENT_CODE ON)
option(BUILD_CUBE "Build cube" ON)
option(BUILD_VULKANINFO "Build vulkaninfo" ON)
option(BUILD_ICD "Build icd" ON)
+
option(ENABLE_ADDRESS_SANITIZER "Use address sanitization")
+if (ENABLE_ADDRESS_SANITIZER)
+ add_compile_options(-fsanitize=address)
+ if (NOT MSVC)
+ add_link_options(-fsanitize=address)
+ endif()
+endif()
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
diff --git a/cube/CMakeLists.txt b/cube/CMakeLists.txt
index 4bb75b8e..3cb2ceea 100644
--- a/cube/CMakeLists.txt
+++ b/cube/CMakeLists.txt
@@ -203,11 +203,6 @@ else()
message(FATAL_ERROR "Unsupported Platform!")
endif()
-if (ENABLE_ADDRESS_SANITIZER)
- target_compile_options(vkcube PUBLIC -fsanitize=address)
- target_link_options(vkcube PUBLIC -fsanitize=address)
-endif()
-
target_include_directories(vkcube PRIVATE .)
if (ANDROID)
@@ -244,11 +239,6 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "Linux|BSD")
${OPTIONAL_WAYLAND_DATA_FILES})
target_link_libraries(vkcubepp Vulkan::Headers Vulkan::Loader)
target_compile_definitions(vkcubepp PUBLIC ${CUBE_PLATFORM})
-
- if (ENABLE_ADDRESS_SANITIZER)
- target_compile_options(vkcubepp PUBLIC -fsanitize=address)
- target_link_options(vkcubepp PUBLIC -fsanitize=address)
- endif ()
else()
add_executable(vkcubepp
WIN32
@@ -308,10 +298,5 @@ if (CMAKE_SYSTEM_NAME MATCHES "Linux|BSD")
target_link_libraries(vkcube-wayland PRIVATE rt)
endif()
install(TARGETS vkcube-wayland)
-
- if (ENABLE_ADDRESS_SANITIZER)
- target_compile_options(vkcube-wayland PUBLIC -fsanitize=address)
- target_link_options(vkcube-wayland PUBLIC -fsanitize=address)
- endif ()
endif()
endif()
diff --git a/icd/CMakeLists.txt b/icd/CMakeLists.txt
index 5136ec55..6d74f247 100644
--- a/icd/CMakeLists.txt
+++ b/icd/CMakeLists.txt
@@ -64,11 +64,6 @@ if(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU|Clang")
-Wno-unused-function
-Wno-sign-compare
)
-
- if (ENABLE_ADDRESS_SANITIZER)
- target_compile_options(VkICD_mock_icd PUBLIC -fsanitize=address)
- target_link_options(VkICD_mock_icd PUBLIC -fsanitize=address)
- endif()
endif()
if(MSVC)
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 8d299ee5..1838261a 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -67,11 +67,6 @@ if (DEFINED GIT_BRANCH_NAME AND DEFINED GIT_TAG_INFO)
target_compile_definitions(vulkan_tools_tests PRIVATE GIT_BRANCH_NAME="${GIT_BRANCH_NAME}" GIT_TAG_INFO="${GIT_TAG_INFO}")
endif()
-if (ENABLE_ADDRESS_SANITIZER)
- target_compile_options(vulkan_tools_tests PUBLIC -fsanitize=address)
- target_link_options(vulkan_tools_tests PUBLIC -fsanitize=address)
-endif ()
-
if (WIN32)
# Copy the loader shared lib (if built) to the test application directory so the test app finds it.
add_custom_command(TARGET vulkan_tools_tests POST_BUILD
diff --git a/vulkaninfo/CMakeLists.txt b/vulkaninfo/CMakeLists.txt
index 03956d76..e0dbab51 100644
--- a/vulkaninfo/CMakeLists.txt
+++ b/vulkaninfo/CMakeLists.txt
@@ -86,11 +86,6 @@ if (CMAKE_SYSTEM_NAME MATCHES "Linux|BSD")
target_compile_definitions(vulkaninfo PRIVATE VK_USE_PLATFORM_DIRECTFB_EXT VK_NO_PROTOTYPES)
target_link_libraries(vulkaninfo PRIVATE PkgConfig::DirectFB)
endif()
-
- if (ENABLE_ADDRESS_SANITIZER)
- target_compile_options(vulkaninfo PRIVATE -fsanitize=address)
- target_link_options(vulkaninfo PRIVATE -fsanitize=address)
- endif ()
endif()
if(APPLE)