project(nothing)
if(WIN32)
- # Conan integration
- include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
- conan_basic_setup()
-endif()
+ set(SDL2_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/SDL2/include")
-set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH})
+ # Support both 32 and 64 bit builds
+ if (${CMAKE_SIZEOF_VOID_P} MATCHES 8)
+ set(SDL2_LIBRARIES "${CMAKE_SOURCE_DIR}/SDL2/lib/x64/SDL2.lib;${CMAKE_SOURCE_DIR}/SDL2/lib/x64/SDL2main.lib")
+ else()
+ set(SDL2_LIBRARIES "${CMAKE_SOURCE_DIR}/SDL2/lib/x86/SDL2.lib;${CMAKE_SOURCE_DIR}/SDL2/lib/x86/SDL2main.lib")
+ endif()
-find_package(SDL2 REQUIRED)
-find_package(SDL2_mixer REQUIRED)
+ string(STRIP "${SDL2_LIBRARIES}" SDL2_LIBRARIES)
+else()
+ find_package(SDL2 REQUIRED)
+endif()
+
+if("${SDL2_LIBRARIES}" STREQUAL "")
+ message(WARNING "SDL2_LIBRARIES wasn't set, manually setting to SDL2::SDL2")
+ set(SDL2_LIBRARIES "SDL2::SDL2")
+endif()
include_directories(${CMAKE_BINARY_DIR})
include_directories(src/)
-if(APPLE)
- include_directories(${SDL2_INCLUDE_DIR}/..)
-else()
- include_directories(${SDL2_INCLUDE_DIR})
-endif()
+include_directories(${SDL2_INCLUDE_DIRS})
-include_directories(${SDL2_MIXER_INCLUDE_DIR})
+add_library(system STATIC
+ src/system/line_stream.c
+ src/system/line_stream.h
+ src/system/log.c
+ src/system/log.h
+ src/system/log_script.c
+ src/system/log_script.h
+ src/system/lt.h
+ src/system/nth_alloc.c
+ src/system/nth_alloc.h
+ src/system/stacktrace.c
+ src/system/stacktrace.h
+ src/system/str.c
+ src/system/str.h
+ src/dynarray.h
+ src/dynarray.c
+ src/hashset.h
+ src/hashset.c
+ )
-add_executable(nothing
- src/color.c
- src/game.c
- src/game/camera.c
- src/ui/edit_field.c
- src/game/level.c
- src/game/level/background.c
- src/game/level/boxes.c
- src/game/level/goals.c
- src/game/level/labels.c
- src/game/level/lava.c
- src/game/level/lava/wavy_rect.c
- src/game/level/physical_world.c
- src/game/level/platforms.c
- src/game/level/player.c
- src/game/level/player/dying_rect.c
- src/game/level/player/rigid_rect.c
- src/game/level/solid.c
- src/game/sound_samples.c
- src/game/sprite_font.c
- src/main.c
- src/math/mat3x3.c
- src/math/point.c
- src/math/rand.c
- src/math/rect.c
- src/math/triangle.c
+add_library(ebisp STATIC
+ src/ebisp/builtins.c
+ src/ebisp/builtins.h
src/ebisp/expr.c
+ src/ebisp/expr.h
+ src/ebisp/gc.c
+ src/ebisp/gc.h
src/ebisp/interpreter.c
+ src/ebisp/interpreter.h
src/ebisp/parser.c
- src/ebisp/tokenizer.c
- src/ebisp/gc.c
+ src/ebisp/parser.h
src/ebisp/scope.c
- src/sdl/renderer.c
- src/system/lt.c
- src/system/lt/lt_adapters.c
- src/system/lt/lt_slot.c
- src/ui/console.c
- src/ui/console_log.c
- src/str.c
- src/ui/history.c
- src/game/level/regions.c
+ src/ebisp/scope.h
+ src/ebisp/std.c
+ src/ebisp/std.h
+ src/ebisp/tokenizer.c
+ src/ebisp/tokenizer.h
+ )
+target_link_libraries(ebisp system)
+
+add_executable(nothing
+ src/broadcast.c
+ src/broadcast.h
+ src/color.c
src/color.h
+ src/game.c
src/game.h
+ src/game/camera.c
src/game/camera.h
- src/ui/edit_field.h
+ src/game/level.c
src/game/level.h
+ src/game/level/background.c
src/game/level/background.h
+ src/game/level/boxes.c
src/game/level/boxes.h
+ src/game/level/goals.c
src/game/level/goals.h
+ src/game/level/labels.c
src/game/level/labels.h
+ src/game/level/lava.c
src/game/level/lava.h
+ src/game/level/lava/wavy_rect.c
src/game/level/lava/wavy_rect.h
- src/game/level/physical_world.c
+ src/game/level/platforms.c
src/game/level/platforms.h
+ src/game/level/player.c
src/game/level/player.h
- src/game/level/player/dying_rect.h
- src/game/level/player/rigid_rect.h
- src/game/level/solid.h
+ src/game/level/explosion.c
+ src/game/level/explosion.h
+ src/game/level/regions.c
+ src/game/level/regions.h
+ src/game/level/rigid_bodies.c
+ src/game/level/rigid_bodies.h
+ src/game/level/script.c
+ src/game/level/script.h
+ src/game/level_picker.c
+ src/game/level_picker.h
+ src/game/level_folder.h
+ src/game/level_folder.c
+ src/game/sound_samples.c
src/game/sound_samples.h
+ src/game/sprite_font.c
src/game/sprite_font.h
+ src/main.c
+ src/math/extrema.c
+ src/math/extrema.h
+ src/math/mat3x3.c
src/math/mat3x3.h
src/math/pi.h
+ src/math/point.c
src/math/point.h
+ src/math/rand.c
src/math/rand.h
+ src/math/rect.c
src/math/rect.h
+ src/math/triangle.c
src/math/triangle.h
- src/ebisp/builtins.c
- src/ebisp/builtins.h
- src/ebisp/expr.h
- src/ebisp/gc.h
- src/ebisp/scope.h
- src/ebisp/interpreter.h
- src/ebisp/parser.h
- src/ebisp/tokenizer.h
+ src/sdl/renderer.c
src/sdl/renderer.h
- src/system/lt.h
- src/system/lt/lt_adapters.h
- src/system/lt/lt_slot.h
+ src/sdl/texture.h
+ src/sdl/texture.c
+ src/ui/console.c
src/ui/console.h
+ src/ui/console_log.c
src/ui/console_log.h
- src/str.h
+ src/ui/edit_field.c
+ src/ui/edit_field.h
+ src/ui/history.c
src/ui/history.h
- src/game/level/regions.h
- src/system/line_stream.h
- src/system/line_stream.c
- src/game/level/script.h
- src/game/level/script.c
- src/system/log.h
- src/system/log.c
- src/system/log_script.h
- src/system/log_script.c
- src/system/nth_alloc.h
- src/system/nth_alloc.c
- src/ebisp/std.h
- src/ebisp/std.c
- src/system/stacktrace.h
- src/system/stacktrace.c
- src/game/level_picker.h
- src/game/level_picker.c
- src/broadcast.c
- src/broadcast.h
- broadcast_lisp.h
- src/game/level/rigid_bodies.h
- src/game/level/rigid_bodies.c
- src/math/extrema.h
- src/math/extrema.c
+ src/ui/list_selector.h
+ src/ui/list_selector.c
+ src/ui/menu_title.h
+ src/ui/menu_title.c
+ src/ui/slider.h
+ src/ui/slider.c
+ src/game/level_metadata.h
+ src/game/level_metadata.c
+ src/game/level/level_editor/proto_rect.h
+ src/game/level/level_editor/proto_rect.c
+ src/game/level/level_editor.h
+ src/game/level/level_editor.c
+ src/game/level/level_editor/color_picker.h
+ src/game/level/level_editor/color_picker.c
+ src/game/level/level_editor/rect_layer.h
+ src/game/level/level_editor/rect_layer.c
+ src/game/level/level_editor/layer_picker.h
+ src/game/level/level_editor/layer_picker.c
+ src/game/level/level_editor/point_layer.h
+ src/game/level/level_editor/point_layer.c
+ src/game/level/level_editor/player_layer.h
+ src/game/level/level_editor/player_layer.c
+ src/game/level/level_editor/layer.h
+ src/game/level/level_editor/layer.c
+ src/game/level/level_editor/label_layer.c
+ src/game/level/level_editor/label_layer.h
+ src/system/file.h
+ src/system/file.c
)
-
-add_custom_command(
- OUTPUT broadcast_lisp.h
- COMMAND ${CMAKE_BINARY_DIR}/baker ${CMAKE_SOURCE_DIR}/src/broadcast.lisp broadcast_lisp.h broadcast_lisp_library
- DEPENDS baker src/broadcast.lisp)
+target_link_libraries(nothing ${SDL2_LIBRARIES} system ebisp)
add_executable(repl
- src/ebisp/builtins.c
- src/ebisp/builtins.h
- src/ebisp/expr.c
- src/ebisp/expr.h
- src/ebisp/interpreter.c
- src/ebisp/interpreter.h
- src/ebisp/parser.c
- src/ebisp/parser.h
- src/ebisp/scope.c
- src/ebisp/scope.h
- src/ebisp/tokenizer.c
- src/ebisp/tokenizer.h
src/ebisp/repl.c
- src/system/lt.c
- src/system/lt.h
- src/system/lt/lt_adapters.c
- src/system/lt/lt_adapters.h
- src/system/lt/lt_slot.c
- src/system/lt/lt_slot.h
- src/ebisp/gc.h
- src/ebisp/gc.c
- src/str.h
- src/str.c
- src/system/log.h
- src/system/log.c
- src/system/nth_alloc.h
- src/system/nth_alloc.c
- src/ebisp/repl_runtime.h
src/ebisp/repl_runtime.c
- src/ebisp/std.h
- src/ebisp/std.c
- src/system/stacktrace.h
- src/system/stacktrace.c
- )
-add_executable(baker
- src/ebisp/baker.c
- src/ebisp/parser.c
- src/ebisp/parser.h
- src/ebisp/tokenizer.h
- src/ebisp/tokenizer.c
- src/ebisp/builtins.h
- src/ebisp/builtins.c
- src/ebisp/expr.c
- src/ebisp/expr.h
- src/ebisp/gc.c
- src/ebisp/gc.h
- src/system/lt.c
- src/system/lt.h
- src/system/lt/lt_slot.c
- src/system/lt/lt_slot.h
- src/system/stacktrace.h
- src/system/stacktrace.c
- src/system/nth_alloc.h
- src/system/nth_alloc.c
- src/system/log.h
- src/system/log.c
- src/str.h
- src/str.c
)
+target_link_libraries(repl ${SDL2_LIBRARIES} system ebisp)
add_executable(nothing_test
- src/ebisp/builtins.c
- src/ebisp/builtins.h
- src/ebisp/expr.c
- src/ebisp/expr.h
- src/ebisp/interpreter.c
- src/ebisp/interpreter.h
- src/ebisp/parser.c
- src/ebisp/parser.h
- src/ebisp/scope.c
- src/ebisp/scope.h
- src/ebisp/tokenizer.c
- src/ebisp/tokenizer.h
- src/ebisp/gc.h
- src/ebisp/gc.c
- src/system/lt.c
- src/system/lt.h
- src/system/lt/lt_adapters.c
- src/system/lt/lt_adapters.h
- src/system/lt/lt_slot.c
- src/system/lt/lt_slot.h
- src/str.h
- src/str.c
test/main.c
test/test.h
test/tokenizer_suite.h
- src/system/log.h
- src/system/log.c
- src/system/nth_alloc.h
- src/system/nth_alloc.c
- src/system/stacktrace.h
- src/system/stacktrace.c
)
-target_link_libraries(nothing ${SDL2_LIBRARY} ${SDL2_MIXER_LIBRARY} m)
-target_link_libraries(nothing_test ${SDL2_LIBRARY} ${SDL2_MIXER_LIBRARY} m)
-target_link_libraries(repl ${SDL2_LIBRARY} ${SDL2_MIXER_LIBRARY} m)
+target_link_libraries(nothing_test ${SDL2_LIBRARIES} system ebisp)
if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "CLANG"))
set(CMAKE_C_FLAGS
-fno-common \
-pedantic \
-std=c11 \
+ -ggdb \
-O3")
target_link_libraries(nothing m)
+elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
+ set(CMAKE_C_FLAGS
+ "${CMAKE_C_FLAGS} \
+ /Wall \
+ /WX \
+ /wd4127 \
+ /wd4201 \
+ /wd4204 \
+ /wd4255 \
+ /wd4389 \
+ /wd4668 \
+ /wd4702 \
+ /wd4710 \
+ /wd4777 \
+ /wd4820 \
+ /wd5045 \
+ /D \"_CRT_SECURE_NO_WARNINGS\"")
endif()
if(WIN32)
target_link_libraries(nothing Imm32 Version winmm)
endif()
-file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/sounds DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
-file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/fonts DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test-data DESTINATION ${CMAKE_CURRENT_BINARY_DIR})