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
|
OUTPUTFLAG = -o
|
||||||
endif
|
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}
|
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}
|
EDITOR_OBJECTS = editor.${OBJEXT} editor_blocks.${OBJEXT} edit_box.${OBJEXT} tool_box.${OBJEXT} editor_visitor.${OBJEXT} ${COMMON_OBJECTS}
|
||||||
|
|
||||||
ifeq ($(UNAME_S),Windows)
|
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
|
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
|
endif
|
||||||
|
|
||||||
.PHONY: default
|
.PHONY: default
|
||||||
@ -31,9 +36,9 @@ default: mario
|
|||||||
|
|
||||||
ifeq ($(UNAME_S),Windows)
|
ifeq ($(UNAME_S),Windows)
|
||||||
mario: ${MARIO_OBJECTS} ${SDLLIB}
|
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}
|
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
|
else
|
||||||
mario: ${MARIO_OBJECTS}
|
mario: ${MARIO_OBJECTS}
|
||||||
@ -71,10 +76,16 @@ libsdlpp.a: ../sdlpp
|
|||||||
$(MAKE) libsdlpp.a -C ../sdlpp
|
$(MAKE) libsdlpp.a -C ../sdlpp
|
||||||
cp ../sdlpp/libsdlpp.a .
|
cp ../sdlpp/libsdlpp.a .
|
||||||
|
|
||||||
windows_release: ../Release/Tetris
|
libsdlpp.dll:
|
||||||
cp mario.exe testfont.ttf block.png ../Release/Tetris
|
$(MAKE) clean -C ../sdlpp
|
||||||
rm ../Release/Tetris.zip
|
$(MAKE) -C ../sdlpp
|
||||||
cd ../Release && zip -r Tetris.zip Tetris
|
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:
|
start:
|
||||||
LD_LIBRARY_PATH=$$(pwd) ./mario
|
LD_LIBRARY_PATH=$$(pwd) ./mario
|
||||||
@ -82,4 +93,4 @@ start_edit:
|
|||||||
LD_LIBRARY_PATH=$$(pwd) ./editor
|
LD_LIBRARY_PATH=$$(pwd) ./editor
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -Rf *.${OBJEXT} mario editor *.a
|
${RM} *.dll *.lib *.a *.${OBJEXT} mario editor
|
||||||
|
@ -1,7 +1,11 @@
|
|||||||
#ifndef SPRITES_H
|
#ifndef SPRITES_H
|
||||||
#define SPRITES_H
|
#define SPRITES_H
|
||||||
|
|
||||||
|
#ifndef _WIN32
|
||||||
#include <SDL2/SDL_rect.h>
|
#include <SDL2/SDL_rect.h>
|
||||||
|
#else
|
||||||
|
#include "../sdlpp/SDL2/SDL_rect.h"
|
||||||
|
#endif
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include "../sdlpp/sdlpp_vector.hpp"
|
#include "../sdlpp/sdlpp_vector.hpp"
|
||||||
|
@ -16,16 +16,13 @@ OBJEXT = o
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(UNAME_S),Linux)
|
ifeq ($(UNAME_S),Linux)
|
||||||
SDLPPLIBRARY = libsdlpp.so.${MAJOR}.${MINOR}.${RELEASE}
|
SDLPPLIBRARY = libsdlpp.a
|
||||||
LIBRARYFLAGS = -fPIC
|
|
||||||
endif
|
endif
|
||||||
ifeq ($(UNAME_S),Darwin)
|
ifeq ($(UNAME_S),Darwin)
|
||||||
SDLPPLIBRARY = libsdlpp.dylib
|
SDLPPLIBRARY = libsdlpp.a
|
||||||
LIBRARYFLAGS =
|
|
||||||
endif
|
endif
|
||||||
ifeq ($(UNAME_S),Windows)
|
ifeq ($(UNAME_S),Windows)
|
||||||
SDLPPLIBRARY = libsdlpp.dll
|
SDLPPLIBRARY = libsdlpp.dll
|
||||||
LIBRARYFLAGS =
|
|
||||||
endif
|
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}
|
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)
|
ifeq ($(UNAME_S),Windows)
|
||||||
%.${OBJEXT}: %.cpp
|
%.${OBJEXT}: %.cpp
|
||||||
${CXX} ${CXXFLAGS} ${LIBRARYFLAGS} /c $< /Fo"$@"
|
${CXX} ${CXXFLAGS} /c $< /Fo"$@"
|
||||||
else
|
else
|
||||||
%.${OBJEXT}: %.cpp
|
%.${OBJEXT}: %.cpp
|
||||||
${CXX} ${CXXFLAGS} ${LIBRARYFLAGS} -c $< -o $@
|
${CXX} ${CXXFLAGS} -c $< -o $@
|
||||||
endif
|
endif
|
||||||
|
|
||||||
ifeq ($(UNAME_S),Linux)
|
ifeq ($(UNAME_S),Linux)
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
#include "sdlpp_renderobject.hpp"
|
#include "sdlpp_renderobject.hpp"
|
||||||
#include <SDL2/SDL_render.h>
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
namespace SDLPP {
|
namespace SDLPP {
|
||||||
|
@ -8,9 +8,13 @@
|
|||||||
#include "sdlpp_vector.hpp"
|
#include "sdlpp_vector.hpp"
|
||||||
#include "sdlpp_visitor.hpp"
|
#include "sdlpp_visitor.hpp"
|
||||||
|
|
||||||
#include <SDL2/SDL_render.h>
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#ifndef _WIN32
|
||||||
|
#include <SDL2/SDL_render.h>
|
||||||
|
#else
|
||||||
|
#include "SDL2/SDL_render.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace SDLPP {
|
namespace SDLPP {
|
||||||
|
|
||||||
|
@ -4,8 +4,13 @@
|
|||||||
#include "global_vars.hpp"
|
#include "global_vars.hpp"
|
||||||
#include "../sdlpp/sdlpp_mouse.hpp"
|
#include "../sdlpp/sdlpp_mouse.hpp"
|
||||||
|
|
||||||
|
#ifndef _WIN32
|
||||||
#include <SDL2/SDL_events.h>
|
#include <SDL2/SDL_events.h>
|
||||||
#include <SDL2/SDL_mouse.h>
|
#include <SDL2/SDL_mouse.h>
|
||||||
|
#else
|
||||||
|
#include "../sdlpp/SDL2/SDL_events.h"
|
||||||
|
#include "../sdlpp/SDL2/SDL_mouse.h"
|
||||||
|
#endif
|
||||||
#include <thread>
|
#include <thread>
|
||||||
|
|
||||||
constexpr uint64_t MAIN_MENU_RESUME = 0;
|
constexpr uint64_t MAIN_MENU_RESUME = 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user