Add travis and appveyor support

This commit is contained in:
Anonymous Maarten 2018-07-25 20:42:03 +02:00
parent b1c3c1dca8
commit 75dbb7e67e
5 changed files with 163 additions and 8 deletions

28
.appveyor.yml Normal file
View File

@ -0,0 +1,28 @@
image: Visual Studio 2017
configuration: Release
platform:
- win-amd64-null
- win-amd64-gl3
- win-amd64-d3d9
environment:
APPVEYOR_SAVE_CACHE_ON_ERROR: true
GLFW_BASE: glfw-3.2.1.bin.WIN64
GLFW_URL: https://github.com/glfw/glfw/releases/download/3.2.1/%GLFW_BASE%.zip
GLEW_BASE: glew-2.1.0
GLEW_URL: https://github.com/nigels-com/glew/releases/download/glew-2.1.0/%GLEW_BASE%-win32.zip
PREMAKE5_URL: https://github.com/premake/premake-core/releases/download/v5.0.0-alpha12/premake-5.0.0-alpha12-windows.zip
install:
- appveyor DownloadFile %GLFW_URL% -FileName "%APPVEYOR_BUILD_FOLDER%/%GLFW_BASE%.zip"
- 7z x "%APPVEYOR_BUILD_FOLDER%/%GLFW_BASE%.zip"
- appveyor DownloadFile %GLEW_URL% -FileName "%APPVEYOR_BUILD_FOLDER%/%GLEW_BASE%.zip"
- 7z x "%APPVEYOR_BUILD_FOLDER%/%GLEW_BASE%.zip"
- appveyor DownloadFile %PREMAKE5_URL% -FileName "%APPVEYOR_BUILD_FOLDER%/premake5.zip"
- mkdir "%APPVEYOR_BUILD_FOLDER%/bin" && cd "%APPVEYOR_BUILD_FOLDER%/bin" && 7z x "%APPVEYOR_BUILD_FOLDER%/premake5.zip"
- set PATH=%APPVEYOR_BUILD_FOLDER%/bin;%PATH%
before_build:
- mkdir "%APPVEYOR_BUILD_FOLDER%/build"
- cd "%APPVEYOR_BUILD_FOLDER%"
- premake5 vs2017 --glfwdir=%APPVEYOR_BUILD_FOLDER%/%GLFW_BASE% --glewdir=%APPVEYOR_BUILD_FOLDER%/%GLEW_BASE%
build:
project: c:\projects\librw\build\librw.sln
verbosity: minimal

33
.travis.yml Normal file
View File

@ -0,0 +1,33 @@
language: cpp
matrix:
include:
- os: linux
env: TARGET="release_linux-amd64-null"
script:
- mkdir -p "$TRAVIS_BUILD_DIR/build"
#- docker build -t librw "$TRAVIS_BUILD_DIR"
#- docker run -v "$TRAVIS_BUILD_DIR:/librw:rw,z" --name librw_instance -d librw sleep infinity
- docker pull librw/librw
- docker run -v "$TRAVIS_BUILD_DIR:/librw:rw,z" -v "$TRAVIS_BUILD_DIR/build:/build:rw,z" --name librw_instance -d librw/librw sleep infinity
- docker exec -u builder librw_instance /bin/bash -c "cd /librw && premake5 gmake && cd /librw/build && make config=$TARGET verbose=1"
- os: linux
env: TARGET="release_linux-amd64-gl3"
services: docker
script:
- mkdir -p "$TRAVIS_BUILD_DIR/build"
#- docker build -t librw "$TRAVIS_BUILD_DIR"
#- docker run -v "$TRAVIS_BUILD_DIR:/librw:rw,z" --name librw_instance -d librw sleep infinity
- docker pull librw/librw
- docker run -v "$TRAVIS_BUILD_DIR:/librw:rw,z" -v "$TRAVIS_BUILD_DIR/build:/build:rw,z" --name librw_instance -d librw/librw sleep infinity
- docker exec -u builder librw_instance /bin/bash -c "cd /librw && premake5 gmake && cd /librw/build && make config=$TARGET verbose=1"
- os: linux
env: TARGET="release_ps2"
services: docker
script:
- mkdir -p "$TRAVIS_BUILD_DIR/build"
#- docker build -t librw "$TRAVIS_BUILD_DIR"
#- docker run -v "$TRAVIS_BUILD_DIR:/librw:rw,z" --name librw_instance -d librw sleep infinity
- docker pull librw/librw
- docker run -v "$TRAVIS_BUILD_DIR:/librw:rw,z" -v "$TRAVIS_BUILD_DIR/build:/build:rw,z" --name librw_instance -d librw/librw sleep infinity
- docker exec -u builder librw_instance /bin/bash -c "cd /librw && premake5 gmake && cd /librw/build && make config=$TARGET verbose=1"

60
Dockerfile Normal file
View File

@ -0,0 +1,60 @@
FROM ubuntu:rolling
ENV PS2DEV /ps2dev
ENV PS2SDK $PS2DEV/ps2sdk
ENV PATH $PATH:$PS2DEV/bin:$PS2DEV/ee/bin:$PS2DEV/iop/bin:$PS2DEV/dvp/bin:$PS2SDK/bin
ENV DEBIAN_FRONTEND noninteractive
ENV TOOLCHAIN_GIT_URL git://github.com/ps2dev/ps2toolchain.git
ENV TOOLCHAIN_GIT_BRANCH master
ENV PREMAKE5_URL=https://github.com/premake/premake-core/releases/download/v5.0.0-alpha12/premake-5.0.0-alpha12-linux.tar.gz
RUN mkdir -p "$PS2DEV" "$PS2SDK" \
&& apt-get update \
&& apt-get upgrade -y \
&& apt-get install -y \
build-essential \
cmake \
autoconf \
bzip2 \
gcc \
git \
libucl-dev \
make \
patch \
vim \
wget \
zip \
zlib1g-dev \
libglew-dev \
libglfw3-dev \
&& git clone -b $TOOLCHAIN_GIT_BRANCH $TOOLCHAIN_GIT_URL /toolchain \
&& cd /toolchain \
&& ./toolchain.sh \
&& git clone git://github.com/ps2dev/ps2eth.git /ps2dev/ps2eth \
&& make -C /ps2dev/ps2eth \
&& git clone git://github.com/ps2dev/ps2-packer.git /ps2-packer \
&& make install -C /ps2-packer \
&& rm -rf \
/ps2-packer \
/ps2dev/ps2eth/.git \
/ps2dev/ps2sdk/test.tmp \
/ps2dev/test.tmp \
/toolchain \
&& rm -rf /var/lib/apt/lists/* \
&& wget "$PREMAKE5_URL" -O /tmp/premake5.tar.gz \
&& tar xf /tmp/premake5.tar.gz -C /usr/bin/ \
&& rm /tmp/premake5.tar.gz \
&& groupadd 1000 -g 1000 \
&& groupadd 1001 -g 1001 \
&& groupadd 2000 -g 2000 \
&& groupadd 999 -g 999 \
&& useradd -ms /bin/bash builder -g 1001 -G 1000,2000,999 \
&& printf "builder:builder" | chpasswd \
&& adduser builder sudo \
&& printf "builder ALL= NOPASSWD: ALL\\n" >> /etc/sudoers
USER builder
WORKDIR /home/builder

22
docker_rebuild_ps2.sh Executable file
View File

@ -0,0 +1,22 @@
#!/bin/bash
TARGET=release_ps2
set -e
LIBRWDIR=$(dirname "$(readlink -f "$0")")
echo "LIBRWDIR is $LIBRWDIR"
cd "$LIBRWDIR"
premake5 gmake
docker rm librw_instance -f >/dev/null 2>&1 || true
docker stop librw_instance -t 0 >/dev/null 2>&1 || true
docker pull librw/librw
docker run -v "$LIBRWDIR:/librw:rw,z" --name librw_instance -d librw/librw sleep infinity
docker exec -u builder librw_instance /bin/bash -c "cd /librw/build && make clean config=$TARGET && make config=$TARGET verbose=1"
docker rm librw_instance -f >/dev/null 2>&1 || true
docker stop librw_instance -t 0 >/dev/null 2>&1 || true

28
premake5.lua Executable file → Normal file
View File

@ -1,5 +1,16 @@
GLEWdir = "C:/Users/aap/src/glew-2.1.0" newoption {
GLFW64dir = "C:/Users/aap/src/glfw-3.2.1.bin.WIN64" trigger = "glewdir",
value = "path",
description = "Directory of GLEW",
default = "C:/Users/aap/src/glew-2.1.0",
}
newoption {
trigger = "glfwdir",
value = "path",
description = "Directory of glfw",
default = "C:/Users/aap/src/glfw-3.2.1.bin.WIN64",
}
workspace "librw" workspace "librw"
location "build" location "build"
@ -37,6 +48,7 @@ workspace "librw"
gccprefix 'ee-' gccprefix 'ee-'
buildoptions { "-nostdlib", "-fno-common" } buildoptions { "-nostdlib", "-fno-common" }
includedirs { "$(PS2SDK)/ee/include", "$(PS2SDK)/common/include" } includedirs { "$(PS2SDK)/ee/include", "$(PS2SDK)/common/include" }
optimize "Off"
filter { "platforms:*amd64*" } filter { "platforms:*amd64*" }
architecture "x86_64" architecture "x86_64"
@ -50,8 +62,8 @@ workspace "librw"
filter { "platforms:win*gl3" } filter { "platforms:win*gl3" }
defines { "GLEW_STATIC" } defines { "GLEW_STATIC" }
includedirs { path.join(GLEWdir, "include") } includedirs { path.join(_OPTIONS["glewdir"], "include") }
includedirs { path.join(GLFW64dir, "include") } includedirs { path.join(_OPTIONS["glfwdir"], "include") }
filter "action:vs*" filter "action:vs*"
buildoptions { "/wd4996", "/wd4244" } buildoptions { "/wd4996", "/wd4244" }
@ -83,10 +95,10 @@ function findlibs()
filter { "platforms:win*gl3" } filter { "platforms:win*gl3" }
defines { "GLEW_STATIC" } defines { "GLEW_STATIC" }
filter { "platforms:win-amd64-gl3" } filter { "platforms:win-amd64-gl3" }
libdirs { path.join(GLEWdir, "lib/Release/x64") } libdirs { path.join(_OPTIONS["glewdir"], "lib/Release/x64") }
libdirs { path.join(GLFW64dir, "lib-vc2015") } libdirs { path.join(_OPTIONS["glfwdir"], "lib-vc2015") }
filter { "platforms:win-x86-gl3" } filter { "platforms:win-x86-gl3" }
libdirs { path.join(GLEWdir, "lib/Release/Win32") } libdirs { path.join(_OPTIONS["glewdir"], "lib/Release/Win32") }
filter { "platforms:win*gl3" } filter { "platforms:win*gl3" }
links { "glew32s", "glfw3", "opengl32" } links { "glew32s", "glfw3", "opengl32" }
filter { "platforms:*d3d9" } filter { "platforms:*d3d9" }
@ -157,7 +169,7 @@ project "ps2test"
libdirs { "$(PS2SDK)/ee/lib" } libdirs { "$(PS2SDK)/ee/lib" }
links { "librw" } links { "librw" }
-- "c -lc" is a hack because we need -lc twice for some reason -- "c -lc" is a hack because we need -lc twice for some reason
links { "c -lc", "kernel", "mf" } links { "c", "kernel", "mf" }
--project "ps2rastertest" --project "ps2rastertest"
-- kind "ConsoleApp" -- kind "ConsoleApp"