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; }