diff --git a/ci/scripts/build.linux.script.sh b/ci/scripts/build.linux.script.sh new file mode 100644 index 000000000..d00edbfda --- /dev/null +++ b/ci/scripts/build.linux.script.sh @@ -0,0 +1,31 @@ +#!/bin/bash + +set -x + +# Create and enter build directory. +rootdir=`pwd` +mkdir -p ${EIGEN_CI_BUILDDIR} +cd ${EIGEN_CI_BUILDDIR} + +# Configure build. +cmake -G Ninja \ + -DCMAKE_CXX_COMPILER=${EIGEN_CI_CXX_COMPILER} \ + -DCMAKE_C_COMPILER=${EIGEN_CI_C_COMPILER} \ + -DCMAKE_CXX_COMPILER_TARGET=${EIGEN_CI_CXX_COMPILER_TARGET} \ + ${EIGEN_CI_ADDITIONAL_ARGS} ${rootdir} + +target="" +if [[ ${EIGEN_CI_BUILD_TARGET} ]]; then + target="--target ${EIGEN_CI_BUILD_TARGET}" +fi + +# Builds (particularly gcc) sometimes get killed, potentially when running +# out of resources. In that case, keep trying to build the remaining +# targets (k0), then try to build again with a single thread (j1) to minimize +# resource use. +cmake --build . ${target} -- -k0 || cmake --build . ${target} -- -k0 -j1 + +# Return to root directory. +cd ${rootdir} + +set +x diff --git a/ci/scripts/build.windows.script.ps1 b/ci/scripts/build.windows.script.ps1 new file mode 100644 index 000000000..2249d008d --- /dev/null +++ b/ci/scripts/build.windows.script.ps1 @@ -0,0 +1,44 @@ +# Find Visual Studio installation directory. +$VS_INSTALL_DIR = &"${Env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" -latest -property installationPath + +# Run VCVarsAll.bat initialization script and extract environment variables. +# http://allen-mack.blogspot.com/2008/03/replace-visual-studio-command-prompt.html +cmd.exe /c "`"${VS_INSTALL_DIR}\VC\Auxiliary\Build\vcvarsall.bat`" $EIGEN_CI_MSVC_ARCH -vcvars_ver=$EIGEN_CI_MSVC_VER & set" | + foreach { + if ($_ -match "=") { + $v = $_.split("="); set-item -force -path "ENV:\$($v[0])" -value "$($v[1])" + } + } + +# Create and enter build directory. +$rootdir = Get-Location +if (-Not (Test-Path ${EIGEN_CI_BUILDDIR})) { + mkdir $EIGEN_CI_BUILDDIR +} +cd $EIGEN_CI_BUILDDIR + +# We need to split EIGEN_CI_ADDITIONAL_ARGS, otherwise they are interpreted +# as a single argument. Split by space, unless double-quoted. +$split_args = [regex]::Split(${EIGEN_CI_ADDITIONAL_ARGS}, ' (?=(?:[^"]|"[^"]*")*$)' ) + +# Configure build. +cmake -G Ninja -DCMAKE_BUILD_TYPE=MinSizeRel ` + -DEIGEN_TEST_CUSTOM_CXX_FLAGS="${EIGEN_CI_TEST_CUSTOM_CXX_FLAGS}" ` + ${split_args} "${rootdir}" + +$target = "" +if (${EIGEN_CI_BUILD_TARGET}) { + $target = "--target ${EIGEN_CI_BUILD_TARGET}" +} + +# Windows builds sometimes fail due heap errors. In that case, try +# building the rest, then try to build again with a single thread. +cmake --build . ${target} -- -k0 || cmake --build . ${target} -- -k0 -j1 + +$success = $LASTEXITCODE + +# Return to root directory. +cd ${rootdir} + +# Explicitly propagate exit code to indicate pass/failure of build command. +if($success -ne 0) { Exit $success } diff --git a/ci/scripts/build_and_install_doxygen.sh b/ci/scripts/build_and_install_doxygen.sh new file mode 100644 index 000000000..9cb47b760 --- /dev/null +++ b/ci/scripts/build_and_install_doxygen.sh @@ -0,0 +1,6 @@ +git clone --depth 1 --branch $1 https://github.com/doxygen/doxygen.git +cmake -B doxygen/.build -G Ninja \ + -DCMAKE_CXX_COMPILER=${EIGEN_CI_CXX_COMPILER} \ + -DCMAKE_C_COMPILER=${EIGEN_CI_C_COMPILER} \ + doxygen +cmake --build doxygen/.build -t install