diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml new file mode 100644 index 0000000000000000000000000000000000000000..214ea2092e80f0744140aacf16bd730eaef91a7f --- /dev/null +++ b/.gitlab-ci.yml @@ -0,0 +1,52 @@ +stages: + - Build + +variables: + GET_SOURCES_ATTEMPTS: 3 + +VS2017-x64: + stage: + Build + script: "CI\\ci-windows-build.bat" + variables: + GIT_SUBMODULE_STRATEGY: recursive + ARCHITECTURE: "x64" + COMPILER: "VS2017" + tags: + - VS2017 + artifacts: + paths: + - "*/*-build/Release/*.exe" + +VS2015-x64: + stage: + Build + script: "CI\\ci-windows-build.bat" + variables: + GIT_SUBMODULE_STRATEGY: recursive + ARCHITECTURE: "x64" + COMPILER: "VS2015" + tags: + - VS2015 + artifacts: + paths: + - "*/*-build/Release/*.exe" + +gcc: + stage: Build + script: "CI/ci-linux.sh gcc" + variables: + GIT_SUBMODULE_STRATEGY: recursive + tags: + - Linux + - buster + +clang: + stage: Build + script: "CI/ci-linux.sh clang" + variables: + GIT_SUBMODULE_STRATEGY: recursive + tags: + - Linux + - buster + diff --git a/CI/ci-linux.sh b/CI/ci-linux.sh new file mode 100755 index 0000000000000000000000000000000000000000..161a2d461b7eec891c34e278a74215b53509f3bc --- /dev/null +++ b/CI/ci-linux.sh @@ -0,0 +1,88 @@ +#!/bin/bash + +COMPILER=$1 +LANGUAGE=$2 + +# Exit script on any error +set -e + +OPTIONS="" +MAKE_OPTIONS="" +BUILDPATH="" + +if [ "$COMPILER" == "gcc" ]; then + echo "Building with GCC"; + BUILDPATH="gcc" + + # without icecc: no options required + OPTIONS="$OPTIONS -DCMAKE_CXX_COMPILER=/usr/lib/icecc/bin/g++ -DCMAKE_C_COMPILER=/usr/lib/icecc/bin/gcc" + MAKE_OPTIONS="-j16" + export ICECC_CXX=/usr/bin/g++ ; export ICECC_CC=/usr/bin/gcc + +elif [ "$COMPILER" == "clang" ]; then + + OPTIONS="$OPTIONS -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang" + echo "Building with CLANG"; + BUILDPATH="clang" +fi + +if [ "$LANGUAGE" == "C++98" ]; then + echo "Building with C++98"; + BUILDPATH="$BUILDPATH-cpp98" +elif [ "$LANGUAGE" == "C++11" ]; then + echo "Building with C++11"; + OPTIONS="$OPTIONS -DCMAKE_CXX_FLAGS='-std=c++11' " + BUILDPATH="$BUILDPATH-cpp11" +elif [ "$LANGUAGE" == "C++14" ]; then + echo "Building with C++14"; + OPTIONS="$OPTIONS -DCMAKE_CXX_FLAGS='-std=c++14' " + BUILDPATH="$BUILDPATH-cpp14" +fi + +# enable tests +OPTIONS="$OPTIONS -DGLOW_SAMPLES_TESTS=ON " + +#===================================== +# Color Settings: +#===================================== +NC='\033[0m' +OUTPUT='\033[0;32m' +WARNING='\033[0;93m' + + +echo -e "${OUTPUT}" +echo "" +echo "======================================================================" +echo "Basic configuration details:" +echo "======================================================================" +echo -e "${NC}" + +echo "Compiler: $COMPILER" +echo "Options: $OPTIONS" +echo "Language: $LANGUAGE" +echo "Make Options: $OPTIONS" +echo "BuildPath: $BUILDPATH" +echo "Path: $PATH" +echo "Language: $LANGUAGE" + +echo -e "${OUTPUT}" +echo "" +echo "=========================" +echo "Building Release versions" +echo "=========================" +echo -e "${NC}" + + +# Create build dir if it does not exist +if [ ! -d build-release-$BUILDPATH ]; then + mkdir build-release-$BUILDPATH +fi + +cd build-release-$BUILDPATH +cmake -DCMAKE_BUILD_TYPE=Release $OPTIONS .. +make $MAKE_OPTIONS + + + +# back to root +cd .. diff --git a/CI/ci-windows-build.bat b/CI/ci-windows-build.bat new file mode 100644 index 0000000000000000000000000000000000000000..83fd54444d8ec0b5dde5d10eaf9f6b71b50219f4 --- /dev/null +++ b/CI/ci-windows-build.bat @@ -0,0 +1,66 @@ +@echo off + +:: clone libraries git (set env variable to GIT_SSH_COMMAND maybe use setx once as this key won't change) +set GIT_SSH_COMMAND=ssh -i E:\\\gitlab\\\id_rsa + +:: use 4 threads for parallel compilation of the project +set CL=/MP4 + +:: determine VS version and set variables +if "%COMPILER%" == "VS2012" ( +set QT_COMPILERPREFIX=msvc2012 +set VS_COMPILERVERSION_LONG=11.0 +set VS_COMPILERVERSION_SHORT=11 +set VS_EDITION_YEAR=2012 +set VS_EDITION_PATH= 11.0 +) +if "%COMPILER%" == "VS2013" ( +set QT_COMPILERPREFIX=msvc2013 +set VS_COMPILERVERSION_LONG=12.0 +set VS_COMPILERVERSION_SHORT=12 +set VS_EDITION_YEAR=2013 +set VS_EDITION_PATH= 12.0 +) +if "%COMPILER%" == "VS2015" ( +set QT_COMPILERPREFIX=msvc2015 +set VS_COMPILERVERSION_LONG=14.0 +set VS_COMPILERVERSION_SHORT=14 +set VS_EDITION_YEAR=2015 +set VS_EDITION_PATH= 14.0 +) +if "%COMPILER%" == "VS2017" ( +set QT_COMPILERPREFIX=msvc2017 +set VS_COMPILERVERSION_LONG=15.0 +set VS_COMPILERVERSION_SHORT=15 +set VS_EDITION_YEAR=2017 +::VS2017 default install path is different from other versions +set VS_EDITION_PATH=\2017\Professional +) + +set BUILD_PLATFORM=%COMPILER% + +:: determine architecture and set variables +if "%ARCHITECTURE%" == "x64" ( +set ARCHBITS=_64 +set ARCH_VS= Win64 +set STRING_ARCH=64-Bit +) else ( +set ARCHBITS= +set ARCH_VS= +set STRING_ARCH=32-Bit +) + +set GENERATOR=Visual Studio %VS_COMPILERVERSION_SHORT% %VS_EDITION_YEAR%%ARCH_VS% +set VS_PATH="C:\Program Files (x86)\Microsoft Visual Studio%VS_EDITION_PATH%\Common7\IDE\devenv.com" + + +mkdir "build" +cd "build" +del *.exe +IF %errorlevel% NEQ 0 exit /b %errorlevel% +"C:\Program Files\CMake\bin\cmake.exe" -G "%GENERATOR%" -DCMAKE_BUILD_TYPE=Release -DTG_TESTS_GEOMETRY=ON -DTG_SAMPLES_GRAPHICS=OFF -DTG_BUILD_TESTS=ON .. +IF %errorlevel% NEQ 0 exit /b %errorlevel% +%VS_PATH% /Build "Release" GlowSamples.sln /Project "ALL_BUILD" +IF %errorlevel% NEQ 0 exit /b %errorlevel% +echo "Would run tests now :D" +cd ..