-
Notifications
You must be signed in to change notification settings - Fork 3
/
CMakeLists.txt
72 lines (62 loc) · 1.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
cmake_minimum_required(VERSION 3.8)
project(barnes-hut-simulator)
set(CMAKE_CXX_STANDARD 17)
# Need to install the following libraries in the case of Ubuntu:
# - libsdl1.2-dev
# - libsdl-ttf2.0-dev
# - libsdl-gfx1.2-dev
find_package(SDL REQUIRED)
add_library(SDL INTERFACE IMPORTED)
target_include_directories(SDL INTERFACE ${SDL_INCLUDE_DIR})
target_link_libraries(SDL INTERFACE ${SDL_LIBRARY})
find_package(X11 REQUIRED)
add_library(X11 INTERFACE IMPORTED)
target_include_directories(X11 INTERFACE ${X11_INCLUDE_DIR})
target_link_libraries(X11 INTERFACE ${X11_LIBRARIES})
# Please set "OpenGL_GL_PREFERENCE" to "LEGACY" to use a legacy GL library (libGL.so)
# instead of GLVND libraries (libOpenGL.so, libGSL.so).
#
# Example:
# cmake .. -DOpenGL_GL_PREFERENCE=LEGACY
#
# Need to install the following libraries in the case of Ubuntu:
# - libglu1-mesa-dev
# - mesa-common-dev
# - freeglut3-dev
find_package(OpenGL REQUIRED)
# Need to install the following libraries in the case of Ubuntu:
# - libgomp1
find_package(OpenMP REQUIRED)
# Add the include directory
include_directories(include)
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -ffast-math -fomit-framepointers")
# Set the source files
set(SOURCES
src/main.cpp
src/BHTree.cpp
src/IIntegrator.cpp
src/IntegratorADB5.cpp
src/IntegratorADB6.cpp
src/IntegratorRK4.cpp
src/IntegratorRK5.cpp
src/IntegratorRKF4.cpp
src/ModelNBody.cpp
src/NBodyWnd.cpp
src/SDLWnd.cpp
src/Types.cpp
src/Vector.cpp)
add_executable(${PROJECT_NAME} ${SOURCES})
set_target_properties(${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${PROJECT_SOURCE_DIR}/bin)
#target_include_directories(barnes-hut-simulator
# PUBLIC
# ${PROJECT_SOURCE_DIR}
# )
target_link_libraries(barnes-hut-simulator
PUBLIC
SDL
X11
OpenGL::GL
OpenGL::GLU
OpenMP::OpenMP_CXX
)