]> git.lizzy.rs Git - nothing.git/blob - CMakeLists.txt
(#903) MenuTitle -> WigglyText
[nothing.git] / CMakeLists.txt
1 cmake_minimum_required(VERSION 3.2)
2 project(nothing)
3
4 if(WIN32)
5   set(SDL2_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/SDL2/include")
6
7   # Support both 32 and 64 bit builds
8   if (${CMAKE_SIZEOF_VOID_P} MATCHES 8)
9     set(SDL2_LIBRARIES "${CMAKE_SOURCE_DIR}/SDL2/lib/x64/SDL2.lib;${CMAKE_SOURCE_DIR}/SDL2/lib/x64/SDL2main.lib")
10   else()
11     set(SDL2_LIBRARIES "${CMAKE_SOURCE_DIR}/SDL2/lib/x86/SDL2.lib;${CMAKE_SOURCE_DIR}/SDL2/lib/x86/SDL2main.lib")
12   endif()
13
14   string(STRIP "${SDL2_LIBRARIES}" SDL2_LIBRARIES)
15 else()
16   find_package(SDL2 REQUIRED)
17 endif()
18
19 if("${SDL2_LIBRARIES}" STREQUAL "")
20     message(WARNING "SDL2_LIBRARIES wasn't set, manually setting to SDL2::SDL2")
21     set(SDL2_LIBRARIES "SDL2::SDL2")
22 endif()
23
24 include_directories(${CMAKE_BINARY_DIR})
25 include_directories(src/)
26
27 include_directories(${SDL2_INCLUDE_DIRS})
28
29 add_library(system STATIC
30   src/system/line_stream.c
31   src/system/line_stream.h
32   src/system/log.c
33   src/system/log.h
34   src/system/log_script.c
35   src/system/log_script.h
36   src/system/lt.h
37   src/system/lt_adapters.h
38   src/system/lt_adapters.c
39   src/system/nth_alloc.c
40   src/system/nth_alloc.h
41   src/system/stacktrace.c
42   src/system/stacktrace.h
43   src/system/str.c
44   src/system/str.h
45   src/dynarray.h
46   src/dynarray.c
47   src/hashset.h
48   src/hashset.c
49   src/system/file.h
50   src/system/file.c
51   )
52
53 add_library(ebisp STATIC
54   src/ebisp/builtins.c
55   src/ebisp/builtins.h
56   src/ebisp/expr.c
57   src/ebisp/expr.h
58   src/ebisp/gc.c
59   src/ebisp/gc.h
60   src/ebisp/interpreter.c
61   src/ebisp/interpreter.h
62   src/ebisp/parser.c
63   src/ebisp/parser.h
64   src/ebisp/scope.c
65   src/ebisp/scope.h
66   src/ebisp/std.c
67   src/ebisp/std.h
68   src/ebisp/tokenizer.c
69   src/ebisp/tokenizer.h
70   )
71 target_link_libraries(ebisp system)
72
73 add_executable(nothing 
74   src/broadcast.c
75   src/broadcast.h
76   src/color.c
77   src/color.h
78   src/game.c
79   src/game.h
80   src/game/camera.c
81   src/game/camera.h
82   src/game/level.c
83   src/game/level.h
84   src/game/level/background.c
85   src/game/level/background.h
86   src/game/level/boxes.c
87   src/game/level/boxes.h
88   src/game/level/goals.c
89   src/game/level/goals.h
90   src/game/level/labels.c
91   src/game/level/labels.h
92   src/game/level/lava.c
93   src/game/level/lava.h
94   src/game/level/lava/wavy_rect.c
95   src/game/level/lava/wavy_rect.h
96   src/game/level/platforms.c
97   src/game/level/platforms.h
98   src/game/level/player.c
99   src/game/level/player.h
100   src/game/level/explosion.c
101   src/game/level/explosion.h
102   src/game/level/regions.c
103   src/game/level/regions.h
104   src/game/level/rigid_bodies.c
105   src/game/level/rigid_bodies.h
106   src/game/level/script.c
107   src/game/level/script.h
108   src/game/level_picker.c
109   src/game/level_picker.h
110   src/game/level_folder.h
111   src/game/level_folder.c
112   src/game/sound_samples.c
113   src/game/sound_samples.h
114   src/game/sprite_font.c
115   src/game/sprite_font.h
116   src/main.c
117   src/math/extrema.c
118   src/math/extrema.h
119   src/math/mat3x3.c
120   src/math/mat3x3.h
121   src/math/pi.h
122   src/math/point.c
123   src/math/point.h
124   src/math/rand.c
125   src/math/rand.h
126   src/math/rect.c
127   src/math/rect.h
128   src/math/triangle.c
129   src/math/triangle.h
130   src/sdl/renderer.c
131   src/sdl/renderer.h
132   src/sdl/texture.h
133   src/sdl/texture.c
134   src/ui/console.c
135   src/ui/console.h
136   src/ui/console_log.c
137   src/ui/console_log.h
138   src/ui/edit_field.c
139   src/ui/edit_field.h
140   src/ui/history.c
141   src/ui/history.h
142   src/ui/list_selector.h
143   src/ui/list_selector.c
144   src/ui/wiggly_text.h
145   src/ui/wiggly_text.c
146   src/ui/slider.h
147   src/ui/slider.c
148   src/game/level_metadata.h
149   src/game/level_metadata.c
150   src/game/level/level_editor.h
151   src/game/level/level_editor.c
152   src/game/level/level_editor/color_picker.h
153   src/game/level/level_editor/color_picker.c
154   src/game/level/level_editor/rect_layer.h
155   src/game/level/level_editor/rect_layer.c
156   src/game/level/level_editor/layer_picker.h
157   src/game/level/level_editor/layer_picker.c
158   src/game/level/level_editor/point_layer.h
159   src/game/level/level_editor/point_layer.c
160   src/game/level/level_editor/player_layer.h
161   src/game/level/level_editor/player_layer.c
162   src/game/level/level_editor/layer.h
163   src/game/level/level_editor/layer.c
164   src/game/level/level_editor/label_layer.c
165   src/game/level/level_editor/label_layer.h
166 )
167 target_link_libraries(nothing ${SDL2_LIBRARIES} system ebisp)
168
169 add_executable(repl
170   src/ebisp/repl.c
171   src/ebisp/repl_runtime.c
172   )
173 target_link_libraries(repl ${SDL2_LIBRARIES} system ebisp)
174
175 add_executable(nothing_test
176   test/main.c
177   test/test.h
178   test/tokenizer_suite.h
179   )
180 target_link_libraries(nothing_test ${SDL2_LIBRARIES} system ebisp)
181
182 if(("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") OR ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang"))
183   set(CMAKE_C_FLAGS
184     "${CMAKE_C_FLAGS} \
185      -Wall \
186      -Werror \
187      -Wextra \
188      -Wconversion \
189      -Wunused \
190      -Wunused-function \
191      -Wunused-label \
192      -Wunused-macros \
193      -Wunused-parameter \
194      -Wunused-value \
195      -Wunused-variable \
196      -Wcast-align \
197      -Wcast-qual \
198      -Wmissing-declarations \
199      -Wredundant-decls \
200      -Wmissing-prototypes \
201      -Wnested-externs \
202      -Wpointer-arith \
203      -Wshadow \
204      -Wstrict-prototypes \
205      -Wwrite-strings \
206      -Wswitch \
207      -Wmissing-field-initializers \
208      -fno-common \
209      -pedantic \
210      -std=c11 \
211      -ggdb \
212      -O3")
213   target_link_libraries(nothing m)
214 elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
215   set(CMAKE_C_FLAGS
216     "${CMAKE_C_FLAGS} \
217     /Wall \
218     /WX \
219     /wd4127 \
220     /wd4201 \
221     /wd4204 \
222     /wd4255 \
223     /wd4389 \
224     /wd4668 \
225     /wd4702 \
226     /wd4710 \
227     /wd4777 \
228     /wd4820 \
229     /wd5045 \
230     /D \"_CRT_SECURE_NO_WARNINGS\"")
231 endif()
232 if(WIN32)
233   target_link_libraries(nothing Imm32 Version winmm)
234 endif()
235
236 file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test-data DESTINATION ${CMAKE_CURRENT_BINARY_DIR})