Fix windows makefile/docker building, break cmake =(

This commit is contained in:
Maschell 2020-09-04 20:20:48 +02:00
parent 158d97cf23
commit 8f5dcdfd35
7 changed files with 56 additions and 69 deletions

3
.gitignore vendored
View File

@ -6,3 +6,6 @@ cmake/
*.rpx *.rpx
*.exe *.exe
build-pc-win/ build-pc-win/
data/images/button.png.h
data/images/button.png.o
src/resources/filelist.h

View File

@ -1,14 +1,14 @@
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
.SUFFIXES: .SUFFIXES:
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
ifeq ($(strip $(MINGW64_PREFIX)),) ifeq ($(strip $(MINGW64_PREFIX)),)
$(error "Please set MINGW64_PREFIX in your environment. export MINGW64_PREFIX=<path to>/mingw64/bin/") $(error "Please set MINGW64_PREFIX in your environment. export MINGW64_PREFIX=<path to>/mingw64/bin/")
endif endif
CXX := $(MINGW64_PREFIX)g++ CXX := $(MINGW64_PREFIX)g++
C := $(MINGW64_PREFIX)gcc C := $(MINGW64_PREFIX)gcc
OBJCOPY := $(MINGW64_PREFIX)objcopy
LD := $(MINGW64_PREFIX)ld
PREFIX := $(MINGW64_PREFIX) PREFIX := $(MINGW64_PREFIX)
ifeq ($(strip $(CONFIG_PREFIX)),) ifeq ($(strip $(CONFIG_PREFIX)),)
@ -17,7 +17,6 @@ else
PKG-CONFIG := $(CONFIG_PREFIX)pkg-config PKG-CONFIG := $(CONFIG_PREFIX)pkg-config
endif endif
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# TARGET is the name of the output # TARGET is the name of the output
# BUILD is the directory where object files & intermediate files will be placed # BUILD is the directory where object files & intermediate files will be placed
@ -29,14 +28,20 @@ TARGET := SDL2_Playground
BUILD := build-pc-win BUILD := build-pc-win
SOURCES := src \ SOURCES := src \
src/gui \ src/gui \
src/fs \
src/input \ src/input \
src/menu \ src/menu \
src/resources \
src/system \ src/system \
src/system/video \ src/system/video \
src/utils src/utils
DATA := data DATA := data \
data/images \
data/sounds \
data/fonts
INCLUDES := source INCLUDES := source
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
# options for code generation # options for code generation
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------
@ -57,7 +62,8 @@ ASFLAGS := -g $(ARCH)
LDFLAGS = -g $(ARCH) LDFLAGS = -g $(ARCH)
LIBS := `$(PKG-CONFIG) --libs SDL2_mixer SDL2_ttf SDL2_image` LIBS := `$(PKG-CONFIG) --libs SDL2_mixer SDL2_ttf SDL2_image`
ifeq ($(strip $(EXTRA_LDFLAGS)),)
ifeq ($(strip $(EXTRA_LDFLAGS)),)
else else
LDFLAGS += $(EXTRA_LDFLAGS) LDFLAGS += $(EXTRA_LDFLAGS)
endif endif
@ -83,6 +89,7 @@ export VPATH := $(foreach dir,$(SOURCES),$(CURDIR)/$(dir)) \
export DEPSDIR := $(CURDIR)/$(BUILD) export DEPSDIR := $(CURDIR)/$(BUILD)
FILELIST := $(shell bash ./filelist.sh)
CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c))) CFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.c)))
CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp))) CPPFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.cpp)))
SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s))) SFILES := $(foreach dir,$(SOURCES),$(notdir $(wildcard $(dir)/*.s)))
@ -105,7 +112,6 @@ endif
export OFILES_BIN := $(addsuffix .o,$(BINFILES)) export OFILES_BIN := $(addsuffix .o,$(BINFILES))
export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o) export OFILES_SRC := $(CPPFILES:.cpp=.o) $(CFILES:.c=.o) $(SFILES:.s=.o)
export OFILES := $(OFILES_BIN) $(OFILES_SRC) export OFILES := $(OFILES_BIN) $(OFILES_SRC)
export HFILES_BIN := $(addsuffix .h,$(subst .,_,$(BINFILES)))
export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \ export INCLUDE := $(foreach dir,$(INCLUDES),-I$(CURDIR)/$(dir)) \
$(foreach dir,$(LIBDIRS),-I$(dir)/include) \ $(foreach dir,$(LIBDIRS),-I$(dir)/include) \
@ -140,6 +146,7 @@ DEPENDS := $(OFILES:.o=.d)
all : $(OUTPUT).exe all : $(OUTPUT).exe
$(OUTPUT).exe : $(OFILES) $(OUTPUT).exe : $(OFILES)
$(OFILES_SRC) : $(HFILES_BIN) $(OFILES_SRC) : $(HFILES_BIN)
$(OUTPUT).exe: $(OUTPUT).exe:
@ -150,6 +157,39 @@ $(OUTPUT).exe:
@echo "$(notdir $<)" @echo "$(notdir $<)"
@$(CXX) -MMD -MP -MF $(DEPSDIR)/$*.d $(CXXFLAGS) -c $< -o $@ $(ERROR_FILTER) @$(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 $(<F).o
@$(OBJCOPY) $(<F).o --redefine-sym _binary_`(echo $< | tr . _| tr / _)`_start=`(echo $(<F) | tr . _)`
@$(OBJCOPY) $(<F).o --redefine-sym _binary_`(echo $< | tr . _| tr / _)`_end=`(echo $(<F) | tr . _)`_end
echo "#pragma once \n\
#include <stddef.h> \n\
#include <stdint.h> \n\
\n\
extern const uint8_t `(echo $(<F) | tr . _)`[]; \n\
extern const uint8_t `(echo $(<F) | tr . _)`_end[]; \n\
static const size_t `(echo $(<F) | tr . _)`_size=`(stat -c %s $<)`;" > `(echo $(<F) | tr . _)`.h
endef
-include $(DEPENDS) -include $(DEPENDS)
#------------------------------------------------------------------------------- #-------------------------------------------------------------------------------

View File

@ -44,7 +44,7 @@ cat <<EOF > $outFile
#include "Resources.h" #include "Resources.h"
#ifdef __WIIU__
EOF EOF
for i in ${files[@]} for i in ${files[@]}
@ -69,22 +69,6 @@ done
echo -e '\t{NULL, NULL, 0, NULL, 0}' >> $outFile echo -e '\t{NULL, NULL, 0, NULL, 0}' >> $outFile
echo '};' >> $outFile echo '};' >> $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 echo '#endif' >> $outFile

View File

@ -1,16 +1,15 @@
#include <malloc.h> #include <malloc.h>
#include <cstring>
#include <cstdio> #include <cstdio>
#include <unistd.h>
#include <fcntl.h> #include <fcntl.h>
#include "FSUtils.h" #include "FSUtils.h"
#include "CFile.hpp" #include "CFile.hpp"
#include <sys/stat.h>
#ifdef WIN32 #ifdef WIN32
#include "../utils/dirent.h" #include "../utils/dirent.h"
#endif #endif
int32_t FSUtils::LoadFileToMem(const char *filepath, uint8_t **inbuffer, uint32_t *size) { int32_t FSUtils::LoadFileToMem(const char *filepath, uint8_t **inbuffer, uint32_t *size) {
//! always initialze input //! always initialze input
*inbuffer = nullptr; *inbuffer = nullptr;

View File

@ -30,6 +30,10 @@
#include "sigslot.h" #include "sigslot.h"
#include "../system/video/Renderer.h" #include "../system/video/Renderer.h"
#ifndef M_PI
#define M_PI 3.14159265358979323846
#endif
enum { enum {
EFFECT_NONE = 0x00, EFFECT_NONE = 0x00,
EFFECT_SLIDE_TOP = 0x01, EFFECT_SLIDE_TOP = 0x01,

View File

@ -15,8 +15,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. * along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/ ****************************************************************************/
#include "GuiFrame.h" #include "GuiFrame.h"
#include "../system/video/Renderer.h"
#include "../utils/logger.h"
GuiFrame::GuiFrame(GuiFrame *p) { GuiFrame::GuiFrame(GuiFrame *p) {
parent = p; parent = p;
@ -52,7 +50,6 @@ void GuiFrame::append(GuiElement *e) {
if (e == nullptr) { if (e == nullptr) {
return; return;
} }
DEBUG_FUNCTION_LINE("append %08X", e);
remove(e); remove(e);
mutex.lock(); mutex.lock();

View File

@ -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