Skip to content

Commit

Permalink
Enable continuous integration through Travis-CI (#210)
Browse files Browse the repository at this point in the history
  • Loading branch information
Jamiras authored Jul 4, 2020
1 parent c257f5b commit 4950ddb
Show file tree
Hide file tree
Showing 23 changed files with 274 additions and 611 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*.suo
*.user
*.o
*.res
*.swp
*.log
*.pdb
Expand Down
41 changes: 41 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Control file for continuous integration testing at http://travis-ci.org/

# ignore release tags
branches:
except:
/^\d+\.\d+(\.\d+)?(-\S*)?$/

language: c++


jobs:
include:
- name: "RALibretro Win32"
os: windows
script: etc/msbuild.bat Release x86

- name: "RALibretro Win64"
os: windows
script: etc/msbuild.bat Release x64

- name: "RALibretro Win32 cross-compile (Linux)"
os: linux
compiler: i686-w64-mingw32-gcc
script: make ARCH=x86

- name: "RALibretro Win64 cross-compile (Linux)"
os: linux
compiler: x86_64-w64-mingw32
script: make ARCH=x64

- name: "RAHasher x86 Linux"
os: linux
addons:
apt:
packages:
g++-multilib # fatal error: bits/c++config.h: No such file or directory
script: make ARCH=x86 -f Makefile.RAHasher

- name: "RAHasher x64 Linux"
os: linux
script: make ARCH=x64 -f Makefile.RAHasher
84 changes: 50 additions & 34 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,48 +1,58 @@
# IMPORTANT NOTE FOR CROSS-COMPILING:
# you need to change your PATH to invoke the mingw-32bit flavor of sdl2-config
# supported parameters
# ARCH architecture - "x86" or "x64" [detected if not set]
# DEBUG if set to anything, builds with DEBUG symbols

include Makefile.common

# Toolset setup
ifeq ($(OS),Windows_NT)
CC=gcc
CXX=g++
RC=windres

ifeq ($(findstring MINGW64, $(shell uname)), MINGW64)
ARCH=-m64
OUTDIR=bin64
else
ARCH=-m32
OUTDIR=bin
endif
CC=gcc
CXX=g++
RC=windres

ifeq ($(ARCH), x86)
MINGWLIBDIR=/mingw32/bin
else
MINGWLIBDIR=/mingw64/bin
endif

else ifeq ($(shell uname -s),Linux)
CC=i686-w64-mingw32-gcc
CXX=i686-w64-mingw32-g++
RC=i686-w64-mingw32-windres
STATICLIBS=-static-libstdc++

#TODO: determine ARCH
ARCH=-m32
OUTDIR=bin
MINGW=x86_64-w64-mingw32
ifeq ($(ARCH), x86)
MINGW=i686-w64-mingw32
endif

CC=$(MINGW)-gcc
CXX=$(MINGW)-g++
RC=$(MINGW)-windres

MINGWLIBDIR=/usr/$(MINGW)/lib
endif

INCLUDES=-Isrc -I./src/RAInterface -I./src/miniz -I./src/rcheevos/include
# compile flags
INCLUDES += -I./src/RAInterface -I./src/SDL2/include
DEFINES=-DOUTSIDE_SPEEX -DRANDOM_PREFIX=speex -DEXPORT= -D_USE_SSE2 -DFIXED_POINT -D_WINDOWS
CCFLAGS=-Wall $(ARCH) $(INCLUDES) $(DEFINES) `sdl2-config --cflags`
CXXFLAGS=$(CCFLAGS) -std=c++11
LDFLAGS=$(ARCH)
CFLAGS += $(DEFINES)
CXXFLAGS += $(DEFINES)

ifeq ($(ARCH), x86)
SDLLIBDIR=src/SDL2/lib/x86
else
SDLLIBDIR=src/SDL2/lib/x64
endif

ifneq ($(DEBUG),)
CFLAGS += -O0 -g -DDEBUG_FSM -DLOG_TO_FILE
CXXFLAGS += -O0 -g -DDEBUG_FSM -DLOG_TO_FILE
CFLAGS += -DDEBUG_FSM -DLOG_TO_FILE
CXXFLAGS += -DDEBUG_FSM -DLOG_TO_FILE
else
CFLAGS += -O3 -DNDEBUG -DLOG_TO_FILE
CXXFLAGS += -O3 -DNDEBUG -DLOG_TO_FILE
CFLAGS += -DLOG_TO_FILE
CXXFLAGS += -DLOG_TO_FILE
endif

LDFLAGS += -mwindows -lmingw32 -lopengl32 -lwinhttp -lgdi32 -limm32 -lcomdlg32
LDFLAGS += -L${SDLLIBDIR} -lSDL2main -lSDL2

# main
LIBS=`sdl2-config --static-libs` $(STATICLIBS) -lopengl32 -lwinhttp
OBJS=\
src/dynlib/dynlib.o \
src/jsonsax/jsonsax.o \
Expand Down Expand Up @@ -86,16 +96,22 @@ OBJS=\
$(CXX) $(CXXFLAGS) -c $< -o $@

%.o: %.c
$(CC) $(CCFLAGS) -c $< -o $@
$(CC) $(CFLAGS) -c $< -o $@

%.res: %.rc
$(RC) $< -O coff -o $@

all: $(OUTDIR)/RALibretro.exe
all: $(OUTDIR)/RALibretro.exe $(OUTDIR)/SDL2.dll $(OUTDIR)/libwinpthread-1.dll

$(OUTDIR)/SDL2.dll: $(SDLLIBDIR)/SDL2.dll
cp -f $< $@

$(OUTDIR)/libwinpthread-1.dll: $(MINGWLIBDIR)/libwinpthread-1.dll
cp -f $< $@

$(OUTDIR)/RALibretro.exe: $(OBJS)
mkdir -p $(OUTDIR)
$(CXX) $(LDFLAGS) -o $@ $+ $(LIBS)
$(CXX) -o $@ $+ $(LDFLAGS)

src/Git.cpp: etc/Git.cpp.template FORCE
cat $< | sed s/GITFULLHASH/`git rev-parse HEAD | tr -d "\n"`/g | sed s/GITMINIHASH/`git rev-parse HEAD | tr -d "\n" | cut -c 1-7`/g | sed s/GITRELEASE/`git describe --tags | sed s/\-.*//g | tr -d "\n"`/g > $@
Expand All @@ -105,7 +121,7 @@ zip:
zip -9 RALibretro-`git describe | tr -d "\n"`.zip $(OUTDIR)/RALibretro.exe

clean:
rm -f $(OUTDIR)/RALibretro $(OBJS) $(OUTDIR)/RALibretro-*.zip RALibretro-*.zip
rm -f $(OUTDIR)/RALibretro.exe $(OBJS) $(OUTDIR)/RALibretro-*.zip RALibretro-*.zip

pack:
ifeq ("", "$(wildcard $(OUTDIR)/RALibretro.exe)")
Expand Down
39 changes: 16 additions & 23 deletions Makefile.RAHasher
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
# supported parameters
# ARCH architecture - "x86" or "x64" [detected if not set]
# DEBUG if set to anything, builds with DEBUG symbols

include Makefile.common

# Toolset setup
CC=gcc
CXX=g++

ifeq ($(OS),Windows_NT)
EXE=.exe
EXE=.exe
endif

INCLUDES=-I./src -I./src/RAInterface -I./src/miniz -I./src/rcheevos/include
# compile flags
DEFINES=-D_CONSOLE
CCFLAGS=-Wall -m32 $(INCLUDES) $(DEFINES)
CXXFLAGS=$(CCFLAGS) -std=c++11
LDFLAGS=-m32


ifneq ($(DEBUG),)
CFLAGS += -O0 -g
CXXFLAGS += -O0 -g
else
CFLAGS += -O3
CXXFLAGS += -O3
endif
CFLAGS += $(DEFINES)
CXXFLAGS += $(DEFINES)

# main
LIBS=
Expand All @@ -40,21 +36,18 @@ OBJS=\
$(CXX) $(CXXFLAGS) -c $< -o $@

%.o: %.c
$(CC) $(CCFLAGS) -c $< -o $@

%.res: %.rc
$(RC) $< -O coff -o $@
$(CC) $(CFLAGS) -c $< -o $@

all: bin/RAHasher$(EXE)
all: $(OUTDIR)/RAHasher$(EXE)

bin/RAHasher$(EXE): $(OBJS)
mkdir -p bin
$(CXX) $(LDFLAGS) -o $@ $+ $(LIBS)
$(OUTDIR)/RAHasher$(EXE): $(OBJS)
mkdir -p $(OUTDIR)
$(CXX) -o $@ $+ $(LDFLAGS)

src/Git.cpp: etc/Git.cpp.template FORCE
cat $< | sed s/GITFULLHASH/`git rev-parse HEAD | tr -d "\n"`/g | sed s/GITMINIHASH/`git rev-parse HEAD | tr -d "\n" | cut -c 1-7`/g | sed s/GITRELEASE/`git describe --tags | sed s/\-.*//g | tr -d "\n"`/g > $@

clean:
rm -f bin/RAHasher$(EXE) $(OBJS)
rm -f $(OUTDIR)/RAHasher$(EXE) $(OBJS)

.PHONY: clean FORCE
43 changes: 43 additions & 0 deletions Makefile.common
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# default parameter values
ifeq ($(ARCH),)
UNAME := $(shell uname -s)
ifeq ($(findstring MINGW64, $(UNAME)), MINGW64)
ARCH=x64
else ifeq ($(findstring MINGW32, $(UNAME)), MINGW32)
ARCH=x86
else
UNAME := $(shell uname -m)
ifeq ($(UNAME), x86_64)
ARCH=x64
else
ARCH=x86
endif
endif
endif

INCLUDES=-Isrc -I./src/miniz -I./src/rcheevos/include
CFLAGS=-Wall $(INCLUDES)
CXXFLAGS=$(CFLAGS) -std=c++11
LDFLAGS=-static-libgcc -static-libstdc++

ifeq ($(ARCH), x86)
CFLAGS += -m32
CXXFLAGS += -m32
LDFLAGS += -m32
OUTDIR=bin
else ifeq ($(ARCH), x64)
CFLAGS += -m64
CXXFLAGS += -m64
LDFLAGS += -m64
OUTDIR=bin64
else
$(error unknown ARCH "$(ARCH)")
endif

ifneq ($(DEBUG),)
CFLAGS += -O0 -g
CXXFLAGS += -O0 -g
else
CFLAGS += -O3 -DNDEBUG
CXXFLAGS += -O3 -DNDEBUG
endif
67 changes: 0 additions & 67 deletions Makefile.linux

This file was deleted.

Binary file removed bin/libgcc_s_dw2-1.dll
Binary file not shown.
Binary file removed bin/libgcc_s_sjlj-1.dll
Binary file not shown.
Binary file removed bin/libstdc++-6.dll
Binary file not shown.
Binary file removed bin/libwinpthread-1.dll
Binary file not shown.
Binary file removed bin64/libstdc++-6.dll
Binary file not shown.
Binary file removed bin64/libwinpthread-1.dll
Binary file not shown.
2 changes: 2 additions & 0 deletions etc/MakeGitCpp.bat
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ for /f "tokens=1* delims=]" %%a in ('type "%TEMPLATE%" ^| find /V /N ""') do (
)
)

if not exist Git.cpp copy %TEMPLATE% Git.cpp

if not exist ..\src\Git.cpp goto nonexistant
fc ..\src\Git.cpp Git.cpp > nul
if errorlevel 1 goto different
Expand Down
Loading

0 comments on commit 4950ddb

Please sign in to comment.