| 1 |
#!/bin/bash |
| 2 |
|
| 3 |
# Invoke from anywhere to perform an incremental build of pycolmap bindings. |
| 4 |
# Make sure to install the requirements from pyproject.toml. If colmap is not |
| 5 |
# installed globally but in a custom directory, you should set the colmap_DIR |
| 6 |
# environment variable, e.g.: |
| 7 |
# |
| 8 |
# colmap_DIR=/path/to/cmake/install/prefix pycolmap/incremental_build.sh |
| 9 |
|
| 10 |
set -e |
| 11 |
|
| 12 |
script_dir=$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd) |
| 13 |
|
| 14 |
pip install \ |
| 15 |
--no-build-isolation \ |
| 16 |
-Cbuild-dir="$script_dir/build" \ |
| 17 |
-ve \ |
| 18 |
"$script_dir/.." |
| 19 |
|
| 20 |
# Symlink the compiled _core extension into the source tree so that the |
| 21 |
# editable install (which adds python/ to sys.path) can find it. |
| 22 |
site_pkg=$(python -c "import sysconfig; print(sysconfig.get_path('purelib'))") |
| 23 |
core_so=$(ls -t "$site_pkg/pycolmap"/_core*.so 2>/dev/null | head -1) |
| 24 |
if [ -n "$core_so" ]; then |
| 25 |
ln -sf "$core_so" "$script_dir/pycolmap/" |
| 26 |
fi |