-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
executable file
·144 lines (130 loc) · 3.75 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
cmake_minimum_required(VERSION 3.2.2)
project(gameplay)
set (GAMEPLAY_VERSION "0.7.1")
set (V8_LIBS_DIR ${CMAKE_SOURCE_DIR}/deps/v8/lib)
set (CMAKE_BUILD_TYPE Release)
if (WIN32)
set (V8_LIBS
${V8_LIBS_DIR}/v8_base_0.lib
${V8_LIBS_DIR}/v8_base_1.lib
${V8_LIBS_DIR}/v8_base_2.lib
${V8_LIBS_DIR}/v8_base_3.lib
${V8_LIBS_DIR}/v8_libbase.lib
${V8_LIBS_DIR}/v8_nosnapshot.lib
${V8_LIBS_DIR}/v8_libplatform.lib)
set (OPENAL_LIBS OpenAL32)
else()
set (V8_LIBS
${V8_LIBS_DIR}/libv8_base.a
${V8_LIBS_DIR}/libv8_libbase.a
${V8_LIBS_DIR}/libv8_nosnapshot.a
${V8_LIBS_DIR}/libv8_libplatform.a)
set (OPENAL_LIBS openal)
endif()
set (GAMEPLAY_SRCS
src/main
src/utils/console
src/utils/file-reader
src/utils/timer.cpp
src/utils/timer.h
src/utils/path-helper.h
src/script/script-global.h
src/script/script-global.cpp
src/script/script-engine.h
src/script/script-engine.cpp
src/script/script-object-wrap.h
src/script/scriptobjecthelper.h
src/input/keyboard
src/input/mouse
src/graphics/texture2d.h
src/graphics/texture2d.cpp
src/graphics/texture-font.h
src/graphics/texture-font.cpp
src/graphics/render-target.h
src/graphics/render-target.cpp
src/graphics/shader
src/graphics/shader-program.h
src/graphics/shader-program.cpp
src/graphics/window
src/graphics/graphics-device.cpp
src/graphics/graphics-device.h
src/graphics/vertex-specification.cpp
src/graphics/vertex-specification.h
src/graphics/texture-collection.cpp
src/graphics/texture-collection.h
src/graphics/glyph-collection.h
src/graphics/glyph-collection.cpp
src/audio/audio-manager.cpp
src/audio/audio-manager.h
src/audio/sound-buffer.cpp
src/audio/sound-buffer.h
src/audio/sound-source.cpp
src/audio/sound-source.h
src/utils/file-watcher.cpp
src/utils/file-watcher.h
src/debug/debug-server.cpp
src/debug/debug-server.h)
set (GAMEPLAY_LIBS
${V8_LIBS}
freetype
libglew_static
${OPENAL_LIBS}
glfw ${GLFW_LIBRARIES}
efsw)
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
# Find and set libraries for Mac OS X
find_library(COCOA_LIBRARY Cocoa)
find_library(OPENGL_LIBRARY OpenGL)
find_library(IOKIT_LIBRARY IOKit)
find_library(COREVIDEO_LIBRARY CoreVideo)
set (GAMEPLAY_LIBS
${GAMEPLAY_LIBS}
${COCOA_LIBRARY}
${OPENGL_LIBRARY}
${IOKIT_LIBRARY}
${COREVIDEO_LIBRARY})
endif()
if (MSVC)
# Set Visual Studio runtime library to /MT instead of /MD for static linking
set(flags
CMAKE_C_FLAGS_DEBUG
CMAKE_C_FLAGS_MINSIZEREL
CMAKE_C_FLAGS_RELEASE
CMAKE_C_FLAGS_RELWITHDEBINFO
CMAKE_CXX_FLAGS_DEBUG
CMAKE_CXX_FLAGS_MINSIZEREL
CMAKE_CXX_FLAGS_RELEASE
CMAKE_CXX_FLAGS_RELWITHDEBINFO)
foreach(flag_var ${flags})
if(${flag_var} MATCHES "/MD")
string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
endif()
endforeach()
endif()
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/bin")
add_subdirectory(deps/glfw)
add_subdirectory(deps/glew)
add_subdirectory(deps/freetype)
add_subdirectory(deps/openal-soft)
add_subdirectory(deps/efsw)
include_directories(
deps/glfw/include
deps/glew/include
deps/freetype/include
deps/openal-soft/include
deps/stb
deps/v8
deps/v8/include
deps/efsw/include
deps/asio
src)
add_definitions(
-DGLEW_STATIC
-DAL_LIBTYPE_STATIC
-DGAMEPLAY_VERSION="${GAMEPLAY_VERSION}"
-DASIO_STANDALONE)
if (UNIX)
add_definitions(-std=c++11 -stdlib=libc++)
endif()
add_executable(gameplay ${GAMEPLAY_SRCS})
target_link_libraries(gameplay ${GAMEPLAY_LIBS})