Skip to content

Commit b8a2207

Browse files
committed
Work on emscripten build
1 parent d036f10 commit b8a2207

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

ggml/src/ggml-webgpu/CMakeLists.txt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
cmake_minimum_required(VERSION 3.13)
22

3-
find_package(Dawn REQUIRED)
43
find_package(Python3 REQUIRED)
54

65
# Shader locations
@@ -37,9 +36,19 @@ ggml_add_backend_library(ggml-webgpu
3736

3837
add_dependencies(ggml-webgpu generate_shaders)
3938

39+
if(CMAKE_SYSTEM_NAME STREQUAL "Emscripten")
40+
set(EMDAWNWEBGPU_DIR "" CACHE PATH "Path to emdawnwebgpu_pkg")
41+
42+
target_compile_options(ggml-webgpu PRIVATE "--use-port=${EMDAWNWEBGPU_DIR}/emdawnwebgpu.port.py")
43+
target_link_options(ggml-webgpu PRIVATE "--use-port=${EMDAWNWEBGPU_DIR}/emdawnwebgpu.port.py")
44+
else()
45+
find_package(Dawn REQUIRED)
46+
set(DawnWebGPU_TARGET dawn::webgpu_dawn)
47+
endif()
48+
4049
if (GGML_WEBGPU_DEBUG)
4150
target_compile_definitions(ggml-webgpu PRIVATE GGML_WEBGPU_DEBUG=1)
4251
endif()
4352

4453
target_include_directories(ggml-webgpu PRIVATE ${SHADER_OUTPUT_DIR})
45-
target_link_libraries(ggml-webgpu PRIVATE dawn::webgpu_dawn)
54+
target_link_libraries(ggml-webgpu PRIVATE ${DawnWebGPU_TARGET})

ggml/src/ggml-webgpu/ggml-webgpu.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#include "ggml-webgpu.h"
22

33
#include <webgpu/webgpu_cpp.h>
4-
#include <webgpu/webgpu_cpp_print.h>
54

65
#include "ggml-impl.h"
76
#include "ggml-backend-impl.h"

0 commit comments

Comments
 (0)