-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
132 lines (117 loc) · 5.39 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
# Inspired by this project https://github.com/andystanton/glfw-skeleton
cmake_minimum_required(VERSION 3.16)
project(N-body)
include(FetchContent)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(FETCHCONTENT_QUIET FALSE)
#
# glfw
#
set(GLFW_BUILD_DOCS FALSE)
set(GLFW_BUILD_EXAMPLES FALSE)
set(GLFW_BUILD_TESTS FALSE)
FetchContent_Declare(
glfw
GIT_REPOSITORY https://github.com/glfw/glfw.git
GIT_TAG 3.3.4
GIT_PROGRESS TRUE)
#
# glad
#
FetchContent_Declare(
glad
GIT_REPOSITORY https://github.com/Dav1dde/glad
GIT_TAG v0.1.34
GIT_PROGRESS TRUE)
#
# glm
#
FetchContent_Declare(
glm
GIT_REPOSITORY https://github.com/g-truc/glm
GIT_TAG 0.9.9.8
GIT_PROGRESS TRUE)
#
# fetch dependencies
#
FetchContent_MakeAvailable(glfw glad glm)
#
# N-body source code
#
set(
PROJECT_SOURCES
src/main/main.cpp
src/include/ArgumentsParser/ArgumentsParser.cpp
src/include/Camera/Camera.cpp
src/include/Shader/abstract/Shader.cpp
src/include/Shader/ComputeShader/ComputeShader.cpp
src/include/Shader/VertexFragmentShader/VertexFragmentShader.cpp
src/include/Particle/Particle.cpp
src/include/ParticleSystem/ParticleSystem.cpp
src/include/ParticleSystemInitializer/ParticleSystemCubeInitializer/ParticleSystemCubeInitializer.cpp
src/include/ParticleSystemInitializer/ParticleSystemGalaxyInitializer/ParticleSystemGalaxyInitializer.cpp
src/include/ParticleSystemInitializer/ParticleSystemSphere/ParticleSystemSphere.cpp
src/include/ParticleSystemInitializer/ParticleSystemBall/ParticleSystemBall.cpp
src/include/ParticleSystemInitializer/ParticleSystemCubeSurface/ParticleSystemCubeSurface.cpp
src/include/ParticleSystemInitializer/ParticleSystemLagrange/ParticleSystemLagrange.cpp
src/include/ParticleSystemInitializer/ParticleSystemFile/ParticleSystemFile.cpp
src/include/ParticleSolver/ParticleSolverCPUSequential/ParticleSolverCPUSequential.cpp
src/include/ParticleSolver/ParticleSolverCPUParallel/ParticleSolverCPUParallel.cpp
src/include/ParticleSolver/ParticleSolverGPU/ParticleSolverGPU.cpp
src/include/Bloom/Bloom.cpp
src/include/Window/Window.cpp
src/include/RenderTimer/RenderTimer.cpp
src/include/ParticleDrawer/ParticleDrawer.cpp
src/include/ParticleSimulation/ParticleSimulation.cpp
src/include/RenderLoop/RenderLoop.cpp
src/include/WindowInputManager/WindowInputManager.cpp
src/include/Bucket/Bucket.cpp
src/include/Grid/GridCPU.cpp
src/include/ParticleSystemSaver/ParticleSystemSaver.cpp
src/include/ParticleSolver/ParticleSolverCPUGrid/ParticleSolverCPUGrid.cpp
)
# Include OpenMP
find_package(OpenMP)
if(OpenMP_CXX_FOUND)
message("OpenMP found")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
endif()
add_executable(${PROJECT_NAME} ${PROJECT_SOURCES})
add_dependencies(${PROJECT_NAME} glfw glad glm)
target_include_directories(
${PROJECT_NAME} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src/include/enums/
${CMAKE_CURRENT_SOURCE_DIR}/src/include/ArgumentsParser/
${CMAKE_CURRENT_SOURCE_DIR}/src/include/Camera/
${CMAKE_CURRENT_SOURCE_DIR}/src/include/Shader/abstract/
${CMAKE_CURRENT_SOURCE_DIR}/src/include/Shader/ComputeShader/
${CMAKE_CURRENT_SOURCE_DIR}/src/include/Shader/VertexFragmentShader/
${CMAKE_CURRENT_SOURCE_DIR}/src/include/Particle/
${CMAKE_CURRENT_SOURCE_DIR}/src/include/ParticleSystem/
${CMAKE_CURRENT_SOURCE_DIR}/src/include/ParticleSystemInitializer/interface/
${CMAKE_CURRENT_SOURCE_DIR}/src/include/ParticleSystemInitializer/ParticleSystemCubeInitializer/
${CMAKE_CURRENT_SOURCE_DIR}/src/include/ParticleSystemInitializer/ParticleSystemGalaxyInitializer/
${CMAKE_CURRENT_SOURCE_DIR}/src/include/ParticleSystemInitializer/ParticleSystemSphere/
${CMAKE_CURRENT_SOURCE_DIR}/src/include/ParticleSystemInitializer/ParticleSystemBall/
${CMAKE_CURRENT_SOURCE_DIR}/src/include/ParticleSystemInitializer/ParticleSystemCubeSurface/
${CMAKE_CURRENT_SOURCE_DIR}/src/include/ParticleSolver/interface/
${CMAKE_CURRENT_SOURCE_DIR}/src/include/ParticleSolver/ParticleSolverCPUSequential/
${CMAKE_CURRENT_SOURCE_DIR}/src/include/ParticleSolver/ParticleSolverCPUParallel/
${CMAKE_CURRENT_SOURCE_DIR}/src/include/ParticleSolver/ParticleSolverGPU/
${CMAKE_CURRENT_SOURCE_DIR}/src/include/ParticleSolver/ParticleSolverCPUGrid/
${CMAKE_CURRENT_SOURCE_DIR}/src/include/Bloom/
${CMAKE_CURRENT_SOURCE_DIR}/src/include/Bucket/
${CMAKE_CURRENT_SOURCE_DIR}/src/include/Window/
${CMAKE_CURRENT_SOURCE_DIR}/src/include/RenderTimer/
${CMAKE_CURRENT_SOURCE_DIR}/src/include/ParticleDrawer/
${CMAKE_CURRENT_SOURCE_DIR}/src/include/ParticleSimulation/
${CMAKE_CURRENT_SOURCE_DIR}/src/include/RenderLoop/
${CMAKE_CURRENT_SOURCE_DIR}/src/include/Grid/
${CMAKE_CURRENT_SOURCE_DIR}/src/include/ParticleSystemSaver/
${CMAKE_CURRENT_SOURCE_DIR}/src/include/WindowInputManager/
${CMAKE_CURRENT_SOURCE_DIR}/src/include/ParticleSystemInitializer/ParticleSystemLagrange/
${CMAKE_CURRENT_SOURCE_DIR}/src/include/ParticleSystemInitializer/ParticleSystemFile/
)
target_link_libraries(${PROJECT_NAME} PRIVATE glfw glad glm OpenMP::OpenMP_CXX)