From 75dbb7e67e70aec50caa9a4a2d64021bcdbadb15 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Wed, 25 Jul 2018 20:42:03 +0200 Subject: [PATCH] Add travis and appveyor support --- .appveyor.yml | 28 ++++++++++++++++++++ .travis.yml | 33 ++++++++++++++++++++++++ Dockerfile | 60 +++++++++++++++++++++++++++++++++++++++++++ docker_rebuild_ps2.sh | 22 ++++++++++++++++ premake5.lua | 28 ++++++++++++++------ 5 files changed, 163 insertions(+), 8 deletions(-) create mode 100644 .appveyor.yml create mode 100644 .travis.yml create mode 100644 Dockerfile create mode 100755 docker_rebuild_ps2.sh mode change 100755 => 100644 premake5.lua diff --git a/.appveyor.yml b/.appveyor.yml new file mode 100644 index 0000000..79268a1 --- /dev/null +++ b/.appveyor.yml @@ -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 diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..4ff4231 --- /dev/null +++ b/.travis.yml @@ -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" diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..2792091 --- /dev/null +++ b/Dockerfile @@ -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 diff --git a/docker_rebuild_ps2.sh b/docker_rebuild_ps2.sh new file mode 100755 index 0000000..cf8148f --- /dev/null +++ b/docker_rebuild_ps2.sh @@ -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 diff --git a/premake5.lua b/premake5.lua old mode 100755 new mode 100644 index b53f860..be7a38b --- a/premake5.lua +++ b/premake5.lua @@ -1,5 +1,16 @@ -GLEWdir = "C:/Users/aap/src/glew-2.1.0" -GLFW64dir = "C:/Users/aap/src/glfw-3.2.1.bin.WIN64" +newoption { + 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" location "build" @@ -37,6 +48,7 @@ workspace "librw" gccprefix 'ee-' buildoptions { "-nostdlib", "-fno-common" } includedirs { "$(PS2SDK)/ee/include", "$(PS2SDK)/common/include" } + optimize "Off" filter { "platforms:*amd64*" } architecture "x86_64" @@ -50,8 +62,8 @@ workspace "librw" filter { "platforms:win*gl3" } defines { "GLEW_STATIC" } - includedirs { path.join(GLEWdir, "include") } - includedirs { path.join(GLFW64dir, "include") } + includedirs { path.join(_OPTIONS["glewdir"], "include") } + includedirs { path.join(_OPTIONS["glfwdir"], "include") } filter "action:vs*" buildoptions { "/wd4996", "/wd4244" } @@ -83,10 +95,10 @@ function findlibs() filter { "platforms:win*gl3" } defines { "GLEW_STATIC" } filter { "platforms:win-amd64-gl3" } - libdirs { path.join(GLEWdir, "lib/Release/x64") } - libdirs { path.join(GLFW64dir, "lib-vc2015") } + libdirs { path.join(_OPTIONS["glewdir"], "lib/Release/x64") } + libdirs { path.join(_OPTIONS["glfwdir"], "lib-vc2015") } filter { "platforms:win-x86-gl3" } - libdirs { path.join(GLEWdir, "lib/Release/Win32") } + libdirs { path.join(_OPTIONS["glewdir"], "lib/Release/Win32") } filter { "platforms:win*gl3" } links { "glew32s", "glfw3", "opengl32" } filter { "platforms:*d3d9" } @@ -157,7 +169,7 @@ project "ps2test" libdirs { "$(PS2SDK)/ee/lib" } links { "librw" } -- "c -lc" is a hack because we need -lc twice for some reason - links { "c -lc", "kernel", "mf" } + links { "c", "kernel", "mf" } --project "ps2rastertest" -- kind "ConsoleApp"