Add dockerimage for building windows version

This commit is contained in:
Maschell 2020-08-30 16:56:03 +02:00
parent 8e20d3e900
commit ff77bacdab
4 changed files with 61 additions and 19 deletions

1
.gitignore vendored
View File

@ -5,3 +5,4 @@ cmake/
*.elf
*.rpx
*.exe
build-pc-win/

22
Dockerfile.pc-win Normal file
View File

@ -0,0 +1,22 @@
FROM dockcross/windows-shared-x64:latest
RUN apt-get update && apt-get install -y gnupg
#Use http://mirror.mxe.cc/
#First add the repository and install the static gcc compiler. This ensures that everything basic is setup.
RUN echo "deb http://pkg.mxe.cc/repos/apt xenial main" > \
/etc/apt/sources.list.d/mxeapt.list && \
apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 86B72ED9 && \
apt-get update && \
apt-get install -y mxe-i686-w64-mingw32.static-gcc \
nsis \
zip \
libtool
RUN apt-get update && wget -O - http://mirror.mxe.cc/repos/apt/dists/stretch/main/binary-amd64/Packages | grep Package | grep shared | grep sdl2 | awk '{print $2}' | xargs apt-get install -y
ENV MINGW64_PREFIX=/usr/src/mxe/usr/bin/x86_64-w64-mingw32.shared-
ENV CONFIG_PREFIX=/usr/lib/mxe/usr/bin/x86_64-w64-mingw32.shared-
ENV EXTRA_CFLAGS=-I/usr/lib/mxe/usr/x86_64-w64-mingw32.shared/include
ENV EXTRA_LDFLAGS=-L/usr/lib/mxe/usr/x86_64-w64-mingw32.shared/lib
WORKDIR /project

View File

@ -2,13 +2,21 @@
.SUFFIXES:
#-------------------------------------------------------------------------------
ifeq ($(strip $(DEVKITPRO)),)
$(error "Please set DEVKITPRO in your environment. export DEVKITPRO=<path to>/devkitpro")
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
PREFIX := $(MINGW64_PREFIX)
ifeq ($(strip $(CONFIG_PREFIX)),)
PKG-CONFIG := $(PREFIX)pkg-config
else
PKG-CONFIG := $(CONFIG_PREFIX)pkg-config
endif
CXX := $(DEVKITPRO)/msys2/mingw64/bin/g++
C := $(DEVKITPRO)/msys2/mingw64/bin/gcc
PREFIX := $(DEVKITPRO)/msys2/mingw64/bin/
#-------------------------------------------------------------------------------
# TARGET is the name of the output
@ -18,34 +26,42 @@ PREFIX := $(DEVKITPRO)/msys2/mingw64/bin/
# INCLUDES is a list of directories containing header files
#-------------------------------------------------------------------------------
TARGET := SDL2_Playground
BUILD := build
BUILD := build-pc-win
SOURCES := src \
src/gui
DATA := data
INCLUDES := source
#-------------------------------------------------------------------------------
# options for code generation
#-------------------------------------------------------------------------------
+CFLAGS := -g -Wall -O2 -ffunction-sections `$(PREFIX)pkg-config --cflags SDL2_mixer SDL2_ttf SDL2_image` \
CFLAGS := -g -Wall -O2 -ffunction-sections `$(PKG-CONFIG) --cflags SDL2_mixer SDL2_ttf SDL2_image` \
$(MACHDEP)
CFLAGS += $(INCLUDE)
CXXFLAGS := $(CFLAGS) -std=c++20
ifeq ($(strip $(EXTRA_CFLAGS)),)
else
CFLAGS += $(EXTRA_CFLAGS)
endif
CXXFLAGS := $(CFLAGS) -std=c++17
ASFLAGS := -g $(ARCH)
LDFLAGS = -g $(ARCH)
LIBS := `$(PREFIX)pkg-config --libs SDL2_mixer SDL2_ttf SDL2_image`
LIBS := `$(PKG-CONFIG) --libs SDL2_mixer SDL2_ttf SDL2_image`
ifeq ($(strip $(EXTRA_LDFLAGS)),)
else
LDFLAGS += $(EXTRA_LDFLAGS)
endif
#-------------------------------------------------------------------------------
# list of directories containing libraries, this must be the top level
# containing include and lib
#-------------------------------------------------------------------------------
LIBDIRS := $(PORTLIBS)
LIBDIRS :=
#-------------------------------------------------------------------------------
# no real need to edit anything past this point unless you need to add additional
@ -104,7 +120,7 @@ $(BUILD):
#-------------------------------------------------------------------------------
clean:
@echo clean ...
@rm -fr $(BUILD) $(TARGET).rpx $(TARGET).elf
@rm -fr $(BUILD) $(TARGET).exe
#-------------------------------------------------------------------------------
else
@ -129,10 +145,6 @@ $(OUTPUT).exe:
@echo "$(notdir $<)"
@$(CXX) -MMD -MP -MF $(DEPSDIR)/$*.d $(CXXFLAGS) -c $< -o $@ $(ERROR_FILTER)
clean:
rm -f $(OBJS) $(OBJ_NAME) $(MINIZIP_O)
-include $(DEPENDS)
#-------------------------------------------------------------------------------

View File

@ -17,6 +17,13 @@ pacman -S git mingw-w64-x86_64-toolchain mingw64/mingw-w64-x86_64-SDL2 mingw64/m
make -f .\Makefile.pc-win
```
## Windows with docker
```
docker build . -f .\Dockerfile.pc-win -t sdl2_playground-builder-pc-win
docker run -it --rm -v ${PWD}:/project sdl2_playground-builder-pc-win make -f .\Makefile.pc-win -j16
```
## Wii U
And these from [dkp-libs](https://devkitpro.org/wiki/devkitPro_pacman):