diff --git a/CMakeLists.txt b/CMakeLists.txt index 1b35ec5a90..249e974201 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -119,6 +119,8 @@ else() list(APPEND DAWN_FLAGS "$<$:-std=c++14>") # enable -Wold-style-cast on C++ list(APPEND DAWN_FLAGS "$<$:-Wold-style-cast>") + + list(APPEND DAWN_FLAGS "-fvisibility=hidden" "$<$:-fno-rtti>" "-fno-exceptions") list(APPEND DAWN_FLAGS "-fPIC") list(APPEND DAWN_INTERNAL_FLAGS "-Wall" "-Wextra") diff --git a/examples/glTFViewer/glTFViewer.cpp b/examples/glTFViewer/glTFViewer.cpp index 6347fb2ea0..fce4f4fdef 100644 --- a/examples/glTFViewer/glTFViewer.cpp +++ b/examples/glTFViewer/glTFViewer.cpp @@ -20,6 +20,7 @@ #include "SampleUtils.h" +#include "common/Assert.h" #include "common/Math.h" #include "common/Constants.h" #include "utils/DawnHelpers.h" @@ -34,6 +35,7 @@ #define TINYGLTF_LOADER_IMPLEMENTATION #define STB_IMAGE_IMPLEMENTATION +#define PICOJSON_ASSERT ASSERT #include #include "GLFW/glfw3.h" diff --git a/src/dawn_native/CMakeLists.txt b/src/dawn_native/CMakeLists.txt index 9ef242b4aa..1137eeac53 100644 --- a/src/dawn_native/CMakeLists.txt +++ b/src/dawn_native/CMakeLists.txt @@ -409,7 +409,7 @@ list(APPEND DAWN_NATIVE_SOURCES # this, so instead we duplicate the deps everywhere. add_library(libdawn_native_objects OBJECT ${DAWN_NATIVE_SOURCES}) DawnInternalTarget("dawn_native" libdawn_native_objects) -target_compile_definitions(libdawn_native_objects PRIVATE DAWN_NATIVE_IMPLEMENTATION) +target_compile_definitions(libdawn_native_objects PRIVATE DAWN_NATIVE_IMPLEMENTATION SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS) target_include_directories(libdawn_native_objects PRIVATE ${DAWN_NATIVE_INCLUDE_DIRS}) add_dependencies(libdawn_native_objects dawn_native_utils_autogen) diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt index 31cf434286..4d70444c25 100644 --- a/third_party/CMakeLists.txt +++ b/third_party/CMakeLists.txt @@ -131,6 +131,7 @@ if (DAWN_ENABLE_OPENGL OR NEED_SPIRV_CROSS_GLSL) endif() add_library(spirv_cross STATIC ${SPIRV_CROSS_SOURCES}) +target_compile_definitions(spirv_cross PUBLIC SPIRV_CROSS_EXCEPTIONS_TO_ASSERTIONS) set(SPIRV_CROSS_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR} PARENT_SCOPE) DawnExternalTarget("third_party" spirv_cross) diff --git a/third_party/picojson/picojson.h b/third_party/picojson/picojson.h index 045dc537ba..218049764c 100644 --- a/third_party/picojson/picojson.h +++ b/third_party/picojson/picojson.h @@ -216,7 +216,8 @@ namespace picojson { isnan(n) || isinf(n) #endif ) { - throw std::overflow_error(""); + // throw std::overflow_error(""); + PICOJSON_ASSERT(false); } u_.number_ = n; }