-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
168 lines (153 loc) · 4.38 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
cmake_minimum_required(VERSION 3.7)
cmake_policy(SET CMP0015 NEW)
project(libglesgae)
# compiles without warnings
#set(CMAKE_C_FLAGS "-Wall -Werror -Wpedantic -Wno-variadic-macros -Wcast-align -Wredundant-decls -Wextra -std=gnu99 -pedantic -pedantic-errors")
# compiles with warnings ( in external libs )
set(CMAKE_C_FLAGS "-Wall -Wpedantic -Wno-variadic-macros -Wcast-align -Wredundant-decls -Wextra -std=gnu89 -pedantic")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3")
# Compile Options
option(USE_SDL2 "Use SDL2 Bindings" OFF)
option(USE_OGL "Use OpenGL Bindings" OFF)
option(USE_SDL2GL "Use SDL2 with platform GL" OFF)
option(USE_EMSCRIPTEN "Use Emscripten" OFF)
IF(NOT CMAKE_BUILD_TYPE)
SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING
"Choose the type of build, options are: None Debug Release RelWithDebInfo MinSizeRel."
FORCE)
ENDIF(NOT CMAKE_BUILD_TYPE)
# Default, platform agnostic code
set(GLESGAE_BASE
GAE_Types.c
Buffer/Buffer.c
Events/Event.c
Events/EventSystem.c
External/jsmn/jsmn.c
Graphics/Sprite/Frame.c
Graphics/Sprite/Sprite.c
Graphics/Sprite/Animation.c
Input/Controller.c
Maths/Matrix.c
Maths/Point.c
Maths/Rect.c
Maths/Vector.c
States/State.c
States/StateStack.c
Time/Timer.c
Utils/Array.c
Utils/ArrayList.c
Utils/Group.c
Utils/Heap.c
Utils/HashString.c
Utils/List.c
Utils/Logger.c
Utils/Map.c
Utils/Tiled/TiledJsonLoader.c)
# SDL2 specifics
if (USE_SDL2)
set(GLESGAE_RENDERER
Audio/SDL2/AudioSystem.c
Audio/SDL2/Sound.c
Events/SDL2/SDL2Events.c
Events/SDL2/SDL2EventSystem.c
External/mojoAL/mojoal.c
Graphics/Texture.c
Graphics/Context/SDL2/SDL2RenderContext.c
Graphics/Renderer/SDL2/SDL2Renderer.c
Graphics/System/SDL2/SDL2GraphicsSystem.c
Graphics/Target/Texture/SDL2/TextureRenderTarget.c
Graphics/Texture/SDL2/SDL2Texture.c
Graphics/Window/SDL2/SDL2RenderWindow.c
Input/SDL2/SDL2InputSystem.c
Platform/SDL2/SDL2Platform.c
Utils/Tiled/SDL2/SDL2TiledJsonLoader.c)
add_definitions(-DSDL2)
find_package(SDL2 REQUIRED)
include_directories(${SDL2_INCLUDE_DIRS})
endif (USE_SDL2)
# Emscripten specifics
if (USE_EMSCRIPTEN)
set(GLESGAE_RENDERER
Audio/SDL2/AudioSystem.c
Audio/SDL2/Sound.c
Events/SDL2/SDL2Events.c
Events/SDL2/SDL2EventSystem.c
External/mojoAL/mojoal.c
Graphics/Texture.c
Graphics/Context/SDL2/SDL2RenderContext.c
Graphics/Renderer/SDL2/SDL2Renderer.c
Graphics/System/SDL2/SDL2GraphicsSystem.c
Graphics/Target/Texture/SDL2/TextureRenderTarget.c
Graphics/Texture/SDL2/SDL2Texture.c
Graphics/Window/SDL2/SDL2RenderWindow.c
Input/SDL2/SDL2InputSystem.c
Platform/SDL2/SDL2Platform.c
Utils/Tiled/SDL2/SDL2TiledJsonLoader.c)
add_definitions(-DSDL2)
add_definitions(-s USE_SDL=2)
endif (USE_EMSCRIPTEN)
# OGL specifics
if (USE_OGL)
remove_definitions(-DSDL2)
if (UNIX)
set(GLESGAE_RENDERER
Events/X11/X11EventSystem.c
Graphics/VertexBuffer.c
Graphics/Shader.c
Graphics/Mesh.c
Graphics/Material.c
Graphics/IndexBuffer.c
Graphics/Camera.c
Graphics/Texture.c
Graphics/Context/GLX/GLee.c
Graphics/Context/GLX/GLXRenderContext.c
Graphics/Renderer/GLES20/ShaderGLVboRenderer.c
Graphics/State/GLES2/GLES2State.c
Graphics/System/X11/X11GraphicsSystem.c
Graphics/Target/Buffer/OGL/BufferRenderTarget.c
Graphics/Target/Screen/OGL/ScreenRenderTarget.c
Graphics/Target/Texture/OGL/TextureRenderTarget.c
Graphics/Texture/GL/GLTexture.c
Graphics/Window/X11/X11RenderWindow.c
Input/Linux/LinuxInputSystem.c
Platform/Linux/LinuxPlatform.c
Utils/Tiled/OGL/GLTiledJsonLoader.c)
add_definitions(-DGLX)
elseif (WIN32)
set(GLESGAE_RENDERER )
elseif (APPLE)
set(GLESGAE_RENDERER )
endif (UNIX)
endif (USE_OGL)
# SDL with GL Specifics
if (USE_SDLGL)
set(GLESGAE_RENDERER )
endif (USE_SDLGL)
# SDL2 with GL Specifics
if (USE_SDL2GL)
set(GLESGAE_RENDERER )
endif (USE_SDL2GL)
# Platform specifics
if (UNIX)
set(GLESGAE_PLATFORM
File/Linux/File.c
Time/Linux/Clock.c)
add_definitions(-DLINUX)
elseif (WIN32)
set(GLESGAE_PLATFORM
File/Win32/File.c
Time/Win32/Clock.c)
add_definitions(-DWIN32)
elseif (APPLE)
endif (UNIX)
add_library(glesgae STATIC
${GLESGAE_BASE}
${GLESGAE_RENDERER}
${GLESGAE_PLATFORM}
)
add_custom_command(TARGET glesgae POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:glesgae> ../lib/$<TARGET_FILE_NAME:glesgae>)
# deal with link dependencies now
if (USE_SDL2)
target_link_libraries(glesgae ${SDL2_LIBRARIES})
endif (USE_SDL2)