windows cross-compile

This commit is contained in:
Christopher A. Mosher 2019-04-11 16:14:55 -04:00
parent 979f32a524
commit a8183d7959
3 changed files with 33 additions and 17 deletions

View File

@ -26,25 +26,20 @@ matrix:
script:
- ./configure && make
- zip -j $NAME-$TRAVIS_OS_NAME src/$NAME
- os: windows
- os: linux # cross compile to windows
dist: xenial
sudo: required
before_install:
- curl -LO https://www.libsdl.org/release/SDL2-devel-2.0.9-VC.zip
- curl -LO https://www.floodgap.com/retrotech/xa/dists/xa-2.3.9.tar.gz
- curl -LO https://osdn.net/dl/mingw/mingw-get-0.6.3-mingw32-pre-20170905-1-bin.zip
- sudo apt-get -qq update
install:
- choco install make
- 7z x SDL2-devel-2.0.9-VC.zip
- 7z x xa-2.3.9.tar.gz
- 7z x xa-2.3.9.tar
- echo $PATH
- ls -l '/c/ProgramData/chocolatey/lib/mingw/tools/install/mingw64/bin'
# - mkdir mingw-get && cd mingw-get && 7z x ../mingw-get-0.6.3-mingw32-pre-20170905-1-bin.zip && cd ..
# - mingw-get/bin/mingw-get install autotools
before_script:
- ./bootstrap
- sudo apt-get install -y build-essential mingw-w64 xa65
- curl -L https://www.libsdl.org/release/SDL2-devel-2.0.9-mingw.tar.gz >SDL2.tar.gz
- tar xzf SDL2.tar.gz
- cd SDL2-* && sudo make cross CROSS_PATH=/usr ARCHITECTURES=x86_64-w64-mingw32 && cd -
script:
- ./configure && make
- zip -j $NAME-$TRAVIS_OS_NAME src/$NAME
- cd src && make -f Makefile.wingw
- mkdir epple2 && cp ../epple2.exe /usr/x86_64-w64-mingw32/bin/SDL2.dll ./epple2
- zip -j $NAME-windows epple2
deploy:
provider: releases

View File

@ -52,7 +52,7 @@ AC_ARG_VAR([MD5SUM],[path to md5sum])
# Checks for libraries.
AC_CHECK_LIB([SDL2],[SDL_Init],,[AC_MSG_ERROR([cannot find libsdl])])
AC_CHECK_LIB([SDL2],[SDL_Init],,[AC_MSG_ERROR([cannot find libSDL2])])

21
src/Makefile.mingw Normal file
View File

@ -0,0 +1,21 @@
TARGET=epple2.exe
SDL_ROOT_DIR=/usr/x86_64-w64-mingw32/bin
CXX=/usr/bin/x86_64-w64-mingw32-g++
SDL2_CFLAGS=`$(SDL_ROOT_DIR)/sdl2-config --cflags`
CXXFLAGS=-std=c++11 -static-libgcc -static-libstdc++ $(SDL2_CFLAGS) -DETCDIR=\"./\"
LD=/usr/bin/x86_64-w64-mingw32-g++
SDL2_LDFLAGS=`$(SDL_ROOT_DIR)/sdl2-config --libs`
LDFLAGS=$(SDL2_LDFLAGS) -lole32 -static-libgcc -static-libstdc++
SRCS=$(notdir $(wildcard *.cpp))
INCS=$(notdir $(wildcard *.h))
OBJS=$(SRCS:.cpp=.o)
.PHONY: all
all: $(TARGET)
$(TARGET): $(OBJS)
$(LD) $^ -o $@ $(LDFLAGS)