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
*.exe
build-pc-win/
data/images/button.png.h
data/images/button.png.o
src/resources/filelist.h

View File

@ -1,14 +1,14 @@
#-------------------------------------------------------------------------------
.SUFFIXES:
#-------------------------------------------------------------------------------
ifeq ($(strip $(MINGW64_PREFIX)),)
$(error "Please set MINGW64_PREFIX in your environment. export MINGW64_PREFIX=<path to>/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 $(<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)
#-------------------------------------------------------------------------------

View File

@ -44,7 +44,7 @@ cat <<EOF > $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

View File

@ -1,16 +1,15 @@
#include <malloc.h>
#include <cstring>
#include <cstdio>
#include <unistd.h>
#include <fcntl.h>
#include "FSUtils.h"
#include "CFile.hpp"
#include <sys/stat.h>
#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;

View File

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

View File

@ -15,8 +15,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
****************************************************************************/
#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();

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