From 0989535f807a8698c77cc1ab5138efa6d4edf3b6 Mon Sep 17 00:00:00 2001 From: Viktor Gal Date: Tue, 6 Mar 2018 08:53:25 +0100 Subject: [PATCH] [Windows] use clcache when building on appveyor --- appveyor.yml | 26 +++++++++++--------------- scripts/appveyor-setup.bat | 23 +++++++++++++++++++++++ scripts/msvc-build.bat | 17 +++++++++++++++++ 3 files changed, 51 insertions(+), 15 deletions(-) create mode 100644 scripts/appveyor-setup.bat create mode 100644 scripts/msvc-build.bat diff --git a/appveyor.yml b/appveyor.yml index 9adc097a25b..95b8601ef51 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,13 +1,14 @@ version: "{build}" +cache: + - C:\Users\appveyor\clcache + environment: matrix: - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 VSVER: Visual Studio 14 2015 Win64 - PYTHON: "C:\\Python27" -# disable multiple builds until each build takes more than 30 minutes -# - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 -# VSVER: Visual Studio 15 2017 Win64 + PYTHON: "3.6" + APPVEYOR_SAVE_CACHE_ON_ERROR: true platform: - x64 @@ -16,25 +17,20 @@ configuration: - Release install: + - set MINICONDA=C:\Miniconda36-x64 + - set PATH=%MINICONDA%;%MINICONDA%/Scripts;%MINICONDA%/Library/bin;%PATH% + - call scripts\appveyor-setup.bat - git submodule -q update --init -before_build: - - md %APPVEYOR_BUILD_FOLDER%\build - - cd %APPVEYOR_BUILD_FOLDER%\build - - cmake -G"%VSVER%" -DCMAKE_BUILD_TYPE=%CONFIGURATION% -DBUILD_META_EXAMPLES=OFF -DENABLE_TESTING=ON .. - build: verbosity: minimal -# TODO: fix cmake script in order that building examples -# triggers the build of shogun-static.vcxproj build_script: - - msbuild src\shogun\libshogun.vcxproj - - msbuild src\shogun\shogun.vcxproj - - msbuild src\shogun\shogun-static.vcxproj - - msbuild shogun.sln + - call scripts\msvc-build.bat test_script: - cd %APPVEYOR_BUILD_FOLDER%\build - ctest --output-on-failure -C %CONFIGURATION% +after_build: + - clcache -s diff --git a/scripts/appveyor-setup.bat b/scripts/appveyor-setup.bat new file mode 100644 index 00000000000..0080d83a8cd --- /dev/null +++ b/scripts/appveyor-setup.bat @@ -0,0 +1,23 @@ +@echo on + +conda update -y -q conda +conda config --set auto_update_conda false +conda info -a + +conda config --set show_channel_urls True + +@rem Help with SSL timeouts to S3 +conda config --set remote_connect_timeout_secs 12 + +conda config --add channels https://repo.continuum.io/pkgs/free +conda config --add channels conda-forge +conda info -a + +@rem Use clcache for faster builds +pip install -q git+https://github.com/frerich/clcache.git +clcache -s +set CC=clcache +set CXX=clcache +set CLCACHE_SERVER=1 +set CLCACHE_HARDLINK=1 +powershell.exe -Command "Start-Process clcache-server" diff --git a/scripts/msvc-build.bat b/scripts/msvc-build.bat new file mode 100644 index 00000000000..8bb6ddba782 --- /dev/null +++ b/scripts/msvc-build.bat @@ -0,0 +1,17 @@ +@echo on + +conda create -n shogun -q -y python=%PYTHON% ^ + setuptools numpy scipy eigen rxcpp ^ + cmake snappy zlib ctags ply +call activate shogun + +mkdir %APPVEYOR_BUILD_FOLDER%\build +pushd %APPVEYOR_BUILD_FOLDER%\build + +cmake -G "%VSVER%" ^ + -DCMAKE_BUILD_TYPE=%CONFIGURATION% ^ + -DCMAKE_INSTALL_PREFIX=%CONDA_PREFIX%\Library ^ + -DBUILD_META_EXAMPLES=OFF ^ + -DENABLE_TESTING=ON .. || exit /B + +cmake --build . --target install --config %CONFIGURATION% -- /maxcpucount:2 || exit /B