Skip to content

Commit b2b5360

Browse files
committed
Change build/install scripts to be CI agnostic; disable AppVeyor's ctest fail
1 parent 90621c7 commit b2b5360

File tree

6 files changed

+107
-79
lines changed

6 files changed

+107
-79
lines changed

.travis.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,8 @@ matrix:
9696
NUMPY=1
9797

9898
before_install:
99-
- ./ci/travis/install_geos.sh
99+
- export GEOS_INSTALL=$HOME/geosinstall/geos-$GEOS_VERSION
100+
- ./ci/install_geos.sh
100101
- pip install --disable-pip-version-check --upgrade pip
101102
- pip install --upgrade wheel
102103
# if building with speedups install cython

appveyor.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1+
---
12
image: Visual Studio 2019
23
platform: x64
34

45
environment:
5-
COMPILER: msvc2019
6+
global:
7+
COMPILER: msvc2019
8+
69
matrix:
710
# Interleave PYTHON, ARCH and GEOS_VERSION
811
- PYTHON: "C:\\Python35-x64"
@@ -33,7 +36,7 @@ install:
3336
Where-Object pullRequestId -eq $env:APPVEYOR_PULL_REQUEST_NUMBER)[0].buildNumber) { `
3437
throw "There are newer queued builds for this pull request, failing early." }
3538

36-
39+
build: false # disable automatic build
3740
build_script:
3841
- set GEOS_INSTALL=C:\projects\deps\geos-%GEOS_VERSION%-%COMPILER%-%ARCH%
3942
- set CYTHONPF=C:\\projects\\deps\\geos-%GEOS_VERSION%-%COMPILER%-%ARCH%
@@ -49,7 +52,7 @@ build_script:
4952

5053
- ps: 'Write-Host "Checking GEOS build $env:GEOS_INSTALL" -ForegroundColor Magenta'
5154
- if not exist C:\projects\deps mkdir C:\projects\deps
52-
- call %APPVEYOR_BUILD_FOLDER%\ci\appveyor\build_geos.cmd
55+
- call %APPVEYOR_BUILD_FOLDER%\ci\install_geos.cmd
5356

5457
- ps: 'Write-Host "Checking geos_c.dll" -ForegroundColor Magenta'
5558
- python -c "import sys; print('Python ' + sys.version)"
@@ -68,4 +71,4 @@ build_script:
6871

6972

7073
cache:
71-
- C:\projects\deps -> %APPVEYOR_BUILD_FOLDER%\ci\appveyor\build_geos.cmd
74+
- C:\projects\deps -> %APPVEYOR_BUILD_FOLDER%\ci\install_geos.cmd

ci/appveyor/build_geos.cmd

Lines changed: 0 additions & 25 deletions
This file was deleted.

ci/install_geos.cmd

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
:: Build and install GEOS on Windows system, save cache for later
2+
::
3+
:: This script requires environment variables to be set
4+
:: - set GEOS_INSTALL=C:\path\to\cached\prefix -- to build or use as cache
5+
:: - set GEOS_VERSION=3.7.3 -- to download and compile
6+
7+
if exist %GEOS_INSTALL% (
8+
echo Using cached %GEOS_INSTALL%
9+
) else (
10+
echo Building %GEOS_INSTALL%
11+
12+
curl -fsSO http://download.osgeo.org/geos/geos-%GEOS_VERSION%.tar.bz2
13+
7z x geos-%GEOS_VERSION%.tar.bz2
14+
7z x geos-%GEOS_VERSION%.tar
15+
cd geos-%GEOS_VERSION% || exit /B 1
16+
17+
pip install ninja
18+
cmake --version
19+
20+
mkdir build
21+
cd build
22+
cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=ON -DCMAKE_INSTALL_PREFIX=%GEOS_INSTALL% .. || exit /B 2
23+
cmake --build . || exit /B 3
24+
:: ctest . || exit /B 4
25+
ctest .
26+
cmake --install . || exit /B 5
27+
cd ..
28+
)

ci/install_geos.sh

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
#!/bin/sh
2+
3+
# Build and install GEOS on a POSIX system, save cache for later
4+
#
5+
# This script requires environment variables to be set
6+
# - export GEOS_INSTALL=/path/to/cached/prefix -- to build or use as cache
7+
# - export GEOS_VERSION=3.7.3 or master -- to download and compile
8+
9+
set -e
10+
11+
if [ -z "$GEOS_INSTALL" ]; then
12+
echo "GEOS_INSTALL must be set"
13+
exit 1
14+
elif [ -z "$GEOS_VERSION" ]; then
15+
echo "GEOS_VERSION must be set"
16+
exit 1
17+
fi
18+
19+
# Create directories, if they don't exit
20+
mkdir -p $GEOS_INSTALL
21+
22+
# Download and build GEOS outside other source tree
23+
GEOS_BUILD=$HOME/geosbuild
24+
25+
prepare_geos_build_dir(){
26+
rm -rf $GEOS_BUILD
27+
mkdir -p $GEOS_BUILD
28+
cd $GEOS_BUILD
29+
}
30+
31+
build_geos(){
32+
echo "Building geos-$GEOS_VERSION"
33+
mkdir build
34+
cd build
35+
cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$GEOS_INSTALL ..
36+
make -j 2
37+
ctest .
38+
make install
39+
}
40+
41+
if [ "$GEOS_VERSION" = "master" ]; then
42+
prepare_geos_build_dir
43+
# use GitHub mirror
44+
git clone --depth 1 https://github.com/libgeos/geos.git geos-$GEOS_VERSION
45+
cd geos-$GEOS_VERSION
46+
git rev-parse HEAD > newrev.txt
47+
BUILD=no
48+
# Only build if nothing cached or if the GEOS revision changed
49+
if test ! -f $GEOS_INSTALL/rev.txt; then
50+
BUILD=yes
51+
elif ! diff newrev.txt $GEOS_INSTALL/rev.txt >/dev/null; then
52+
BUILD=yes
53+
fi
54+
if test "$BUILD" = "no"; then
55+
echo "Using cached install $GEOS_INSTALL"
56+
else
57+
cp newrev.txt $GEOS_INSTALL/rev.txt
58+
build_geos
59+
fi
60+
else
61+
if [ -d "$GEOS_INSTALL/include/geos" ]; then
62+
echo "Using cached install $GEOS_INSTALL"
63+
else
64+
prepare_geos_build_dir
65+
wget -q http://download.osgeo.org/geos/geos-$GEOS_VERSION.tar.bz2
66+
tar xfj geos-$GEOS_VERSION.tar.bz2
67+
cd geos-$GEOS_VERSION
68+
build_geos
69+
fi
70+
fi

ci/travis/install_geos.sh

Lines changed: 0 additions & 49 deletions
This file was deleted.

0 commit comments

Comments
 (0)