summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-01-28 02:51:21 +0100
committerskal <pascal.massimino@gmail.com>2026-01-28 02:51:21 +0100
commit295626c3d527613c93fa63e2b1f079704600a98e (patch)
tree978da6b066bb1ff69df4abb02887bc940e88afe1 /CMakeLists.txt
parent96bfc344ce9098681ff739cd7ed0a1d1f8ba54df (diff)
build: Finalize WebGPU integration and platform fixes
Includes correct CMake configuration for GLFW native access, Objective-C++ compilation for the helper library on macOS, and applies clang-format to modified sources.
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt18
1 files changed, 17 insertions, 1 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1238a8a..69e51c6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,6 +1,18 @@
cmake_minimum_required(VERSION 3.16)
project(demo64k LANGUAGES C CXX)
+if(APPLE)
+ add_definitions(-DGLFW_EXPOSE_NATIVE_COCOA)
+elseif(WIN32)
+ add_definitions(-DGLFW_EXPOSE_NATIVE_WIN32)
+elseif(UNIX)
+ if(DEFINED CMAKE_USE_WAYLAND)
+ add_definitions(-DGLFW_EXPOSE_NATIVE_WAYLAND)
+ else()
+ add_definitions(-DGLFW_EXPOSE_NATIVE_X11)
+ endif()
+endif()
+
option(DEMO_SIZE_OPT "Enable size optimization flags" OFF)
option(DEMO_STRIP_ALL "Strip all unnecessary code for final build" OFF)
@@ -29,7 +41,11 @@ set(DEMO_LIBS glfw ${WGPU_LIBRARY})
# Platform-specific dependencies
if (APPLE)
- set_source_files_properties(src/platform.cc PROPERTIES COMPILE_FLAGS "-x objective-c++")
+ set_source_files_properties(
+ src/platform.cc
+ third_party/glfw3webgpu/glfw3webgpu.c
+ PROPERTIES COMPILE_FLAGS "-x objective-c++"
+ )
list(APPEND DEMO_LIBS
"-framework Metal"
"-framework Foundation"