Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ on:
push:
branches:
- main
- dev
pull_request:
types: [opened, reopened, labeled, unlabeled, synchronize]
branches:
- main
- dev
workflow_dispatch:

jobs:
Expand Down
61 changes: 61 additions & 0 deletions .github/workflows/cmake-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: CMake CI

on:
push:
branches:
- main
- dev
pull_request:
types: [opened, reopened, labeled, unlabeled, synchronize]
branches:
- main
- dev
workflow_dispatch:

jobs:
build:
strategy:
matrix:
os: [ubuntu-latest, macos-latest]

runs-on: ${{ matrix.os }}

steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
submodules: recursive

- name: Install dependencies (Ubuntu)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y cmake
sudo apt-get install -y libvulkan1 mesa-vulkan-drivers vulkan-tools
sudo apt-get install -y libxrandr-dev libxinerama-dev libxcursor-dev libxi-dev libgl-dev libx11-xcb-dev

- name: Build with CMake
run: CMAKE_VERBOSE_MAKEFILE=1 make all-cmake

- name: Test
run: make test-cmake

- name: Upload WebGPU artifacts (macOS)
if: matrix.os == 'macos-latest'
uses: actions/upload-artifact@v4
with:
name: webgpu-macos-arm64
path: |
external/dawn/build_mac_arm64/src/dawn/native/libwebgpu_dawn.dylib
external/dawn/build_mac_arm64/gen/include/dawn/webgpu.h
retention-days: 7

- name: Upload WebGPU artifacts (Linux)
if: matrix.os == 'ubuntu-latest'
uses: actions/upload-artifact@v4
with:
name: webgpu-linux-x86_64
path: |
external/dawn/build_unix_x86_64/src/dawn/native/libwebgpu_dawn.so
external/dawn/build_unix_x86_64/gen/include/dawn/webgpu.h
retention-days: 7
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ endif()
option(DEBUG "Option to enable debug flags" OFF)
if(DEBUG)
set(CMAKE_BUILD_TYPE Debug)
set(CMAKE_CXX_FLAGS "-O0 -g")
set(CMAKE_CXX_FLAGS "-O0 -g -fsanitize=address -fno-omit-frame-pointer")
endif()

include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/dawn.cmake")
Expand Down
12 changes: 11 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
ifeq ($(shell uname),Darwin)
NUM_JOBS=$(shell sysctl -n hw.ncpu)
else
NUM_JOBS=$(shell nproc)
endif
CXX=clang++

.PHONY: default examples/hello_world/build/hello_world tests libgpu debug build check-clang clean-build clean all watch-tests docs

GPUCPP ?= $(PWD)
LIBDIR ?= $(GPUCPP)/third_party/lib
LIBSPEC ?= . $(GPUCPP)/source
INCLUDES ?= -I$(GPUCPP) -I$(GPUCPP)/third_party/headers
INCLUDES ?= -I$(GPUCPP) -I$(GPUCPP)/third_party/headers -I$(GPUCPP)/third_party/headers/webgpu
ifeq ($(shell $(CXX) -std=c++17 -x c++ -E -include array - < /dev/null > /dev/null 2>&1 ; echo $$?),0)
STDLIB :=
else
Expand Down Expand Up @@ -69,6 +73,9 @@ all: dawnlib check-clang check-linux-vulkan lib pch
cd examples/shadertui && make build/shadertui
cd examples/transpose && make build/transpose

test-gpu: dawnlib check-clang
$(LIBSPEC) && clang++ -std=c++17 -g -fsanitize=address -fno-omit-frame-pointer -Wall $(INCLUDES) test/test_gpu.cpp numeric_types/half.cpp -L$(LIBDIR) -lwebgpu_dawn -Wl,-rpath,$(GPUCPP)/third_party/lib -ldl -o build/test_gpu && ./build/test_gpu

# Test 16-bit floating point type
test-half: dawnlib check-clang
$(LIBSPEC) && clang++ -std=c++17 $(INCLUDES) numeric_types/half.cpp -L$(LIBDIR) -lwebgpu_dawn -ldl -o build/half && ./build/half
Expand Down Expand Up @@ -97,6 +104,9 @@ debug-cmake: check-clang check-cmake
all-cmake: check-clang check-cmake
$(CMAKE_CMD) $(RELEASE_FLAGS) && make -j$(NUM_JOBS) $(TARGET_ALL)

test-cmake: check-clang check-cmake
./build/test_gpu

################################################################################
# Cleanup
################################################################################
Expand Down
2 changes: 1 addition & 1 deletion bindings/python/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ else
STDLIB := -stdlib=libc++
endif

FLAGS=-shared -fPIC -std=c++17 $(STDLIB) -I$(GPUCPP) -I$(GPUCPP)/third_party/headers -L$(GPUCPP)/third_party/lib -lwebgpu_dawn \
FLAGS=-shared -fPIC -std=c++17 $(STDLIB) -I$(GPUCPP) -I$(GPUCPP)/third_party/headers -I$(GPUCPP)/third_party/headers/webgpu -L$(GPUCPP)/third_party/lib -lwebgpu_dawn \
`python3 -m pybind11 --includes` \
`python3-config --includes --ldflags`

Expand Down
Loading
Loading