-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
91 lines (80 loc) · 2.39 KB
/
CMakeLists.txt
File metadata and controls
91 lines (80 loc) · 2.39 KB
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
cmake_minimum_required(VERSION 2.6)
# Name of project
set(PROJ_NAME RileyBranch)
project(${PROJ_NAME})
# Specify project files: header files and source files
set(HDRS
file_utils.h
game.h
game_object.h
player_game_object.h
shader.h
collision.h
defs.h
enemy_game_object.h
asteroid.h
tile.h
bullet.h
powerup.h
shield.h
saucer_game_object.h
laser_game_object.h
missile.h
particle_system.h
)
set(SRCS
collision.cpp
file_utils.cpp
game.cpp
game_object.cpp
main.cpp
player_game_object.cpp
shader.cpp
enemy_game_object.cpp
asteroid.cpp
tile.cpp
bullet.cpp
powerup.cpp
shield.cpp
vertex_shader.glsl
fragment_shader.glsl
saucer_game_object.cpp
laser_game_object.cpp
missile.cpp
particle_system.cpp
particle_vertex_shader.glsl
particle_fragment_shader.glsl
)
# Add path name to configuration file
configure_file(path_config.h.in path_config.h)
# Add executable based on the source files
add_executable(${PROJ_NAME} ${HDRS} ${SRCS})
# Directories to include for header files, so that the compiler can find
# path_config.h
target_include_directories(${PROJ_NAME} PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
# Require OpenGL library
find_package(OpenGL REQUIRED)
include_directories(${OPENGL_INCLUDE_DIR})
target_link_libraries(${PROJ_NAME} ${OPENGL_gl_LIBRARY})
# Other libraries needed
set(LIBRARY_PATH "" CACHE PATH "Folder with GLEW, GLFW, GLM, and SOIL libraries")
include_directories(${LIBRARY_PATH}/include)
if(NOT WIN32)
find_library(GLEW_LIBRARY GLEW)
find_library(GLFW_LIBRARY glfw)
find_library(SOIL_LIBRARY SOIL)
elseif(WIN32)
find_library(GLEW_LIBRARY glew32s HINTS ${LIBRARY_PATH}/lib)
find_library(GLFW_LIBRARY glfw3 HINTS ${LIBRARY_PATH}/lib)
find_library(SOIL_LIBRARY SOIL HINTS ${LIBRARY_PATH}/lib)
endif(NOT WIN32)
target_link_libraries(${PROJ_NAME} ${GLEW_LIBRARY})
target_link_libraries(${PROJ_NAME} ${GLFW_LIBRARY})
target_link_libraries(${PROJ_NAME} ${SOIL_LIBRARY})
# The rules here are specific to Windows Systems
if(WIN32)
# Avoid ZERO_CHECK target in Visual Studio
set(CMAKE_SUPPRESS_REGENERATION TRUE)
# This will use the proper libraries in debug mode in Visual Studio
set_target_properties(${PROJ_NAME} PROPERTIES DEBUG_POSTFIX _d)
endif(WIN32)