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()
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
src/dynarray.c
src/hashset.h
src/hashset.c
+ src/system/file.h
+ src/system/file.c
)
add_library(ebisp STATIC
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/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
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
)
target_link_libraries(nothing ${SDL2_LIBRARIES} system ebisp)
)
target_link_libraries(nothing_test ${SDL2_LIBRARIES} system ebisp)
-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 \
-Wswitch \
-Wmissing-field-initializers \
-fno-common \
+ -fno-strict-aliasing \
-pedantic \
-std=c11 \
-ggdb \
/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()