Skip to content

Commit 59f97a7

Browse files
committed
Refactor to wgpu c bindings and add window creation and utils
1 parent 1f80293 commit 59f97a7

File tree

13 files changed

+790
-2888
lines changed

13 files changed

+790
-2888
lines changed

.clang-format

Lines changed: 0 additions & 179 deletions
This file was deleted.

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
/emcmake-build
2-
.vscode
2+
/native-build
3+
/build
4+
.vscode

CMakeLists.txt

Lines changed: 38 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,47 @@
11
cmake_minimum_required(VERSION 3.5)
2-
project(wgpu-starter)
3-
4-
if (NOT WIN32)
5-
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic")
6-
endif()
2+
project(webgpu)
73

84
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR}/cmake")
9-
include(ExternalProject)
10-
11-
include(cmake/glm.cmake)
125

13-
add_definitions(-DGLM_ENABLE_EXPERIMENTAL)
14-
15-
set(CMAKE_EXE_LINKER_FLAGS "-s USE_WEBGPU=1")
16-
# Generate the index.html file that will load our Emscripten compiled module
17-
set(APP_TARGET_NAME wgpu-starter)
18-
configure_file(index.html.in ${CMAKE_CURRENT_BINARY_DIR}/index.html @ONLY)
6+
if (CMAKE_BUILD_TYPE EQUAL "DEBUG")
7+
target_compile_definitions(webgpu
8+
PRIVATE
9+
_DEBUG)
10+
endif()
1911

20-
add_executable(wgpu-starter
21-
main.cpp
22-
arcball_camera.cpp)
12+
add_executable(webgpu
13+
src/main.cpp
14+
src/Utils.cpp)
2315

24-
set_target_properties(wgpu-starter PROPERTIES
16+
set_target_properties(webgpu PROPERTIES
2517
CXX_STANDARD 20
2618
CXX_STANDARD_REQUIRED ON)
2719

28-
target_link_libraries(wgpu-starter PRIVATE glm)
20+
if (NOT EMSCRIPTEN)
21+
target_compile_definitions(webgpu
22+
PRIVATE
23+
NOMINMAX WIN32_LEAN_AND_MEAN)
24+
find_package(Threads REQUIRED)
25+
find_package(Dawn REQUIRED)
26+
27+
target_link_libraries(webgpu
28+
PUBLIC
29+
Dawn)
30+
31+
if (WIN32)
32+
elseif(APPLE)
33+
else()
34+
target_compile_definitions(webgpu
35+
PRIVATE
36+
LINUX)
37+
find_package(X11 REQUIRED)
38+
target_link_libraries(webgpu
39+
PUBLIC
40+
X11)
41+
endif()
42+
else()
43+
set(CMAKE_EXE_LINKER_FLAGS "-s USE_WEBGPU=1")
44+
# Generate the index.html file that will load our Emscripten compiled module
45+
set(APP_TARGET_NAME webgpu)
46+
configure_file(index.html.in ${CMAKE_CURRENT_BINARY_DIR}/index.html @ONLY)
47+
endif()

arcball_camera.cpp

Lines changed: 0 additions & 102 deletions
This file was deleted.

0 commit comments

Comments
 (0)