Build with nortti/exceptions and fvisibility=hidden

This both makes the CMake build closer to the Chromium build, and
reduces the binary size heavily.
This commit is contained in:
Corentin Wallez 2018-07-26 14:54:08 +02:00 committed by Corentin Wallez
parent 1dd8b12823
commit 012c149fd9
5 changed files with 8 additions and 2 deletions

View File

@ -119,6 +119,8 @@ else()
list(APPEND DAWN_FLAGS "$<$<COMPILE_LANGUAGE:CXX>:-std=c++14>")
# enable -Wold-style-cast on C++
list(APPEND DAWN_FLAGS "$<$<COMPILE_LANGUAGE:CXX>:-Wold-style-cast>")
list(APPEND DAWN_FLAGS "-fvisibility=hidden" "$<$<COMPILE_LANGUAGE:CXX>:-fno-rtti>" "-fno-exceptions")
list(APPEND DAWN_FLAGS "-fPIC")
list(APPEND DAWN_INTERNAL_FLAGS "-Wall" "-Wextra")

View File

@ -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 <tinygltfloader/tiny_gltf_loader.h>
#include "GLFW/glfw3.h"

View File

@ -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)

View File

@ -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)

View File

@ -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;
}