forked from ksundberg/CS5500
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
169 lines (140 loc) · 4.62 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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
cmake_minimum_required(VERSION 2.8)
project(TorusWorld)
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/client
${CMAKE_CURRENT_SOURCE_DIR}/client/forms
${CMAKE_CURRENT_SOURCE_DIR}/client/src
${CMAKE_CURRENT_SOURCE_DIR}/common
${CMAKE_CURRENT_SOURCE_DIR}/common/item
${CMAKE_CURRENT_SOURCE_DIR}/common/log
${CMAKE_CURRENT_SOURCE_DIR}/common/noise
${CMAKE_CURRENT_SOURCE_DIR}/common/Physics
${CMAKE_CURRENT_SOURCE_DIR}/common/player
${CMAKE_CURRENT_SOURCE_DIR}/common/util
${CMAKE_CURRENT_SOURCE_DIR}/common/voxel
${CMAKE_CURRENT_SOURCE_DIR}/common/materialContainer
${CMAKE_CURRENT_SOURCE_DIR}/common/Controls
${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_SOURCE_DIR}/log
${CMAKE_CURRENT_SOURCE_DIR}/test
)
add_definitions( -std=c++0x )
set(EXTRA_COMPILE_FLAGS "-Wall -Wextra -Werror -Wno-missing-braces -g")
set(CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS} ${EXTRA_COMPILE_FLAGS})
set(CMAKE_EXE_LINKER_FLAGS ${CMAKE_EXE_LINKER_FLAGS})
set(client_srcs
client/src/main.cpp
client/src/main.h
client/forms/MainWindow.cpp
client/forms/MainWindow.h
client/forms/GridPane.cpp
client/forms/GridPane.h
client/forms/canvas.cpp
client/forms/canvas.h
client/src/Grid.hpp
client/src/Grid.cpp
include/wxwidget.h
)
source_group("client" FILES ${client_srcs})
set(common_srcs
common/log/logger.h
common/log/logger.cpp
common/noise/PerlinNoise.cpp
common/noise/PerlinNoise.h
common/Physics/PhysicsEngine.cpp
common/Physics/PhysicsEngine.h
common/Physics/MovingObject.cpp
common/Physics/MovingObject.h
common/player/inventory.h
common/player/inventory.cpp
common/player/Camera.cpp
common/player/Camera.h
common/item/item.h
common/item/item.cpp
common/item/itemgen.h
common/item/itemgen.cpp
common/worldFactory.h
common/worldFactory.cpp
common/util/vector3.cpp
common/util/vector3.h
common/util/Point.hpp
common/voxel/block.cpp
common/voxel/block.h
common/voxel/chunk.cpp
common/voxel/chunk.h
common/voxel/chunkmanager.cpp
common/voxel/chunkmanager.h
common/materialContainer/MaterialContainer.cpp
common/materialContainer/MaterialContainer.h
common/object.cpp
common/object.h
common/world.cpp
common/world.h
common/dungeon.cpp
common/dungeon.h
client/forms/graphics.cpp
client/forms/graphics.h
client/forms/textures.h
common/density/material_density.cpp
common/density/material_density.h
common/density/rectangular_prism.cpp
common/density/rectangular_prism.h
)
source_group("common" FILES ${common_srcs})
set(test_srcs
test/main.cpp
include/catch.hpp
test/unit/sample.cpp
test/unit/inventory_test.cpp
test/unit/chunkmanager_test.cpp
test/unit/vector3f_test.cpp
test/unit/dungeon_test.cpp
)
source_group("test" FILES ${test_srcs})
#wxwidgets
set(wxWidgets_CONFIGURATION mswu)
find_package(wxWidgets COMPONENTS core base gl REQUIRED)
include(${wxWidgets_USE_FILE})
#tbb
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/CMake/FindTBB/")
find_package(TBB)
include_directories(${TBB_INCLUDE_DIRS})
link_directories(${TBB_LIBRARY_DIRS})
add_library(common STATIC ${common_srcs})
# OpenGL
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/CMake/FindGLM/")
find_package(OpenGL REQUIRED)
find_package(GLUT REQUIRED)
find_package(GLM REQUIRED)
find_package(GLEW REQUIRED)
include_directories(${OPENGL_INCLUDE_DIRS}
${GLUT_INCLUDE_DIRS}
${GLM_INCLUDE_DIRS}
${GLEW_INCLUDE_DIRS})
add_executable(torus ${client_srcs})
add_executable(torus_test ${test_srcs})
target_link_libraries(torus common ${wxWidgets_LIBRARIES}
${TBB_LIBRARIES}
${OPENGL_LIBRARIES}
${GLUT_LIBRARY}
${GLEW_LIBRARY})
target_link_libraries(torus_test common ${TBB_LIBRARIES}
${wxWidgets_LIBRARIES}
${OPENGL_LIBRARIES}
${GLUT_LIBRARY}
${GLEW_LIBRARY})
enable_testing()
add_test(unit_tests torus_test)
# Copy log directory
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/log/log.conf DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/log)
add_custom_command(TARGET torus POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${CMAKE_SOURCE_DIR}/common/voxel/world.v.glsl"
"${CMAKE_BINARY_DIR}/world.v.glsl"
DEPENDS "${CMAKE_SOURCE_DIR}/world.v.glsl")
add_custom_command(TARGET torus POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
"${CMAKE_SOURCE_DIR}/common/voxel/world.f.glsl"
"${CMAKE_BINARY_DIR}/world.f.glsl"
DEPENDS "${CMAKE_SOURCE_DIR}/world.f.glsl")