From e7f0792ea44a4d12f563c8d5f7638d9fc5eaaf35 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Sun, 20 Oct 2019 19:37:14 -0700 Subject: [PATCH] travis win32 --- .ci | 2 +- .gitmodules | 2 +- .travis.yml | 6 +++-- msenv.bat | 8 ++++++ travis-libevent.sh | 22 ++++++++------- withenv.sh | 67 ++++++++++++++++++++++++++++++++++++++++++++++ 6 files changed, 93 insertions(+), 14 deletions(-) create mode 100644 msenv.bat create mode 100755 withenv.sh diff --git a/.ci b/.ci index 1bbf516..f1048da 160000 --- a/.ci +++ b/.ci @@ -1 +1 @@ -Subproject commit 1bbf51635d9ab4fc919d0cdcb593291e69fface5 +Subproject commit f1048da6435c41a674fb9a7e041c4396fc0ea74e diff --git a/.gitmodules b/.gitmodules index cfa3a70..4bf9ca9 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ [submodule ".ci"] path = .ci - url = https://github.com/epics-base/ci-scripts + url = https://github.com/mdavidsaver/ci-scripts diff --git a/.travis.yml b/.travis.yml index 4fa08e7..a29f597 100644 --- a/.travis.yml +++ b/.travis.yml @@ -17,11 +17,11 @@ addons: - cmake install: + - ./withenv.sh ./.ci/travis-prepare.sh - ./travis-libevent.sh - - ./.ci/travis-prepare.sh script: - - ./.ci/travis-build.sh + - ./withenv.sh ./.ci/travis-build.sh # If you need to do more during install and build, # add a local directory to your module and do e.g. @@ -37,6 +37,8 @@ script: matrix: include: + - env: BASE=7.0 EPICS_HOST_ARCH=win32-x86 + os: windows # Different configurations of default gcc and clang diff --git a/msenv.bat b/msenv.bat new file mode 100644 index 0000000..4496bea --- /dev/null +++ b/msenv.bat @@ -0,0 +1,8 @@ + +set VCVARS=%1 +set PLATFORM=%2 + +call %VCVARS% %PLATFORM% +where cl + +set diff --git a/travis-libevent.sh b/travis-libevent.sh index a9f7dde..f0a5041 100755 --- a/travis-libevent.sh +++ b/travis-libevent.sh @@ -1,18 +1,20 @@ -#!/bin/sh +#!/bin/bash set -e -x env -BFLAGS= +GFLAGS=() +BFLAGS=() if [ "$TRAVIS_OS_NAME" = "windows" ] then pwd - # C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe - find "/c/Program Files (x86)" -name vcvars*.bat - ./msenv.bat "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" x86 + ls /c/Users/travis/AppData/Local/Microsoft/WindowsApps - BFLAGS="$BFLAGS -G "\""Visual Studio 15 2017 x86"\" + # C:/Program Files (x86)/Microsoft Visual Studio/2017/BuildTools/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe + find "/c/Program Files (x86)/Microsoft Visual Studio"* -name vcvars*.bat + + GFLAGS=("${GFLAGS[@]}" "-G" "Visual Studio 15 2017") fi perl --version @@ -21,16 +23,16 @@ cmake --version cmake --help # cmake as of 3.13 knows how to involve parallel make (or whatever) -cmake --build 2>&1|grep parallel && BFLAGS="$BFLAGS -j 2" +cmake --build 2>&1|grep parallel && BFLAGS=("${BFLAGS[@]}" "-j" "2") git clone --branch patches-2.1 https://github.com/libevent/libevent.git mkdir host-libevent cd host-libevent -cmake -DEVENT__DISABLE_OPENSSL=ON -DCMAKE_INSTALL_PREFIX:DIR=$PWD/usr ../libevent -ls -cmake --build . $BFLAGS --target install +cmake "${GFLAGS[@]}" -DEVENT__DISABLE_OPENSSL=ON -DCMAKE_INSTALL_PREFIX:DIR=$PWD/usr ../libevent +cmake --build . "${BFLAGS[@]}" --target install +find usr case "$TRAVIS_OS_NAME" in linux) OS_CLASS=Linux;; diff --git a/withenv.sh b/withenv.sh new file mode 100755 index 0000000..a4c581e --- /dev/null +++ b/withenv.sh @@ -0,0 +1,67 @@ +#!/bin/sh +set -e -x +# I (sometimes) inject environment + +if [ "$TRAVIS_OS_NAME" = "windows" ] +then + # travis sets these to gcc/g++ + unset CC + unset CXX + export TRAVIS_COMPILER=cl + + if [ ! -d "$HOME/tools" ] + then + echo "Available MSVC versions" + find "/c/Program Files (x86)/Microsoft Visual Studio"* -name vcvars*.bat + + # it would be soooo nice if this worked... + # but instead "Can't locate ExtUtils/Command.pm ..." + #choco install make + #choco install strawberryperl + #choco list --local-only + + mkdir "$HOME/tools" + + curl -fsS --retry 3 -o "$HOME/tools"/make.zip https://epics.anl.gov/download/tools/make-4.2.1-win64.zip + curl -fsS --retry 3 -o "$HOME/tools"/perl.zip http://strawberryperl.com/download/5.30.0.1/strawberry-perl-5.30.0.1-64bit.zip + (cd "$HOME/tools" && unzip make.zip) >/dev/null + (cd "$HOME/tools" && unzip perl.zip) >/dev/null + + cat < msboot.bat + cd %1 + call relocation.pl.bat +EOF + ./msboot.bat "$HOME/tools" >/dev/null + fi + + export PATH="$HOME/tools:$HOME/tools/perl/site/bin:$HOME/tools/perl/bin:$PATH" + + type make + make --version + type perl + perl --version + + cat < msboot.bat +echo Before PATH=%PATH% +where sh +:: pick up choco installs +::call RefreshEnv.cmd +:: which unfortunately removes /bin +::PATH=C:\program files\git\usr\bin;%PATH% + +:: pull in MSVC +call "C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" x86 +echo After PATH=%PATH% + +where cl +where perl +where sh +where make + +sh "$@" +EOF + + ./msboot.bat +else + sh "$@" +fi