diff --git a/CMakeLists.txt b/CMakeLists.txt index fe16422e250..ea6f59fc84b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -315,6 +315,7 @@ function(common_compile_options TARGET) target_compile_options(${TARGET} PRIVATE -fno-exceptions -fno-rtti + -Wno-psabi ) if (${DAWN_ENABLE_MSAN}) diff --git a/src/dawn/node/CMakeLists.txt b/src/dawn/node/CMakeLists.txt index 854c3975d2e..ae3a0132886 100644 --- a/src/dawn/node/CMakeLists.txt +++ b/src/dawn/node/CMakeLists.txt @@ -66,6 +66,7 @@ set_target_properties(dawn_node PROPERTIES PREFIX "" OUTPUT_NAME "dawn" SUFFIX ".node" + ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}" RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}" LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}" CXX_STANDARD 17 @@ -92,12 +93,16 @@ file(READ "${NODE_API_HEADERS_DIR}/symbols.js" NAPI_SYMBOLS_JS_CONTENT) string(REGEX MATCHALL "napi_[a-z0-9_]*" NAPI_SYMBOLS "${NAPI_SYMBOLS_JS_CONTENT}") if (WIN32) + set(NODE_API_BINARY_FILE "node.exe" CACHE STRING + "The name of the file in which to find the Node-API symbols." + ) + # Generate the NapiSymbols.def file from the Napi symbol list set(NAPI_SYMBOLS_DEF "${DAWN_NODE_GEN_DIR}/NapiSymbols.def") list(TRANSFORM NAPI_SYMBOLS PREPEND " ") list(TRANSFORM NAPI_SYMBOLS APPEND "\n") string(REPLACE ";" "" NAPI_SYMBOLS "${NAPI_SYMBOLS}") - string(PREPEND NAPI_SYMBOLS "LIBRARY node.exe\nEXPORTS\n") + string(PREPEND NAPI_SYMBOLS "LIBRARY ${NODE_API_BINARY_FILE}\nEXPORTS\n") file(GENERATE OUTPUT "${NAPI_SYMBOLS_DEF}" CONTENT "${NAPI_SYMBOLS}") # Generate the NapiSymbols.lib from the NapiSymbols.def file set(NAPI_SYMBOLS_LIB "${DAWN_NODE_GEN_DIR}/NapiSymbols.lib") diff --git a/src/dawn/node/Module.cpp b/src/dawn/node/Module.cpp index d8acf00b2c8..9f4b70f2912 100644 --- a/src/dawn/node/Module.cpp +++ b/src/dawn/node/Module.cpp @@ -55,7 +55,7 @@ Napi::Value CreateGPU(const Napi::CallbackInfo& info) { // Initialize() initializes the Dawn node module, registering all the WebGPU // types into the global object, and adding the 'create' function on the exported // object. -Napi::Object Initialize(Napi::Env env, Napi::Object exports) { +NAPI_MODULE_EXPORT Napi::Object Initialize(Napi::Env env, Napi::Object exports) { // Initialize Tint tint::Initialize(); diff --git a/src/dawn/node/NapiSymbols.cpp b/src/dawn/node/NapiSymbols.cpp index 01a184f03bd..a4b8b91f2f2 100644 --- a/src/dawn/node/NapiSymbols.cpp +++ b/src/dawn/node/NapiSymbols.cpp @@ -25,12 +25,16 @@ #error "NapiSymbols.cpp is not used on Windows" #endif +#ifdef __clang__ #define NAPI_SYMBOL(NAME) \ __attribute__((weak)) void NAME() { \ UNREACHABLE( \ - "#NAME is a weak stub, and should have been runtime replaced by the node " \ + #NAME " is a weak stub, and should have been runtime replaced by the node "\ "implementation"); \ } +#else +#define NAPI_SYMBOL(NAME) +#endif extern "C" { // List of Napi symbols generated from the node_api_headers/symbols.js file diff --git a/src/tint/resolver/const_eval.cc b/src/tint/resolver/const_eval.cc index ce38b1d8066..ddcb1e03a05 100644 --- a/src/tint/resolver/const_eval.cc +++ b/src/tint/resolver/const_eval.cc @@ -1962,7 +1962,7 @@ ConstEval::Result ConstEval::OpShiftRight(const sem::Type* ty, const UT e1u = static_cast(e1); const UT e2u = static_cast(e2); - auto signed_shift_right = [&] { + [[maybe_unused]] auto signed_shift_right = [&] { // In C++, right shift of a signed negative number is implementation-defined. // Although most implementations sign-extend, we do it manually to ensure it works // correctly on all implementations.