Windows compatibility fixes
This commit is contained in:
parent
49bceafe0b
commit
19c29b261c
@ -18,12 +18,17 @@ LDFLAGS ?= -lSDL2 -lSDL2_image -lSDL2_gfx -lSDL2_ttf -pthread
|
||||
OUTPUTFLAG = -o
|
||||
endif
|
||||
|
||||
COMMON_OBJECTS = global_vars.${OBJEXT} sprites.${OBJEXT} maploader.${OBJEXT} libsdlpp.a
|
||||
COMMON_OBJECTS = global_vars.${OBJEXT} sprites.${OBJEXT} maploader.${OBJEXT}
|
||||
ifneq ($(UNAME_S),Windows)
|
||||
COMMON_OBJECTS += libsdlpp.a
|
||||
endif
|
||||
MARIO_OBJECTS = main.${OBJEXT} blocks.${OBJEXT} mario_visitor.${OBJEXT} mario.${OBJEXT} ${COMMON_OBJECTS}
|
||||
EDITOR_OBJECTS = editor.${OBJEXT} editor_blocks.${OBJEXT} edit_box.${OBJEXT} tool_box.${OBJEXT} editor_visitor.${OBJEXT} ${COMMON_OBJECTS}
|
||||
|
||||
ifeq ($(UNAME_S),Windows)
|
||||
MARIO_OBJECTS += ../sdlpp/SDL2/SDL2_framerate.c ../sdlpp/SDL2/SDL2_gfxPrimitives.c ../sdlpp/SDL2/SDL2_imageFilter.c ../sdlpp/SDL2/SDL2_rotozoom.c
|
||||
EDITOR_OBJECTS += ../sdlpp/SDL2/SDL2_framerate.c ../sdlpp/SDL2/SDL2_gfxPrimitives.c ../sdlpp/SDL2/SDL2_imageFilter.c ../sdlpp/SDL2/SDL2_rotozoom.c
|
||||
SDLLIB = libsdlpp.dll
|
||||
endif
|
||||
|
||||
.PHONY: default
|
||||
@ -31,9 +36,9 @@ default: mario
|
||||
|
||||
ifeq ($(UNAME_S),Windows)
|
||||
mario: ${MARIO_OBJECTS} ${SDLLIB}
|
||||
$(CXX) $(CXXFLAGS) -Fe"$@" ${MARIO_OBJECTS} /link ..\sdlpp\SDL2.lib ..\sdlpp\SDL2_ttf.lib ..\sdlpp\SDL2_image.lib
|
||||
$(CXX) $(CXXFLAGS) -Fe"$@" ${MARIO_OBJECTS} /link ..\sdlpp\SDL2.lib ..\sdlpp\SDL2_ttf.lib ..\sdlpp\SDL2_image.lib libsdlpp.lib
|
||||
editor: ${EDITOR_OBJECTS} ${SDLLIB}
|
||||
$(CXX) $(CXXFLAGS) ${EDITORFLAGS} -Fe"$@" ${EDITOR_OBJECTS} /link ..\sdlpp\SDL2.lib ..\sdlpp\SDL2_ttf.lib ..\sdlpp\SDL2_image.lib
|
||||
$(CXX) $(CXXFLAGS) ${EDITORFLAGS} -Fe"$@" ${EDITOR_OBJECTS} /link ..\sdlpp\SDL2.lib ..\sdlpp\SDL2_ttf.lib ..\sdlpp\SDL2_image.lib libsdlpp.lib
|
||||
|
||||
else
|
||||
mario: ${MARIO_OBJECTS}
|
||||
@ -71,10 +76,16 @@ libsdlpp.a: ../sdlpp
|
||||
$(MAKE) libsdlpp.a -C ../sdlpp
|
||||
cp ../sdlpp/libsdlpp.a .
|
||||
|
||||
windows_release: ../Release/Tetris
|
||||
cp mario.exe testfont.ttf block.png ../Release/Tetris
|
||||
rm ../Release/Tetris.zip
|
||||
cd ../Release && zip -r Tetris.zip Tetris
|
||||
libsdlpp.dll:
|
||||
$(MAKE) clean -C ../sdlpp
|
||||
$(MAKE) -C ../sdlpp
|
||||
cp ../sdlpp/libsdlpp.dll .
|
||||
cp ../sdlpp/libsdlpp.lib .
|
||||
|
||||
windows_release: ../Release/Mario mario editor ${SDLLIB}
|
||||
cp -R ${SDLLIB} mario.exe editor.exe sprites testfont.ttf ../Release/Mario
|
||||
rm -f ../Release/Mario.zip
|
||||
cd ../Release && zip -r Mario.zip Mario
|
||||
|
||||
start:
|
||||
LD_LIBRARY_PATH=$$(pwd) ./mario
|
||||
@ -82,4 +93,4 @@ start_edit:
|
||||
LD_LIBRARY_PATH=$$(pwd) ./editor
|
||||
|
||||
clean:
|
||||
rm -Rf *.${OBJEXT} mario editor *.a
|
||||
${RM} *.dll *.lib *.a *.${OBJEXT} mario editor
|
||||
|
@ -1,7 +1,11 @@
|
||||
#ifndef SPRITES_H
|
||||
#define SPRITES_H
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <SDL2/SDL_rect.h>
|
||||
#else
|
||||
#include "../sdlpp/SDL2/SDL_rect.h"
|
||||
#endif
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include "../sdlpp/sdlpp_vector.hpp"
|
||||
|
@ -16,16 +16,13 @@ OBJEXT = o
|
||||
endif
|
||||
|
||||
ifeq ($(UNAME_S),Linux)
|
||||
SDLPPLIBRARY = libsdlpp.so.${MAJOR}.${MINOR}.${RELEASE}
|
||||
LIBRARYFLAGS = -fPIC
|
||||
SDLPPLIBRARY = libsdlpp.a
|
||||
endif
|
||||
ifeq ($(UNAME_S),Darwin)
|
||||
SDLPPLIBRARY = libsdlpp.dylib
|
||||
LIBRARYFLAGS =
|
||||
SDLPPLIBRARY = libsdlpp.a
|
||||
endif
|
||||
ifeq ($(UNAME_S),Windows)
|
||||
SDLPPLIBRARY = libsdlpp.dll
|
||||
LIBRARYFLAGS =
|
||||
endif
|
||||
|
||||
OBJECTFILES = sdlpp_circlecolider.${OBJEXT} sdlpp_circlerenderer.${OBJEXT} sdlpp_collision.${OBJEXT} sdlpp_common.${OBJEXT} sdlpp_font.${OBJEXT} sdlpp_linerenderer.${OBJEXT} sdlpp_rectcolider.${OBJEXT} sdlpp_rectrenderer.${OBJEXT} sdlpp_renderer.${OBJEXT} sdlpp_renderobject.${OBJEXT} sdlpp_scene.${OBJEXT} sdlpp_textrenderer.${OBJEXT} sdlpp_texture.${OBJEXT} sdlpp_window.${OBJEXT} sdlpp_fontconfiguration.${OBJEXT} sdlpp_mouse.${OBJEXT}
|
||||
@ -34,10 +31,10 @@ all: ${SDLPPLIBRARY}
|
||||
|
||||
ifeq ($(UNAME_S),Windows)
|
||||
%.${OBJEXT}: %.cpp
|
||||
${CXX} ${CXXFLAGS} ${LIBRARYFLAGS} /c $< /Fo"$@"
|
||||
${CXX} ${CXXFLAGS} /c $< /Fo"$@"
|
||||
else
|
||||
%.${OBJEXT}: %.cpp
|
||||
${CXX} ${CXXFLAGS} ${LIBRARYFLAGS} -c $< -o $@
|
||||
${CXX} ${CXXFLAGS} -c $< -o $@
|
||||
endif
|
||||
|
||||
ifeq ($(UNAME_S),Linux)
|
||||
|
@ -1,5 +1,4 @@
|
||||
#include "sdlpp_renderobject.hpp"
|
||||
#include <SDL2/SDL_render.h>
|
||||
#include <cmath>
|
||||
|
||||
namespace SDLPP {
|
||||
|
@ -8,9 +8,13 @@
|
||||
#include "sdlpp_vector.hpp"
|
||||
#include "sdlpp_visitor.hpp"
|
||||
|
||||
#include <SDL2/SDL_render.h>
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
#ifndef _WIN32
|
||||
#include <SDL2/SDL_render.h>
|
||||
#else
|
||||
#include "SDL2/SDL_render.h"
|
||||
#endif
|
||||
|
||||
namespace SDLPP {
|
||||
|
||||
|
@ -4,8 +4,13 @@
|
||||
#include "global_vars.hpp"
|
||||
#include "../sdlpp/sdlpp_mouse.hpp"
|
||||
|
||||
#ifndef _WIN32
|
||||
#include <SDL2/SDL_events.h>
|
||||
#include <SDL2/SDL_mouse.h>
|
||||
#else
|
||||
#include "../sdlpp/SDL2/SDL_events.h"
|
||||
#include "../sdlpp/SDL2/SDL_mouse.h"
|
||||
#endif
|
||||
#include <thread>
|
||||
|
||||
constexpr uint64_t MAIN_MENU_RESUME = 0;
|
||||
|
Loading…
Reference in New Issue
Block a user