CMake: Fix sanitizer builds

The sanitizer flags need to be applied to all compilation units, and to all final link stages.

As this is whole-project (dawn + tint), these options have been promoted to DAWN_ options.

Bug: dawn:1339
Change-Id: I17beb5bd2a8f15de9d8f13d132356b5c663d71bf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/86143
Kokoro-Run: Ben Clayton <bclayton@google.com>
Reviewed-by: Antonio Maiorano <amaiorano@google.com>
Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
Ben Clayton
2022-04-08 18:08:36 +00:00
committed by Dawn LUCI CQ
parent d820f48f35
commit 96e245e576
12 changed files with 52 additions and 27 deletions

View File

@@ -64,6 +64,7 @@ DawnJSONGenerator(
# directory, they don't see the GENERATED property and fail to configure
# because the file doesn't exist on disk.
add_library(dawn_headers STATIC ${DAWN_DUMMY_FILE})
common_compile_options(dawn_headers)
target_sources(dawn_headers PRIVATE
"${DAWN_INCLUDE_DIR}/dawn/dawn_wsi.h"
${DAWN_HEADERS_GEN_SOURCES}
@@ -83,6 +84,7 @@ DawnJSONGenerator(
# This headers only library needs to be a STATIC library, see comment for
# dawn_headers above.
add_library(dawncpp_headers STATIC ${DAWN_DUMMY_FILE})
common_compile_options(dawncpp_headers)
target_sources(dawncpp_headers PRIVATE
"${DAWN_INCLUDE_DIR}/dawn/EnumClassBitmasks.h"
${DAWNCPP_HEADERS_GEN_SOURCES}
@@ -100,6 +102,7 @@ DawnJSONGenerator(
)
add_library(dawncpp STATIC ${DAWN_DUMMY_FILE})
common_compile_options(dawncpp)
target_sources(dawncpp PRIVATE ${DAWNCPP_GEN_SOURCES})
target_link_libraries(dawncpp PUBLIC dawncpp_headers)
@@ -114,6 +117,7 @@ DawnJSONGenerator(
)
add_library(dawn_proc ${DAWN_DUMMY_FILE})
common_compile_options(dawn_proc)
target_compile_definitions(dawn_proc PRIVATE "WGPU_IMPLEMENTATION")
if(BUILD_SHARED_LIBS)
target_compile_definitions(dawn_proc PRIVATE "WGPU_SHARED_LIBRARY")

View File

@@ -21,6 +21,7 @@ DawnGenerator(
)
add_library(dawn_common STATIC ${DAWN_DUMMY_FILE})
common_compile_options(dawn_common)
target_sources(dawn_common PRIVATE
${DAWN_VERSION_AUTOGEN_SOURCES}
"Alloc.h"

View File

@@ -19,6 +19,7 @@ DawnJSONGenerator(
)
add_library(dawn_native ${DAWN_DUMMY_FILE})
common_compile_options(dawn_native)
target_compile_definitions(dawn_native PRIVATE "DAWN_NATIVE_IMPLEMENTATION")
if(BUILD_SHARED_LIBS)
@@ -548,6 +549,7 @@ DawnJSONGenerator(
)
add_library(webgpu_dawn ${DAWN_DUMMY_FILE})
common_compile_options(webgpu_dawn)
target_link_libraries(webgpu_dawn PRIVATE dawn_native)
target_compile_definitions(webgpu_dawn PRIVATE "WGPU_IMPLEMENTATION")
if(BUILD_SHARED_LIBS)

View File

@@ -61,6 +61,7 @@ add_subdirectory(interop)
add_library(dawn_node SHARED
"Module.cpp"
)
common_compile_options(dawn_node)
set_target_properties(dawn_node PROPERTIES
PREFIX ""
OUTPUT_NAME "dawn"

View File

@@ -66,6 +66,7 @@ add_library(dawn_node_binding STATIC
"GPUTextureView.cpp"
"GPUTextureView.h"
)
common_compile_options(dawn_node_binding)
target_include_directories(dawn_node_binding
PRIVATE

View File

@@ -47,6 +47,7 @@ add_library(dawn_node_interop STATIC
"${INTEROP_WEBGPU_H}"
"${INTEROP_WEBGPU_CPP}"
)
common_compile_options(dawn_node_interop)
target_include_directories(dawn_node_interop
PRIVATE

View File

@@ -13,6 +13,7 @@
# limitations under the License.
add_library(dawn_platform ${DAWN_DUMMY_FILE})
common_compile_options(dawn_platform)
target_compile_definitions(dawn_platform PRIVATE "DAWN_PLATFORM_IMPLEMENTATION")
if(BUILD_SHARED_LIBS)

View File

@@ -13,6 +13,7 @@
# limitations under the License.
add_library(dawn_utils STATIC ${DAWN_DUMMY_FILE})
common_compile_options(dawn_utils)
target_sources(dawn_utils PRIVATE
"ComboRenderBundleEncoderDescriptor.cpp"
"ComboRenderBundleEncoderDescriptor.h"

View File

@@ -19,6 +19,7 @@ DawnJSONGenerator(
)
add_library(dawn_wire ${DAWN_DUMMY_FILE})
common_compile_options(dawn_wire)
target_compile_definitions(dawn_wire PRIVATE "DAWN_WIRE_IMPLEMENTATION")
if(BUILD_SHARED_LIBS)