]> git.lizzy.rs Git - nothing.git/blobdiff - CMakeLists.txt
(#1108) Introduce AcitonPicker
[nothing.git] / CMakeLists.txt
index 4c5d894972ff1febe5bb8a55f5890e0ef413ead0..f06d7db59f941543f92c28354c542a38e33e000e 100644 (file)
@@ -2,20 +2,40 @@ cmake_minimum_required(VERSION 3.2)
 project(nothing)
 
 if(WIN32)
-  set(SDL2_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/SDL2/include")
-
-  # 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")
+  if(MINGW)
+    add_compile_definitions(SDL_MAIN_HANDLED) # https://stackoverflow.com/a/25089610
+    add_compile_definitions(__USE_MINGW_ANSI_STDIO) # https://github.com/trink/symtseries/issues/49#issuecomment-160843756
+    # Support both 32 and 64 bit builds
+    if (${CMAKE_SIZEOF_VOID_P} MATCHES 8)
+      set(SDL2_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/SDL2/x86_64-w64-mingw32/include/SDL2")
+      set(SDL2_LIBRARIES "${CMAKE_SOURCE_DIR}/SDL2/x86_64-w64-mingw32/lib/libSDL2.a;${CMAKE_SOURCE_DIR}/SDL2/x86_64-w64-mingw32/lib/libSDL2main.a")
+    else()
+      set(SDL2_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/SDL2/i686-w64-mingw32/include/SDL2")
+      set(SDL2_LIBRARIES "${CMAKE_SOURCE_DIR}/SDL2/i686-w64-mingw32/lib/libSDL2.a;${CMAKE_SOURCE_DIR}/SDL2/i686-w64-mingw32/lib/libSDL2main.a")
+    endif()
+         
   else()
-    set(SDL2_LIBRARIES "${CMAKE_SOURCE_DIR}/SDL2/lib/x86/SDL2.lib;${CMAKE_SOURCE_DIR}/SDL2/lib/x86/SDL2main.lib")
-  endif()
+    set(SDL2_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/SDL2/include")
+
+    # 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()
 
+  endif()
   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/)
 
@@ -26,9 +46,9 @@ add_library(system STATIC
   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/lt_adapters.h
+  src/system/lt_adapters.c
   src/system/nth_alloc.c
   src/system/nth_alloc.h
   src/system/stacktrace.c
@@ -39,31 +59,11 @@ add_library(system STATIC
   src/dynarray.c
   src/hashset.h
   src/hashset.c
+  src/system/file.h
+  src/system/file.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/parser.h
-  src/ebisp/scope.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
@@ -94,8 +94,7 @@ add_executable(nothing
   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/action.h
   src/game/level_picker.c
   src/game/level_picker.h
   src/game/level_folder.h
@@ -105,13 +104,10 @@ add_executable(nothing
   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/vec.h
   src/math/rand.c
   src/math/rand.h
   src/math/rect.c
@@ -132,12 +128,12 @@ add_executable(nothing
   src/ui/history.h
   src/ui/list_selector.h
   src/ui/list_selector.c
-  src/ui/menu_title.h
-  src/ui/menu_title.c
+  src/ui/wiggly_text.h
+  src/ui/wiggly_text.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
@@ -154,25 +150,16 @@ add_executable(nothing
   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
+  src/game/level/level_editor/background_layer.c
+  src/game/level/level_editor/background_layer.h
+  src/game/level/level_editor/undo_history.h
+  src/game/level/level_editor/undo_history.c
+  src/game/level/level_editor/action_picker.h
+  src/game/level/level_editor/action_picker.c
 )
-target_link_libraries(nothing ${SDL2_LIBRARIES} system ebisp)
-
-add_executable(repl
-  src/ebisp/repl.c
-  src/ebisp/repl_runtime.c
-  )
-target_link_libraries(repl ${SDL2_LIBRARIES} system ebisp)
-
-add_executable(nothing_test
-  test/main.c
-  test/test.h
-  test/tokenizer_suite.h
-  )
-target_link_libraries(nothing_test ${SDL2_LIBRARIES} system ebisp)
+target_link_libraries(nothing ${SDL2_LIBRARIES} system)
 
-if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "CLANG"))
+if(("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") OR ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang"))
   set(CMAKE_C_FLAGS
     "${CMAKE_C_FLAGS} \
      -Wall \
@@ -199,14 +186,32 @@ if(("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") OR ("${CMAKE_CXX_COMPILER_ID}" ST
      -Wswitch \
      -Wmissing-field-initializers \
      -fno-common \
+          -fno-strict-aliasing \
      -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)
+if(MINGW)
+  target_link_libraries(nothing hid setupapi Imm32 Version winmm)
+elseif(WIN32)
   target_link_libraries(nothing Imm32 Version winmm)
 endif()
-
-file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test-data DESTINATION ${CMAKE_CURRENT_BINARY_DIR})