-
Notifications
You must be signed in to change notification settings - Fork 6
/
CMakeLists.txt
115 lines (97 loc) · 3.91 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
cmake_minimum_required(VERSION 3.18)
# set the project name and version
project(OpenGLSandBox)
# specify the C++ standard and making it mandatory
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
# Place the cmake ALL_BUILD and ZERO_CHECK and INSTALL projects udner a filter/folder
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set(PREDEFINED_TARGETS_FOLDER "_CMakePredefinedTargets")
include_directories(
"${CMAKE_SOURCE_DIR}/vendor/ASSIMP/include"
"${CMAKE_SOURCE_DIR}/vendor/ASSIMP/build/include"
"${CMAKE_SOURCE_DIR}/vendor/GLAD/include"
"${CMAKE_SOURCE_DIR}/vendor/GLFW/include"
"${CMAKE_SOURCE_DIR}/vendor/GLM"
"${CMAKE_SOURCE_DIR}/vendor/STB"
"${CMAKE_SOURCE_DIR}/vendor/FrameGraph/include"
"${CMAKE_SOURCE_DIR}/OpenGL"
"${CMAKE_SOURCE_DIR}/vendor/ImGui"
"${CMAKE_SOURCE_DIR}/vendor/ImGuizmo"
"${CMAKE_SOURCE_DIR}/tests"
"${CMAKE_SOURCE_DIR}/tests/Surfels"
"C:/Dev/Vulkan Projects/Vulf/vendor/tinyobj"
)
if (APPLE)
link_directories(
"${CMAKE_SOURCE_DIR}/vendor/GLFW/build/src"
"${CMAKE_SOURCE_DIR}/vendor/ASSIMP/build/bin"
)
endif (APPLE)
if (WIN32)
link_directories(
"${CMAKE_SOURCE_DIR}/vendor/GLFW/build/src"
"${CMAKE_SOURCE_DIR}/vendor/ASSIMP/build/bin"
"${CMAKE_SOURCE_DIR}/vendor/ASSIMP/build/lib"
)
endif (WIN32)
# Add source files
file(GLOB_RECURSE OpenGL_SOURCE_FILES
${CMAKE_SOURCE_DIR}/OpenGL/*.c
${CMAKE_SOURCE_DIR}/OpenGL/*.cpp
)
# Add source header files
file(GLOB_RECURSE OpenGL_HEADER_FILES
${CMAKE_SOURCE_DIR}/OpenGL/*.h
${CMAKE_SOURCE_DIR}/OpenGL/*.hpp
)
file(GLOB_RECURSE OpenGL_TEST_FILES
${CMAKE_SOURCE_DIR}/tests/*.h
${CMAKE_SOURCE_DIR}/tests/*.hpp
${CMAKE_SOURCE_DIR}/tests/*.c
${CMAKE_SOURCE_DIR}/tests/*.cpp
)
file(GLOB VENDOR_SRC_FILES
${CMAKE_SOURCE_DIR}/vendor/ImGui/backends/imgui_impl_glfw.cpp
${CMAKE_SOURCE_DIR}/vendor/ImGui/backends/imgui_impl_opengl3.cpp
${CMAKE_SOURCE_DIR}/vendor/ImGui/imgui_demo.cpp
${CMAKE_SOURCE_DIR}/vendor/ImGui/imgui_draw.cpp
${CMAKE_SOURCE_DIR}/vendor/ImGui/imgui_tables.cpp
${CMAKE_SOURCE_DIR}/vendor/ImGui/imgui_widgets.cpp
${CMAKE_SOURCE_DIR}/vendor/ImGui/imgui.cpp
${CMAKE_SOURCE_DIR}/vendor/ImGuizmo/ImCurveEdit.
${CMAKE_SOURCE_DIR}/vendor/ImGuizmo/ImGradient.cpp
${CMAKE_SOURCE_DIR}/vendor/ImGuizmo/ImGuizmo.cpp
${CMAKE_SOURCE_DIR}/vendor/ImGuizmo/ImSequencer.cpp
${CMAKE_SOURCE_DIR}/vendor/GLAD/src/glad.c
${CMAKE_SOURCE_DIR}/vendor/FrameGraph/src/*.cpp
)
file(GLOB SOURCE_FILES
${CMAKE_SOURCE_DIR}/tests/MainSandbox.cpp
)
file(GLOB_RECURSE SHADER_FILES
${CMAKE_SOURCE_DIR}/tests/shaders/**
)
# Compile the source files for the executable
add_executable(OpenGLSandBox ${SOURCE_FILES} ${OpenGL_HEADER_FILES} ${OpenGL_TEST_FILES} ${OpenGL_SOURCE_FILES} ${VENDOR_SRC_FILES} ${SHADER_FILES})
#source_group("Tests" FILES ${OpenGL_TEST_FILES})
source_group("Main" FILES ${SOURCE_FILES})
source_group("OpenGL Source" FILES ${OpenGL_SOURCE_FILES})
source_group("OpenGL Header" FILES ${OpenGL_HEADER_FILES})
source_group("Vendor" FILES ${VENDOR_SRC_FILES})
#source_group("Shaders" FILES ${SHADER_FILES})
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${OpenGL_TEST_FILES})
source_group(TREE ${CMAKE_CURRENT_SOURCE_DIR} FILES ${SHADER_FILES})
set_property(TARGET OpenGLSandBox PROPERTY VS_DEBUGGER_WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}")
if (APPLE)
target_link_libraries(OpenGLSandBox glfw3 assimp "-framework CoreFoundation -framework CoreAudio -framework OpenAL -framework OpenGL -framework Cocoa -framework IOKit -framework CoreGraphics")
endif (APPLE)
if (WIN32)
target_link_libraries(OpenGLSandBox opengl32 glfw3 debug assimp-vc142-mtd optimized assimp-vc142-mtd )
endif (WIN32)
# Run the binary built using 'make run' command
add_custom_target(run
COMMAND OpenGLSandBox
DEPENDS OpenGLSandBox
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)