-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
66 lines (56 loc) · 1.76 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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
cmake_minimum_required(VERSION 3.1...3.25)
project(
LearnWebGPU
VERSION 0.1.0
LANGUAGES CXX C)
include(utils.cmake)
# We add an option to enable different settings when developping the app than
# when distributing it.
option(DEV_MODE "Set up development helper settings" ON)
add_subdirectory(vendor/glfw)
add_subdirectory(vendor/webgpu)
add_subdirectory(vendor/glfw3webgpu)
add_subdirectory(vendor/imgui)
include_directories(vendor)
include_directories(src)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -ltbb")
find_package(TBB REQUIRED COMPONENTS tbb)
add_executable(
App
src/Application.h
src/Application.cpp
src/ResourceManager.h
src/ResourceManager.cpp
src/implementations.cpp
src/Walnut/Image.cpp
src/Walnut/Image.h
src/Walnut/Random.h
src/Walnut/Input/Input.h
src/Walnut/Random.cpp
src/Walnut/Input/Input.cpp
src/Ray.h
src/RayLayer.h
src/Layer.h
src/Renderer.h
src/Renderer.cpp
src/Camera.h
src/Camera.cpp
src/main.cpp)
if(DEV_MODE)
# In dev mode, we load resources from the source tree, so that when we
# dynamically edit resources (like shaders), these are correctly versionned.
target_compile_definitions(
App PRIVATE RESOURCE_DIR="${CMAKE_CURRENT_SOURCE_DIR}/resources")
else()
# In release mode, we just load resources relatively to wherever the
# executable is launched from, so that the binary is portable
target_compile_definitions(App PRIVATE RESOURCE_DIR="./resources")
endif()
target_include_directories(App PRIVATE .)
target_link_libraries(App PRIVATE glfw webgpu glfw3webgpu imgui pthread)
if(MSVC)
target_compile_options(App PRIVATE /wd4201)
endif(MSVC)
set_target_properties(App PROPERTIES CXX_STANDARD 17)
# target_treat_all_warnings_as_errors(App)
target_copy_webgpu_binaries(App)