-
Notifications
You must be signed in to change notification settings - Fork 21
/
Copy pathCMakeLists.txt
121 lines (112 loc) · 3.09 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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
cmake_minimum_required(VERSION 3.5)
project(dandelion VERSION 1.1)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
set(CMAKE_CONFIGURATION_TYPES "Debug;Release")
if (CMAKE_BUILD_TYPE MATCHES "(Debug)|(Release)")
message("Current build type: ${CMAKE_BUILD_TYPE}")
else()
message("Set default build type to Debug.")
set(CMAKE_BUILD_TYPE "Debug")
endif()
set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE)
add_subdirectory(deps/glfw)
add_subdirectory(deps/fmt)
set(ASSIMP_BUILD_ALL_IMPORTERS_BY_DEFAULT OFF CACHE BOOL "" FORCE)
set(ASSIMP_BUILD_ALL_EXPORTERS_BY_DEFAULT OFF CACHE BOOL "" FORCE)
set(ASSIMP_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE)
set(ASSIMP_BUILD_COLLADA_IMPORTER TRUE)
set(ASSIMP_BUILD_OBJ_IMPORTER TRUE)
set(ASSIMP_BUILD_FBX_IMPORTER TRUE)
add_subdirectory(deps/assimp)
set(GLAD_SOURCES
deps/glad/src/glad.c
)
set(IMGUI_SOURCES
deps/imgui/imgui.cpp
deps/imgui/imgui_demo.cpp
deps/imgui/imgui_draw.cpp
deps/imgui/imgui_tables.cpp
deps/imgui/imgui_widgets.cpp
deps/imgui/imgui_impl_glfw.cpp
deps/imgui/imgui_impl_opengl3.cpp
)
set(DANDELION_PLATFORM_SOURCES
src/platform/platform.cpp
src/platform/gl.cpp
src/platform/shader.cpp
)
set(DANDELION_UI_SOURCES
src/ui/controller.cpp
src/ui/menubar.cpp
src/ui/toolbar.cpp
)
set(DANDELION_SCENE_SOURCES
src/scene/scene.cpp
src/scene/group.cpp
src/scene/object.cpp
src/scene/camera.cpp
src/scene/light.cpp
)
set(DANDELION_UTILS_SOURCES
src/utils/stb_image_wrapper.cpp
# src/utils/ray.cpp
# src/utils/aabb.cpp
# src/utils/bvh.cpp
src/utils/kinetic_state.cpp
src/utils/logger.cpp
)
set(DANDELION_RENDER_SOURCES
src/render/shader.cpp
src/render/rasterizer.cpp
src/render/rasterizer_renderer.cpp
src/render/whitted_renderer.cpp
src/render/render_engine.cpp
src/render/triangle.cpp
)
set(DANDELION_GEOMETRY_SOURCES
src/geometry/halfedge_mesh.cpp
src/geometry/meshedit.cpp
src/geometry/halfedge.cpp
src/geometry/vertex.cpp
src/geometry/edge.cpp
src/geometry/face.cpp
)
set(DANDELION_SIMULATION_SOURCES
src/simulation/solver.cpp
)
set(SOURCES
src/main.cpp
${DANDELION_PLATFORM_SOURCES}
${DANDELION_UI_SOURCES}
${DANDELION_SCENE_SOURCES}
${DANDELION_UTILS_SOURCES}
${DANDELION_RENDER_SOURCES}
${DANDELION_GEOMETRY_SOURCES}
${DANDELION_SIMULATION_SOURCES}
${GLAD_SOURCES}
${IMGUI_SOURCES}
)
add_executable(${PROJECT_NAME} ${SOURCES})
target_include_directories(${PROJECT_NAME}
PRIVATE deps
PRIVATE deps/glad/include
)
target_link_directories(${PROJECT_NAME} PRIVATE deps)
target_link_libraries(${PROJECT_NAME}
glfw
assimp
fmt::fmt
debug dandelion-ray-debug
optimized dandelion-ray
debug dandelion-bvh-debug
optimized dandelion-bvh
)
target_compile_definitions(${PROJECT_NAME}
PRIVATE $<$<CONFIG:Debug>:DEBUG>
PRIVATE SPDLOG_FMT_EXTERNAL
)
set(current_target ${PROJECT_NAME})
include(${CMAKE_CURRENT_SOURCE_DIR}/CompilerFlags.cmake)
file(COPY ${PROJECT_SOURCE_DIR}/resources DESTINATION ${PROJECT_BINARY_DIR})