-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
150 lines (126 loc) · 4.18 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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
cmake_minimum_required(VERSION 3.19)
IF(MSVC)
SET(CMAKE_GENERATOR_PLATFORM win64)
ENDIF()
IF(APPLE)
SET(CMAKE_OSX_ARCHITECTURES "x86_64" CACHE INTERNAL "" FORCE)
ENDIF(APPLE)
PROJECT(OpenGL_Proj)
SET(CMAKE_CXX_STANDARD 17)
SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON)
SET(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
SET(CMAKE_SUPPRESS_REGENERATION ON)
SET(CMAKE_USE_RELATIVE_PATHS ON)
OPTION(GLFW_BUILD_DOCS OFF)
OPTION(GLFW_BUILD_EXAMPLES OFF)
OPTION(GLFW_BUILD_TESTS OFF)
OPTION(GLFW_INSTALL OFF)
ADD_SUBDIRECTORY(External/glfw)
option(ASSIMP_BUILD_ASSIMP_TOOLS OFF)
option(ASSIMP_BUILD_SAMPLES OFF)
option(ASSIMP_BUILD_TESTS OFF)
ADD_SUBDIRECTORY(External/assimp)
#config glfw
INCLUDE_DIRECTORIES(External/glfw/include/)
LIST(APPEND LIBS glfw ${GLFW_LIBRARIES})
#config glad
SET(GLAD_SRC External/glad/src/glad.c)
IF(NOT WIN32)
LIST(APPEND LIBS dl)
ENDIF()
INCLUDE_DIRECTORIES(External/glad/include)
#config assimp
INCLUDE_DIRECTORIES(External/assimp/include/)
LIST(APPEND LIBS assimp ${ASSIMP_LIBRARIES})
message(">>>>> APPEND: ASSIMP ${LIBS}")
#config glm
INCLUDE_DIRECTORIES(External/glm/)
#config include imgui
INCLUDE_DIRECTORIES(External/Imgui/include)
SET(IMGUI_SRC External/Imgui/src)
#config include imguizmo
INCLUDE_DIRECTORIES(External/Imguizmo/ImGuizmo.h)
SET(IMGUIZMO_SRC External/Imguizmo/ImGuizmoc.pp)
#config FileDialog
SET(DIALOG_SRC External/FileDialog/ImGuiFileDialog.cpp)
INCLUDE_DIRECTORIES(External/FileDialog/)
IF(MSVC)
INCLUDE_DIRECTORIES(External/FileDialog/dirent)
ENDIF()
#config stb_img
INCLUDE_DIRECTORIES(External/stb_image/)
#config EasyBMP
INCLUDE_DIRECTORIES(External/EasyBMP/*.hpp)
#config eigen
INCLUDE_DIRECTORIES(External/Eigen/src/*.*)
SET(EIGEN_SRC External/Eigen/src/*.*)
#config tiny-loader
INCLUDE_DIRECTORIES(External/tiny-loader/*.h)
#config include other head files
INCLUDE_DIRECTORIES(Render/*.h)
INCLUDE_DIRECTORIES(Render/Builtin/*.h)
INCLUDE_DIRECTORIES(Render/Debugger/*.h)
INCLUDE_DIRECTORIES(Render/Geometry/*.h)
INCLUDE_DIRECTORIES(Render/GL30/*.h)
INCLUDE_DIRECTORIES(Render/MemoryPool/*.h)
INCLUDE_DIRECTORIES(Render/MemoryPool/tlsf/*.h)
INCLUDE_DIRECTORIES(Render/ThreadPool/*.h)
INCLUDE_DIRECTORIES(Render/PBA/*.h)
INCLUDE_DIRECTORIES(Render/Utils/*.h)
INCLUDE_DIRECTORIES(External/)
ADD_DEFINITIONS(-D_CMAKE)
ADD_DEFINITIONS(-D_CRT_NONSTDC_NO_WARNINGS)
#config sources files
FILE(GLOB EXTERNAL_SOURCES ${GLAD_SRC}
${IMG_SRC}
${DIALOG_SRC}
${IMGUIZMO_SRC}
${EIGEN_SRC})
FILE(GLOB PROJECT_IMGUI ${IMGUI_SRC}/*.cpp)
FILE(GLOB PROJECT_BUILTIN Render/Builtin/*.*)
FILE(GLOB PROJECT_DEBUGGER Render/Debugger/*.*)
FILE(GLOB PROJECT_GEOMETRY Render/Geometry/*.*)
FILE(GLOB PROJECT_GL30 Render/GL30/*.*)
FILE(GLOB PROJECT_MEMORYPOOL Render/MemoryPool/*.*)
FILE(GLOB PROJECT_MEMORYPOOL_TLSF Render/MemoryPool/tlsf/*.*)
FILE(GLOB PROJECT_THREADPOOL Render/ThreadPool/*.*)
FILE(GLOB PROJECT_PBA Render/PBA/*.*)
FILE(GLOB PROJECT_UTILS Render/Utils/*.*)
FILE(GLOB PROJECT_HEADERS Render/*.h)
FILE(GLOB PROJECT_SOURCES Render/*.cpp)
FILE(GLOB PROJECT_SHADERS Res/Shaders/*.vs
Res/Shaders/*.fs
Res/Shaders/*.gs
Res/Shaders/*.tcs
Res/Shaders/*.tes)
Message(">>>>> CMAKE_CURRENT_SOURCE_DIR: ${CMAKE_CURRENT_SOURCE_DIR}")
SOURCE_GROUP("Headers" FILES ${PROJECT_HEADERS})
SOURCE_GROUP("Sources" FILES ${PROJECT_SOURCES})
SOURCE_GROUP("Builtin" FILES ${PROJECT_BUILTIN})
SOURCE_GROUP("Imgui" FILES ${PROJECT_IMGUI})
SOURCE_GROUP("Debugger" FILES ${PROJECT_DEBUGGER})
SOURCE_GROUP("Geometry" FILES ${PROJECT_GEOMETRY})
SOURCE_GROUP("GL30" FILES ${PROJECT_GL30})
SOURCE_GROUP("MemoryPool" FILES ${PROJECT_MEMORYPOOL} ${PROJECT_MEMORYPOOL_TLSF})
SOURCE_GROUP("ThreadPool" FILES ${PROJECT_THREADPOOL})
SOURCE_GROUP("PBA" FILES ${PROJECT_PBA})
SOURCE_GROUP("utils" FILES ${PROJECT_UTILS})
SOURCE_GROUP("Externals" FILES ${EXTERNAL_SOURCES})
SOURCE_GROUP("Shaders" FILES ${PROJECT_SHADERS})
ADD_EXECUTABLE(
${PROJECT_NAME}
${PROJECT_BUILTIN}
${PROJECT_DEBUGGER}
${PROJECT_GEOMETRY}
${PROJECT_GL30}
${PROJECT_MEMORYPOOL}
${PROJECT_MEMORYPOOL_TLSF}
${PROJECT_THREADPOOL}
${PROJECT_PBA}
${PROJECT_UTILS}
${PROJECT_SOURCES}
${PROJECT_IMGUI}
${PROJECT_HEADERS}
${EXTERNAL_SOURCES}
${PROJECT_SHADERS})
TARGET_LINK_LIBRARIES(${PROJECT_NAME} ${LIBS})