Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI/RLS: upgrade to libspatialindex-2.0.0 #316

Merged
merged 7 commits into from
Jul 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.

63 changes: 24 additions & 39 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,48 +25,44 @@ 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
curl -L -O https://github.com/libspatialindex/libspatialindex/archive/$VERSION.zip
rm -f $VERSION.zip
curl -LOs --retry 5 --retry-max-time 120 https://github.com/libspatialindex/libspatialindex/archive/${VERSION}.zip

# check the file hash
echo "${SHA256} ${VERSION}.zip" | sha256sum -c -

rm -rf "libspatialindex-${VERSION}" || true
rm -rf "libspatialindex-${VERSION}"
unzip -q $VERSION
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
30 changes: 17 additions & 13 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"
curl -LO --retry 5 --retry-max-time 120 "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
Loading