Skip to content

Commit

Permalink
CI/RLS: upgrade to libspatialindex-2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mwtoews committed Jul 9, 2024
1 parent 1b81733 commit 14fa6fb
Show file tree
Hide file tree
Showing 8 changed files with 68 additions and 321 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@ jobs:
matrix:
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
sidx-version: ['1.8.5', '1.9.3']
# test oldesst and newest libspatialindex versions
sidx-version: ['1.8.5', '2.0.0']
exclude:
- os: 'macos-latest'
- sidx-version: '1.8.5'
Expand Down
237 changes: 0 additions & 237 deletions ci/CMakeLists.txt

This file was deleted.

58 changes: 22 additions & 36 deletions ci/install_libspatialindex.bash
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,15 @@
set -xe

# A simple script to install libspatialindex from a Github Release
VERSION=1.9.3
SHA256=63a03bfb26aa65cf0159f925f6c3491b6ef79bc0e3db5a631d96772d6541187e
VERSION=2.0.0
SHA256=8caa4564c4592824acbf63a2b883aa2d07e75ccd7e9bf64321c455388a560579

# where to copy resulting files
# this has to be run before `cd`-ing anywhere
libtarget() {
install_prefix() {
OURPWD=$PWD
cd "$(dirname "$0")"
mkdir -p ../rtree/lib
cd ../rtree/lib
arr=$(pwd)
cd "$OURPWD"
echo $arr
}

headertarget() {
OURPWD=$PWD
cd "$(dirname "$0")"
mkdir -p ../rtree/include
cd ../rtree/include
cd ../rtree
arr=$(pwd)
cd "$OURPWD"
echo $arr
Expand All @@ -36,8 +25,7 @@ scriptloc() {
}
# note that we're doing this convoluted thing to get
# an absolute path so mac doesn't yell at us
LIBTARGET=`libtarget`
HEADERTARGET=`headertarget`
INSTALL_PREFIX=`install_prefix`
SL=`scriptloc`

rm $VERSION.zip || true
Expand All @@ -53,31 +41,29 @@ cd libspatialindex-${VERSION}
mkdir build
cd build

cp "${SL}/CMakeLists.txt" ..

printenv

if [ "$(uname)" == "Darwin" ]; then
CMAKE_ARGS="-DCMAKE_OSX_ARCHITECTURES=${ARCHFLAGS##* }"
CMAKE_ARGS=\
"-D CMAKE_OSX_ARCHITECTURES=${ARCHFLAGS##* } "\
"-D CMAKE_INSTALL_RPATH=@loader_path"
fi

cmake -DCMAKE_BUILD_TYPE=Release ${CMAKE_ARGS} ..
cmake ${CMAKE_ARGS} \
-D CMAKE_BUILD_TYPE=Release \
-D BUILD_SHARED_LIBS=ON \
-D CMAKE_INSTALL_PREFIX=${INSTALL_PREFIX} \
-D CMAKE_INSTALL_LIBDIR=lib \
-D CMAKE_PLATFORM_NO_VERSIONED_SONAME=ON \
..
make -j 4

# copy built libraries relative to path of this script
# -d means copy links as links rather than duplicate files
# macos uses "bsd cp" and needs special handling
if [ "$(uname)" == "Darwin" ]; then
# change the rpath in the dylib to point to the same directory
install_name_tool -change @rpath/libspatialindex.6.dylib @loader_path/libspatialindex.dylib bin/libspatialindex_c.dylib
# copy the dylib files to the target director
cp bin/libspatialindex.dylib $LIBTARGET
cp bin/libspatialindex_c.dylib $LIBTARGET
cp -r ../include/* $HEADERTARGET
else
cp -L bin/* $LIBTARGET
cp -r ../include/* $HEADERTARGET
fi
make install

# remove unneeded extras in lib
rm -rfv ${INSTALL_PREFIX}/lib/cmake
rm -rfv ${INSTALL_PREFIX}/lib/pkgconfig

ls $LIBTARGET
ls -R $HEADERTARGET
ls -R ${INSTALL_PREFIX}/lib
ls -R ${INSTALL_PREFIX}/include
28 changes: 16 additions & 12 deletions ci/install_libspatialindex.bat
Original file line number Diff line number Diff line change
@@ -1,29 +1,33 @@
python -c "import sys; print(sys.version)"

set SIDX_VERSION=1.9.3
set SIDX_VERSION=2.0.0

curl -OL "https://github.com/libspatialindex/libspatialindex/archive/%SIDX_VERSION%.zip"

tar xvf "%SIDX_VERSION%.zip"

REM unzip 1.9.3.zip
REM copy %~dp0\CMakeLists.txt libspatialindex-1.9.3\CMakeLists.txt
cd libspatialindex-%SIDX_VERSION%

mkdir build
cd build

pip install ninja

cmake -D CMAKE_BUILD_TYPE=Release -G Ninja ..
set INSTALL_PREFIX=%~dp0\..\rtree

ninja
cmake -G Ninja ^
-D CMAKE_BUILD_TYPE=Release ^
-D BUILD_SHARED_LIBS="ON" ^
-D CMAKE_INSTALL_PREFIX="%INSTALL_PREFIX%" ^
-D CMAKE_INSTALL_BINDIR=lib ^
-D CMAKE_INSTALL_LIBDIR=libdir ^
..

mkdir %~dp0\..\rtree\lib
copy bin\*.dll %~dp0\..\rtree\lib
xcopy /S ..\include\* %~dp0\..\rtree\include\
rmdir /Q /S bin
ninja install

dir %~dp0\..\rtree\
dir %~dp0\..\rtree\lib
dir %~dp0\..\rtree\include
:: remove unneeded libdir
rmdir %INSTALL_PREFIX%\libdir /s /q

dir %INSTALL_PREFIX%
dir %INSTALL_PREFIX%\lib
dir %INSTALL_PREFIX%\include /s
Loading

0 comments on commit 14fa6fb

Please sign in to comment.