|
| 1 | +ifeq ($(shell uname),Darwin) |
| 2 | +NUM_JOBS=$(shell sysctl -n hw.ncpu) |
| 3 | +else |
1 | 4 | NUM_JOBS=$(shell nproc) |
| 5 | +endif |
2 | 6 | CXX=clang++ |
3 | 7 |
|
4 | 8 | .PHONY: default examples/hello_world/build/hello_world tests libgpu debug build check-clang clean-build clean all watch-tests docs |
5 | 9 |
|
6 | 10 | GPUCPP ?= $(PWD) |
7 | 11 | LIBDIR ?= $(GPUCPP)/third_party/lib |
8 | 12 | LIBSPEC ?= . $(GPUCPP)/source |
9 | | -INCLUDES ?= -I$(GPUCPP) -I$(GPUCPP)/third_party/headers |
| 13 | +INCLUDES ?= -I$(GPUCPP) -I$(GPUCPP)/third_party/headers -I$(GPUCPP)/third_party/headers/webgpu |
10 | 14 | ifeq ($(shell $(CXX) -std=c++17 -x c++ -E -include array - < /dev/null > /dev/null 2>&1 ; echo $$?),0) |
11 | 15 | STDLIB := |
12 | 16 | else |
@@ -69,6 +73,9 @@ all: dawnlib check-clang check-linux-vulkan lib pch |
69 | 73 | cd examples/shadertui && make build/shadertui |
70 | 74 | cd examples/transpose && make build/transpose |
71 | 75 |
|
| 76 | +test-gpu: dawnlib check-clang |
| 77 | + $(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 |
| 78 | + |
72 | 79 | # Test 16-bit floating point type |
73 | 80 | test-half: dawnlib check-clang |
74 | 81 | $(LIBSPEC) && clang++ -std=c++17 $(INCLUDES) numeric_types/half.cpp -L$(LIBDIR) -lwebgpu_dawn -ldl -o build/half && ./build/half |
@@ -97,6 +104,9 @@ debug-cmake: check-clang check-cmake |
97 | 104 | all-cmake: check-clang check-cmake |
98 | 105 | $(CMAKE_CMD) $(RELEASE_FLAGS) && make -j$(NUM_JOBS) $(TARGET_ALL) |
99 | 106 |
|
| 107 | +test-cmake: check-clang check-cmake |
| 108 | + ./build/test_gpu |
| 109 | + |
100 | 110 | ################################################################################ |
101 | 111 | # Cleanup |
102 | 112 | ################################################################################ |
|
0 commit comments