-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
148 lines (129 loc) · 4.58 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
cmake_minimum_required(VERSION 2.8)
project(main)
#########################################################
# COMPILATION DIRECTIVES
#########################################################
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU" OR ${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ASSIMP_CXX_FLAGS} -fms-extensions -std=c++11 ")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG} -g")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE} -O2")
endif()
#########################################################
# FIND OPENGL
#########################################################
find_package(OpenGL REQUIRED)
if (OPENGL_FOUND)
include_directories(${OpenGL_INCLUDE_DIRS})
link_directories(${OpenGL_LIBRARY_DIRS})
add_definitions(${OpenGL_DEFINITIONS})
else()
message(ERROR " OPENGL not found!")
endif()
#########################################################
# FIND GLUT
#########################################################
find_package(GLUT REQUIRED)
if (GLUT_FOUND)
include_directories(${GLUT_INCLUDE_DIRS})
link_directories(${GLUT_LIBRARY_DIRS})
add_definitions(${GLUT_DEFINITIONS})
else()
message(ERROR " GLUT not found!")
endif()
#########################################################
# FIND GLEW
#########################################################
find_package(GLEW REQUIRED)
if (GLEW_FOUND)
include_directories(${GLEW_INCLUDE_DIRS})
link_directories(${GLEW_LIBRARY_DIRS})
add_definitions(${GLEW_DEFINITIONS})
else()
message(ERROR " GLEW not found!")
endif()
#########################################################
# FIND ASSIMP
#########################################################
find_package(ASSIMP REQUIRED)
if (ASSIMP_FOUND)
include_directories(${ASSIMP_INCLUDE_DIRS})
else()
message(ERROR " ASSIMP not found!")
endif()
#########################################################
# FIND SDL 2
#########################################################
FIND_LIBRARY(SDL2_LIBRARY SDL2 /usr/local/lib/libSDL2.so /usr/lib/libSDL2.so)
FIND_LIBRARY(SDL2_MIXER SDL2_mixer /usr/local/lib/libSDL2_mixer.so /usr/lib/libSDL2_mixer.so)
#########################################################
# INCLUDE DIRECTORIES
#########################################################
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/include
${ASSIMP_INCLUDE_DIRS}
${BULLET_PHYSICS_SOURCE_DIR}/src
/usr/local/include/bullet
/usr/local/include/SDL2
/usr/include/bullet
/usr/include/SDL2
)
#########################################################
# FIND BULLET
#########################################################
FIND_LIBRARY( BULLET_DYNAMICS BulletDynamics /usr/local/lib/libBulletDynamics)
FIND_LIBRARY( BULLET_COLLISION BulletCollision /usr/local/lib/libBulletCollision)
FIND_LIBRARY( LINEAR_MATH LinearMath /usr/local/lib/libLinearMath)
FIND_LIBRARY( OPENGL_SUP OpenGLSupport /usr/local/lib/libOpenGLSupport)
# ASSIMP_DIR - The preferred installation prefix for searching for ASSIMP. Set by the user.
#
# ASSIMP_ROOT_DIR - the root directory where the installation can be found
# ASSIMP_CXX_FLAGS - extra flags for compilation
# ASSIMP_LINK_FLAGS - extra flags for linking
# ASSIMP_INCLUDE_DIRS - include directories
# ASSIMP_LIBRARY_DIRS - link directories
# ASSIMP_LIBRARIES - libraries to link plugins with
find_library(ASSIMP2 assimp /usr/local/lib/libassimp)
#########################################################
# INCLUDE FILES
#########################################################
set(SOURCES
src/model.cpp
src/mesh.cpp
src/shader.cpp
src/material.cpp
src/car.cpp
src/scenario.cpp
include/kdtree.hpp
src/camera.cpp
src/light.cpp
src/vehiclePhysic.cpp
src/DemoApplication.cpp
src/GlutDemoApplication.cpp
src/SFX.cpp
src/music.cpp
src/chunk.cpp
src/hud.cpp
src/stb_image.c)
add_executable(${PROJECT_NAME} main.cpp ${SOURCES})
#########################################################
# LLINKING & STUFF
#########################################################
set(ALL_LIBS
${OPENGL_LIBRARIES}
${GLUT_LIBRARIES}
${GLEW_LIBRARIES}
${BULLET_DYNAMICS}
${BULLET_COLLISION}
${LINEAR_MATH}
${OPENGL_SUP}
${ASSIMP_LIBRARY}
${ASSIMP2}
${SDL2_LIBRARY}
${SDL2_MIXER}
)
target_link_libraries(${PROJECT_NAME} ${ALL_LIBS} assimp)
IF (INTERNAL_ADD_POSTFIX_EXECUTABLE_NAMES)
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES DEBUG_POSTFIX "_Debug")
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES MINSIZEREL_POSTFIX "_MinsizeRel")
SET_TARGET_PROPERTIES(${PROJECT_NAME} PROPERTIES RELWITHDEBINFO_POSTFIX "_RelWithDebugInfo")
ENDIF(INTERNAL_ADD_POSTFIX_EXECUTABLE_NAMES)