Skip to content

Commit 3c527e3

Browse files
manuel5975pmanuel5975p
manuel5975p
authored andcommitted
change DAWN_BUILD_MONOLITHIC_LIBRARY from OFF/ON to OFF/STATIC/SHARED
1 parent 2e479b9 commit 3c527e3

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

CMakeLists.txt

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -334,11 +334,20 @@ message(STATUS "Webgpu IDL path: ${WEBGPU_IDL_PATH}")
334334
message(STATUS "Go exe: ${GO_EXECUTABLE}")
335335
message(STATUS "")
336336

337-
option(DAWN_FETCH_DEPENDENCIES "Use fetch_dawn_dependencies.py as an alternative to using depot_tools" OFF)
338-
option(DAWN_BUILD_MONOLITHIC_LIBRARY "Bundle all dawn components into a single shared library." ON)
337+
set(DAWN_BUILD_MONOLITHIC_LIBRARY "OFF" CACHE STRING "Build monolithic library: SHARED, STATIC, or OFF.")
338+
339+
set_property(CACHE DAWN_BUILD_MONOLITHIC_LIBRARY PROPERTY STRINGS SHARED SHARED STATIC)
340+
341+
string(TOUPPER "${DAWN_BUILD_MONOLITHIC_LIBRARY}" _option_upper)
342+
343+
if(NOT _option_upper STREQUAL "OFF" AND
344+
NOT _option_upper STREQUAL "SHARED" AND
345+
NOT _option_upper STREQUAL "STATIC")
346+
message(FATAL_ERROR "DAWN_BUILD_MONOLITHIC_LIBRARY must be SHARED, STATIC, or OFF, but was \"${DAWN_BUILD_MONOLITHIC_LIBRARY}\".")
347+
endif()
339348

340-
message(STATUS "Dawn fetch dependencies: ${DAWN_FETCH_DEPENDENCIES}")
341349
message(STATUS "Dawn build monolithic library: ${DAWN_BUILD_MONOLITHIC_LIBRARY}")
350+
message(STATUS "Dawn fetch dependencies: ${DAWN_FETCH_DEPENDENCIES}")
342351
message(STATUS "")
343352

344353
# Much of the backend code is shared among desktop OpenGL and OpenGL ES

src/dawn/native/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -903,7 +903,7 @@ if (DAWN_BUILD_MONOLITHIC_LIBRARY)
903903
)
904904
# Bundle all objects of dawn_native, it's public dependencies and private dependencies.
905905
include(BundleLibraries)
906-
bundle_libraries(webgpu_dawn STATIC dawn::dawn_native_objects)
906+
bundle_libraries(webgpu_dawn ${DAWN_BUILD_MONOLITHIC_LIBRARY} dawn::dawn_native_objects)
907907
add_library(dawn::webgpu_dawn ALIAS webgpu_dawn)
908908
# Compile backend specific sources along with webgpu_dawn_native_proc sources for export macros to get applied.
909909
target_sources(webgpu_dawn

0 commit comments

Comments
 (0)