From 8f5dcdfd35be9a2e2bb48979a05ad44145ea6938 Mon Sep 17 00:00:00 2001 From: Maschell Date: Fri, 4 Sep 2020 20:20:48 +0200 Subject: [PATCH] Fix windows makefile/docker building, break cmake =( --- .gitignore | 3 +++ Makefile.pc-win | 52 +++++++++++++++++++++++++++++++++++----- filelist.sh | 18 +------------- src/fs/FSUtils.cpp | 5 ++-- src/gui/GuiElement.h | 4 ++++ src/gui/GuiFrame.cpp | 3 --- src/resources/filelist.h | 40 ------------------------------- 7 files changed, 56 insertions(+), 69 deletions(-) delete mode 100644 src/resources/filelist.h diff --git a/.gitignore b/.gitignore index 7721c3d..5757349 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,6 @@ cmake/ *.rpx *.exe build-pc-win/ +data/images/button.png.h +data/images/button.png.o +src/resources/filelist.h diff --git a/Makefile.pc-win b/Makefile.pc-win index 64944a1..6c5735b 100644 --- a/Makefile.pc-win +++ b/Makefile.pc-win @@ -1,14 +1,14 @@ #------------------------------------------------------------------------------- .SUFFIXES: #------------------------------------------------------------------------------- - ifeq ($(strip $(MINGW64_PREFIX)),) $(error "Please set MINGW64_PREFIX in your environment. export MINGW64_PREFIX=/mingw64/bin/") endif - CXX := $(MINGW64_PREFIX)g++ C := $(MINGW64_PREFIX)gcc +OBJCOPY := $(MINGW64_PREFIX)objcopy +LD := $(MINGW64_PREFIX)ld PREFIX := $(MINGW64_PREFIX) ifeq ($(strip $(CONFIG_PREFIX)),) @@ -17,7 +17,6 @@ else PKG-CONFIG := $(CONFIG_PREFIX)pkg-config endif - #------------------------------------------------------------------------------- # TARGET is the name of the output # BUILD is the directory where object files & intermediate files will be placed @@ -29,14 +28,20 @@ TARGET := SDL2_Playground BUILD := build-pc-win SOURCES := src \ src/gui \ + src/fs \ src/input \ src/menu \ + src/resources \ src/system \ src/system/video \ src/utils -DATA := data +DATA := data \ + data/images \ + data/sounds \ + data/fonts INCLUDES := source + #------------------------------------------------------------------------------- # options for code generation #------------------------------------------------------------------------------- @@ -57,7 +62,8 @@ ASFLAGS := -g $(ARCH) LDFLAGS = -g $(ARCH) LIBS := `$(PKG-CONFIG) --libs SDL2_mixer SDL2_ttf SDL2_image` - ifeq ($(strip $(EXTRA_LDFLAGS)),) + +ifeq ($(strip $(EXTRA_LDFLAGS)),) else LDFLAGS += $(EXTRA_LDFLAGS) endif @@ -83,6 +89,7 @@ export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \ export DEPSDIR := $(CURDIR)/$(BUILD) +FILELIST := $(shell bash ./filelist.sh) CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) @@ -105,7 +112,6 @@ endif export OFILES_BIN := $(addsuffix .o,$(BINFILES)) export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) export OFILES := $(OFILES_BIN) $(OFILES_SRC) -export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(BINFILES))) export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ $(foreach dir,$(LIBDIRS),-I$(dir)/include) \ @@ -140,6 +146,7 @@ DEPENDS := $(OFILES:.o=.d) all : $(OUTPUT).exe $(OUTPUT).exe : $(OFILES) + $(OFILES_SRC) : $(HFILES_BIN) $(OUTPUT).exe: @@ -150,6 +157,39 @@ $(OUTPUT).exe: @echo "$(notdir $<)" @$(CXX) -MMD -MP -MF $(DEPSDIR)/$*.d $(CXXFLAGS) -c $< -o $@ $(ERROR_FILTER) +%.png.o %.png.h : %.png + @echo $(notdir $<) + @$(bin2o) + +%.jpg.o %.jpg.h : %.jpg + @echo $(notdir $<) + @$(bin2o) + +%.ogg.o %.ogg.h : %.ogg + @echo $(notdir $<) + @$(bin2o) + +%.mp3.o %.mp3.h : %.mp3 + @echo $(notdir $<) + @$(bin2o) + +%.ttf.o %.ttf.h : %.ttf + @echo $(notdir $<) + @$(bin2o) + +define bin2o + @$(LD) -r -b binary $< -o $( \n\ +#include \n\ +\n\ +extern const uint8_t `(echo $( `(echo $( $outFile #include "Resources.h" -#ifdef __WIIU__ + EOF for i in ${files[@]} @@ -69,22 +69,6 @@ done echo -e '\t{NULL, NULL, 0, NULL, 0}' >> $outFile echo '};' >> $outFile echo '' >> $outFile -echo '#else' >> $outFile - -echo 'static RecourceFile RecourceList[] =' >> $outFile -echo '{' >> $outFile - -for i in ${files[@]} -do - filename=${i%.*} - extension=${i##*.} - echo -e '\t{"'$i'", NULL, NULL, NULL, 0},' >> $outFile -done - -echo -e '\t{NULL, NULL, 0, NULL, 0}' >> $outFile -echo '};' >> $outFile -echo '' >> $outFile -echo '#endif' >> $outFile echo '#endif' >> $outFile diff --git a/src/fs/FSUtils.cpp b/src/fs/FSUtils.cpp index abca9d8..ba4291e 100644 --- a/src/fs/FSUtils.cpp +++ b/src/fs/FSUtils.cpp @@ -1,16 +1,15 @@ #include -#include #include -#include #include #include "FSUtils.h" #include "CFile.hpp" +#include + #ifdef WIN32 #include "../utils/dirent.h" #endif - int32_t FSUtils::LoadFileToMem(const char *filepath, uint8_t **inbuffer, uint32_t *size) { //! always initialze input *inbuffer = nullptr; diff --git a/src/gui/GuiElement.h b/src/gui/GuiElement.h index e2d3df5..f331c2b 100644 --- a/src/gui/GuiElement.h +++ b/src/gui/GuiElement.h @@ -30,6 +30,10 @@ #include "sigslot.h" #include "../system/video/Renderer.h" +#ifndef M_PI +#define M_PI 3.14159265358979323846 +#endif + enum { EFFECT_NONE = 0x00, EFFECT_SLIDE_TOP = 0x01, diff --git a/src/gui/GuiFrame.cpp b/src/gui/GuiFrame.cpp index a87b6d2..accde1b 100644 --- a/src/gui/GuiFrame.cpp +++ b/src/gui/GuiFrame.cpp @@ -15,8 +15,6 @@ * along with this program. If not, see . ****************************************************************************/ #include "GuiFrame.h" -#include "../system/video/Renderer.h" -#include "../utils/logger.h" GuiFrame::GuiFrame(GuiFrame *p) { parent = p; @@ -52,7 +50,6 @@ void GuiFrame::append(GuiElement *e) { if (e == nullptr) { return; } - DEBUG_FUNCTION_LINE("append %08X", e); remove(e); mutex.lock(); diff --git a/src/resources/filelist.h b/src/resources/filelist.h deleted file mode 100644 index 8228d6a..0000000 --- a/src/resources/filelist.h +++ /dev/null @@ -1,40 +0,0 @@ -/**************************************************************************** - * Resource files. - * This file is generated automatically. - * Includes 4 files. - * - * NOTE: - * Any manual modification of this file will be overwriten by the generation. - ****************************************************************************/ -#ifndef _FILELIST_H_ -#define _FILELIST_H_ - - -#include "Resources.h" -#ifdef __WIIU__ -#include "bgMusic_ogg.h" -#include "button_png.h" -#include "button_click_mp3.h" -#include "FreeSans_ttf.h" - -static RecourceFile RecourceList[] = -{ - {"bgMusic.ogg", bgMusic_ogg, bgMusic_ogg_size, NULL, 0}, - {"button.png", button_png, button_png_size, NULL, 0}, - {"button_click.mp3", button_click_mp3, button_click_mp3_size, NULL, 0}, - {"FreeSans.ttf", FreeSans_ttf, FreeSans_ttf_size, NULL, 0}, - {NULL, NULL, 0, NULL, 0} -}; - -#else -static RecourceFile RecourceList[] = -{ - {"bgMusic.ogg", NULL, 0, NULL, 0}, - {"button.png", NULL, 0, NULL, 0}, - {"button_click.mp3", nullptr, 0, NULL, 0}, - {"FreeSans.ttf", NULL, 0, NULL, 0}, - {NULL, NULL, 0, NULL, 0} -}; - -#endif -#endif