-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
131 lines (102 loc) · 3.49 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
project(opengl_play)
cmake_minimum_required(VERSION 2.8)
set(CMAKE_VERBOSE_MAKEFILE 1)
SET(CMAKE_CXX_FLAGS_RELEASE "-O2")
SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -ggdb")
#########################################################
# C++1y
#########################################################
#SET(COMPILER_OPT_LVL "-O2")
include(CheckCXXCompilerFlag)
CHECK_CXX_COMPILER_FLAG("-std=c++1z" COMPILER_SUPPORTS_CXX1Z)
CHECK_CXX_COMPILER_FLAG("-std=c++1y" COMPILER_SUPPORTS_CXX1Y)
if(COMPILER_SUPPORTS_CXX1Z)
set(CPP_VER_FLAG "-std=c++1z")
elseif(COMPILER_SUPPORTS_CXX1Y)
set(CPP_VER_FLAG "-std=c++1y")
else()
message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.")
endif()
set(CMAKE_CXX_FLAGS "${CPP_VER_FLAG} ${COMPILER_OPT_LVL}")
#########################################################
# PTHREAD
#########################################################
find_package(Threads REQUIRED)
#########################################################
# FIND GLUT
#########################################################
find_package(GLUT REQUIRED)
include_directories(${GLUT_INCLUDE_DIRS})
link_directories(${GLUT_LIBRARY_DIRS})
add_definitions(${GLUT_DEFINITIONS})
if(NOT GLUT_FOUND)
message(ERROR " GLUT not found!")
endif(NOT GLUT_FOUND)
#########################################################
# FIND GLEW
#########################################################
find_package(GLEW REQUIRED)
if (GLEW_FOUND)
include_directories(${GLEW_INCLUDE_DIRS})
link_libraries(${GLEW_LIBRARIES})
endif()
#########################################################
# FIND OPENGL
#########################################################
find_package(OpenGL REQUIRED)
include_directories(${OpenGL_INCLUDE_DIRS})
link_directories(${OpenGL_LIBRARY_DIRS})
add_definitions(${OpenGL_DEFINITIONS})
if(NOT OPENGL_FOUND)
message(ERROR " OPENGL not found!")
endif(NOT OPENGL_FOUND)
if(NOT OPENGL_GLU_FOUND)
message(ERROR " GLU not found!")
endif(NOT OPENGL_GLU_FOUND)
#########################################################
# FIND GLFW
#########################################################
set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
add_subdirectory("./glfw/")
#########################################################
# FIND FREETYPE
#########################################################
find_package(Freetype REQUIRED)
include_directories(${FREETYPE_INCLUDE_DIRS})
link_directories(${FREETYPE_LIBRARIES})
#########################################################
# FIND ASSIMP
#########################################################
find_package(ASSIMP REQUIRED)
if(ASSIMP_FOUND)
include_directories(${ASSIMP_INCLUDE_DIR})
link_directories( ${ASSIMP_LIBRARIES} )
message(STATUS "Found asset importer library: ${ASSIMP_LIBRARIES}")
else()
message(ERROR " ASSIMP not found!")
endif()
#########################################################
# Remaining stuff
#########################################################
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/")
file(GLOB SRC_LIST
"*.hpp"
"*.cpp"
"./logger/*.hpp"
"./logger/*.cpp"
)
add_executable(${PROJECT_NAME} ${SRC_LIST})
target_link_libraries(
${PROJECT_NAME}
${CMAKE_THREAD_LIBS_INIT}
${GLUT_LIBRARIES}
${OPENGL_glu_LIBRARY}
${OPENGL_gl_LIBRARY}
${GLEW_LIBRARIES}
${FREETYPE_LIBRARIES}
${GLM_LIBRARY_DIRS}
${ASSIMP_LIBRARIES}
glfw
SOIL)