@@ -3,17 +3,24 @@ message(STATUS "dawn")
33message (STATUS "----------------------------------------------------------------" )
44
55set (CMAKE_DISABLE_FIND_PACKAGE_Python3 OFF )
6+ if (APPLE )
7+ set (metal ON )
8+ set (vulkan OFF )
9+ else ()
10+ set (metal OFF )
11+ set (vulkan ON )
12+ endif ()
613
714# dawn
815set (DAWN_ENABLE_INSTALL ON CACHE INTERNAL "Enable install step for Dawn libraries" FORCE)
916set (DAWN_ENABLE_D3D11 OFF CACHE INTERNAL "Enable compilation of the D3D11 backend" FORCE)
1017set (DAWN_ENABLE_D3D12 OFF CACHE INTERNAL "Enable compilation of the D3D12 backend" FORCE)
11- set (DAWN_ENABLE_METAL OFF CACHE INTERNAL "Enable compilation of the Metal backend" FORCE)
18+ set (DAWN_ENABLE_METAL ${metal} CACHE INTERNAL "Enable compilation of the Metal backend" FORCE)
1219set (DAWN_ENABLE_NULL OFF CACHE INTERNAL "Enable compilation of the Null backend" FORCE)
1320set (DAWN_ENABLE_WEBGPU_ON_WEBGPU OFF CACHE INTERNAL "Enable compilation of the WebGPU backend" FORCE)
1421set (DAWN_ENABLE_DESKTOP_GL OFF CACHE INTERNAL "Enable compilation of the OpenGL backend" FORCE)
1522set (DAWN_ENABLE_OPENGLES OFF CACHE INTERNAL "Enable compilation of the OpenGL ES backend" FORCE)
16- set (DAWN_ENABLE_VULKAN ON CACHE INTERNAL "Enable compilation of the Vulkan backend" FORCE)
23+ set (DAWN_ENABLE_VULKAN ${vulkan} CACHE INTERNAL "Enable compilation of the Vulkan backend" FORCE)
1724set (DAWN_FORCE_SYSTEM_COMPONENT_LOAD ON CACHE INTERNAL "Allow system component fallback" FORCE)
1825set (DAWN_USE_WAYLAND OFF CACHE INTERNAL "Enable support for Wayland surface" FORCE)
1926set (DAWN_USE_X11 OFF CACHE INTERNAL "Enable support for X11 surface" FORCE)
@@ -31,8 +38,8 @@ set(TINT_BUILD_WGSL_READER ON CACHE INTERNAL "Build the WGSL input reader" FORCE
3138set (TINT_BUILD_GLSL_WRITER OFF CACHE INTERNAL "Build the GLSL output writer" FORCE)
3239set (TINT_BUILD_GLSL_VALIDATOR OFF CACHE INTERNAL "Build the GLSL output validator" FORCE)
3340set (TINT_BUILD_HLSL_WRITER OFF CACHE INTERNAL "Build the HLSL output writer" FORCE)
34- set (TINT_BUILD_MSL_WRITER OFF CACHE INTERNAL "Build the MSL output writer" FORCE)
35- set (TINT_BUILD_SPV_WRITER ON CACHE INTERNAL "Build the SPIR-V output writer" FORCE)
41+ set (TINT_BUILD_MSL_WRITER ${metal} CACHE INTERNAL "Build the MSL output writer" FORCE)
42+ set (TINT_BUILD_SPV_WRITER ${vulkan} CACHE INTERNAL "Build the SPIR-V output writer" FORCE)
3643set (TINT_BUILD_WGSL_WRITER ON CACHE INTERNAL "Build the WGSL output writer" FORCE)
3744set (TINT_ENABLE_INSTALL OFF CACHE INTERNAL "Enable install step for Tint libraries" FORCE)
3845set (TINT_BUILD_CMD_TOOLS OFF CACHE INTERNAL "Build the Tint command line tools" FORCE)
@@ -43,12 +50,18 @@ set(TINT_ENABLE_IR_VALIDATION ON CACHE INTERNAL "Enable IR validation for backen
4350# protobuf
4451add_library (libprotobuf-mutator INTERFACE ) # subvert unnecessary dependencies
4552
53+ unset (metal)
54+ unset (vulkan)
55+
4656# add the externals
4757add_subdirectory (dawn)
4858
4959# dawn
5060add_library (cage_dawn INTERFACE )
5161target_link_libraries (cage_dawn INTERFACE $<TARGET_LINKER_FILE:webgpu_dawn> $<TARGET_LINKER_FILE:webgpu_glfw>)
62+ if (APPLE )
63+ target_link_libraries (cage_dawn INTERFACE "-framework Cocoa" "-framework IOKit" "-framework Foundation" "-framework IOSurface" "-framework QuartzCore" "-framework Metal" )
64+ endif ()
5265target_include_directories (cage_dawn INTERFACE $<TARGET_PROPERTY:webgpu_dawn,INTERFACE_INCLUDE_DIRECTORIES > $<TARGET_PROPERTY:webgpu_glfw,INTERFACE_INCLUDE_DIRECTORIES >)
5366add_dependencies (cage_dawn webgpu_dawn webgpu_glfw)
5467add_library (cage::dawn ALIAS cage_dawn)
0 commit comments