-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
105 lines (88 loc) · 2.81 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
cmake_minimum_required(VERSION 3.16)
# Sets project name
project(projects_realtime LANGUAGES CXX C)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
# Sets C++ standard
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Specifies required Qt components
find_package(Qt6 REQUIRED COMPONENTS Core)
find_package(Qt6 REQUIRED COMPONENTS Gui)
find_package(Qt6 REQUIRED COMPONENTS OpenGL)
find_package(Qt6 REQUIRED COMPONENTS OpenGLWidgets)
find_package(Qt6 REQUIRED COMPONENTS Xml)
# Allows you to include files from within those directories, without prefixing their filepaths
include_directories(src)
# Specifies .cpp and .h files to be passed to the compiler
add_executable(${PROJECT_NAME}
src/main.cpp
src/realtime.cpp
src/mainwindow.cpp
src/settings.cpp
src/utils/scenefilereader.cpp
src/utils/sceneparser.cpp
src/mainwindow.h
src/realtime.h
src/settings.h
src/utils/scenedata.h
src/utils/scenefilereader.h
src/utils/sceneparser.h
src/utils/shaderloader.h
src/utils/aspectratiowidget/aspectratiowidget.hpp
src/camera.h
src/camera.cpp
src/shapes/Cone.cpp src/shapes/Cone.h src/shapes/Cube.cpp src/shapes/Cube.h src/shapes/Cylinder.cpp src/shapes/Cylinder.h src/shapes/Sphere.cpp src/shapes/Sphere.h src/shapes/Tet.cpp src/shapes/Tet.h src/shapes/Triangle.cpp src/shapes/Triangle.h
src/dungeon.h src/room.h
src/dungeon.cpp src/room.cpp
src/beziercurve.h src/beziercurve.cpp
)
# GLM: this creates its library and allows you to `#include "glm/..."`
add_subdirectory(glm)
# GLEW: this creates its library and allows you to `#include "GL/glew.h"`
add_library(StaticGLEW STATIC glew/src/glew.c
src/dungeon.h src/dungeon.cpp
src/room.h src/room.cpp
src/debug.h
)
include_directories(${PROJECT_NAME} PRIVATE glew/include)
# Specifies libraries to be linked (Qt components, glew, etc)
target_link_libraries(${PROJECT_NAME} PRIVATE
Qt::Core
Qt::Gui
Qt::OpenGL
Qt::OpenGLWidgets
Qt::Xml
StaticGLEW
)
# Specifies other files
qt6_add_resources(${PROJECT_NAME} "Resources"
PREFIX
"/"
FILES
resources/shaders/default.frag
resources/shaders/default.vert
resources/shaders/texture.frag
resources/shaders/texture.vert
resources/brickfinal.jpg
resources/floorfinal.png
resources/lighting.json
)
# GLEW: this provides support for Windows (including 64-bit)
if (WIN32)
add_compile_definitions(GLEW_STATIC)
target_link_libraries(${PROJECT_NAME} PRIVATE
opengl32
glu32
)
endif()
# Set this flag to silence warnings on Windows
if (MSVC OR MSYS OR MINGW)
set(CMAKE_CXX_FLAGS "-Wno-volatile")
endif()
# Set this flag to silence warnings on MacOS
if (APPLE)
set(CMAKE_CXX_FLAGS "-Wno-deprecated-volatile")
endif()