-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
33 lines (27 loc) · 1.12 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
cmake_minimum_required(VERSION 3.20)
project(test250114 LANGUAGES C)
add_subdirectory(submodules/glfw)
include_directories(${CMAKE_SOURCE_DIR}/submodules/glfw/include)
include_directories(${CMAKE_SOURCE_DIR}/vendor/wgpu/include/wgpu)
include_directories(${CMAKE_SOURCE_DIR}/vendor/wgpu/include/webgpu)
link_directories(${CMAKE_SOURCE_DIR}/vendor/wgpu/lib)
add_executable(test250114 src/main.c src/framework.c)
if (MSVC)
add_compile_options(/W4)
else()
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
if (WIN32)
add_definitions(-DGLFW_EXPOSE_NATIVE_WIN32)
set(OS_LIBRARIES d3dcompiler ws2_32 userenv bcrypt ntdll opengl32)
elseif(UNIX AND NOT APPLE)
add_definitions(-DGLFW_EXPOSE_NATIVE_X11)
add_definitions(-DGLFW_EXPOSE_NATIVE_WAYLAND)
set(OS_LIBRARIES "-lm -ldl")
elseif(APPLE)
enable_language(OBJC)
set_source_files_properties(src/main.c src/framework.c PROPERTIES LANGUAGE OBJC)
add_definitions(-DGLFW_EXPOSE_NATIVE_COCOA)
set(OS_LIBRARIES "-framework CoreFoundation -framework QuartzCore -framework Metal")
endif()
target_link_libraries(test250114 glfw wgpu_native ${OS_LIBRARIES})