Fix Mac cmake build for dawn.node When I build this in the node-webgpu repo and run the tests in that repo I get this error `out/cmake-release/gen/node/NapiSymbols.h:26: UNREACHABLE: napi_create_string_utf8() napi_create_string_utf8 is a weak stub, and should have been runtime replaced by the node implementation` Fixed by updating the CMake configuration to match the GN build logic. Bug: 493513159 Fixes: 493513159 Change-Id: I3091fd8a9dd6c192e5b6bece3ddf0ef9226ffb75 Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/297815 Reviewed-by: Antonio Maiorano <amaiorano@google.com> Commit-Queue: Antonio Maiorano <amaiorano@google.com> Auto-Submit: Gregg Tavares <gman@chromium.org>
diff --git a/src/dawn/node/CMakeLists.txt b/src/dawn/node/CMakeLists.txt index 374dbb2..f28474b 100644 --- a/src/dawn/node/CMakeLists.txt +++ b/src/dawn/node/CMakeLists.txt
@@ -179,6 +179,10 @@ string(REPLACE ";" "" NAPI_SYMBOLS "${NAPI_SYMBOLS}") file(GENERATE OUTPUT "${NAPI_SYMBOLS_H}" CONTENT "${NAPI_SYMBOLS}") target_sources(dawn_node PRIVATE "NapiSymbols.cpp") + target_compile_definitions(dawn_node PRIVATE "NAPI_SYMBOL_WEAK_DECL_ONLY") + if (APPLE) + target_link_options(dawn_node PRIVATE "-Wl,-undefined,dynamic_lookup") + endif() endif() macro(javascript file)