Skip to content

Commit b397959

Browse files
committed
add detailed note regarding dawn modifications to fix linker errors on mac
1 parent f3f3b27 commit b397959

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

third_party/lib/README.md

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,70 @@ cmake -DBUILD_SHARED_LIBS=ON -DDAWN_BUILD_MONOLITHIC_LIBRARY=ON -DCMAKE_BUILD_TY
1515
```
1616
Library artifact is at `src/dawn/native/libwebgpu_dawn.dylib` (7.4 MB)
1717

18+
Note that for OSX builds, needed to make modifications to the `CMakeLists.txt` file to get the build to work. Specifically, needed to add the following `FORCE_OBJECT` flags to dawn_glfw, dawn_wgpu_utils, and dawn_test_utils. Otherwise we get linker errors for missing symbols when building the shared library. This issue does not appear to be present on Linux builds.
19+
20+
```
21+
(base) austinhuang@Austins-MacBook-Pro dawn % git diff 556f960f44690b3b808c779c08b44d48d4292925 5a00ab1fbc22d6ebbab39
22+
diff --git a/src/dawn/glfw/CMakeLists.txt b/src/dawn/glfw/CMakeLists.txt
23+
index dc3f3ade03..d6d8d0ef4f 100644
24+
--- a/src/dawn/glfw/CMakeLists.txt
25+
+++ b/src/dawn/glfw/CMakeLists.txt
26+
@@ -40,6 +40,7 @@ endif ()
27+
28+
dawn_add_library(
29+
dawn_glfw
30+
+ FORCE_OBJECT
31+
UTILITY_TARGET dawn_internal_config
32+
HEADERS
33+
"${headers}"
34+
@@ -56,5 +57,5 @@ target_compile_definitions(dawn_glfw PRIVATE "WGPU_GLFW_IMPLEMENTATION")
35+
if(BUILD_SHARED_LIBS)
36+
target_compile_definitions(dawn_glfw PUBLIC "WGPU_GLFW_SHARED_LIBRARY")
37+
endif()
38+
-
39+
+# target_link_libraries(dawn_glfw PUBLIC webgpu_dawn)
40+
add_library(webgpu_glfw ALIAS dawn_glfw)
41+
diff --git a/src/dawn/utils/CMakeLists.txt b/src/dawn/utils/CMakeLists.txt
42+
index 5eb7120d99..3b00664829 100644
43+
--- a/src/dawn/utils/CMakeLists.txt
44+
+++ b/src/dawn/utils/CMakeLists.txt
45+
@@ -36,6 +36,7 @@ endif()
46+
47+
dawn_add_library(
48+
dawn_wgpu_utils
49+
+ FORCE_OBJECT
50+
ENABLE_EMSCRIPTEN
51+
UTILITY_TARGET dawn_internal_config
52+
PRIVATE_HEADERS
53+
@@ -55,6 +56,8 @@ dawn_add_library(
54+
${private_wgpu_depends}
55+
)
56+
57+
+# target_link_libraries(dawn_wgpu_utils PUBLIC webgpu_dawn)
58+
+
59+
# Needed by WGPUHelpers
60+
target_compile_definitions(dawn_wgpu_utils
61+
PUBLIC
62+
@@ -66,6 +69,7 @@ target_compile_definitions(dawn_wgpu_utils
63+
###############################################################################
64+
dawn_add_library(
65+
dawn_test_utils
66+
+ FORCE_OBJECT
67+
UTILITY_TARGET dawn_internal_config
68+
PRIVATE_HEADERS
69+
"BinarySemaphore.h"
70+
@@ -84,6 +88,9 @@ dawn_add_library(
71+
dawn::partition_alloc
72+
)
73+
74+
+# target_link_libraries(dawn_test_utils PUBLIC webgpu_dawn dawn_wgpu_utils dawn_proc)
75+
+
76+
+
77+
###############################################################################
78+
# Dawn system utilities
79+
# - Used in tests and samples
80+
```
81+
1882
# Release 0.1.0
1983

2084
https://github.com/jspanchu/webgpu-dawn-binaries

0 commit comments

Comments
 (0)