From 5b48d72196e3d5df1d54f82d6da5f587b2a5d1ff Mon Sep 17 00:00:00 2001 From: Warwick Date: Wed, 16 Apr 2025 16:34:19 +0100 Subject: [PATCH] Working LSP with test webgpu build --- CMakeLists.txt | 9 ++++++++- src/main.c | 8 +++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5b2fb79..1064c4b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,7 +7,14 @@ project(webgpu ) set(CMAKE_C_STANDARD 17) -set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + +# Since nix include dirs isn't appearing in compile_commands.json we're gonna +# force cmake to link it's includes explicitly +set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE INTERNAL "") +if(CMAKE_EXPORT_COMPILE_COMMANDS) + set(CMAKE_C_STANDARD_INCLUDE_DIRECTORIES + ${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}) +endif() # Error on memory address issues in debug mode if(CMAKE_BUILD_TYPE MATCHES "Debug") diff --git a/src/main.c b/src/main.c index ee4bff0..5fc3cc7 100644 --- a/src/main.c +++ b/src/main.c @@ -1,7 +1,13 @@ #include #include -int main () { +int main() { + // We create a descriptor + WGPUInstanceDescriptor desc = {}; + desc.nextInChain = NULL; + + // We create the instance using this descriptor + WGPUInstance instance = wgpuCreateInstance(&desc); printf("Hello World!\n"); return 0; }