trips/router/scripts/install-boost-cmake.sh
Greg Pomerantz 0c4a1f9f60 router: working local OSRM backend + per-backend bench goldens
- fix encoded-polyline decoder (zigzag: (n>>1) ^ -(n&1)) — caught by
  the OSRM integration tests (Boston clearance 5681km -> 38km)
- OSRM client: routes[] JSON shape, overview=full for geometry,
  polyline+geojson support
- local OSRM 26.4.1 built from source (no sudo): deps.sh (bzip2, lua
  5.2 with readline stub, oneTBB, boost 1.84 via b2 + hand-rolled
  CMake config files, osmium-tool), setup-osrm.sh (merge PBFs ->
  extract -> partition -> customize -> serve :5000); v26 flag fixes
- bench: tasks.osrm.json goldens; both backends 26/26 PASS and agree
  on all 5 optimized orders (Ladd->Cascade etc.)
- README: profile deltas (Valhalla 332min vs OSRM 410min, same route
  shape), per-backend goldens, verified self-host status
2026-09-06 01:19:37 -04:00

74 lines
2.2 KiB
Bash
Executable File

#!/usr/bin/env bash
# Generate the Boost CMake config files OSRM's find_package(Boost CONFIG)
# needs, pointing at a b2-built boost (headers in $P/include/boost,
# static libs in $P/lib). Boost release tarballs ship no CMake support,
# so we roll minimal configs: one per component + version + main.
#
# W=/tmp/osm-build bash install-boost-cmake.sh
set -euo pipefail
W="${W:-/tmp/osm-build}"
P="$W/prefix"
CM="$P/lib/cmake/Boost-1.84.0"
mkdir -p "$CM"
cat > "$CM/BoostConfigVersion.cmake" <<'EOF'
set(PACKAGE_VERSION "1.84.0")
if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION)
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
set(PACKAGE_VERSION_COMPATIBLE TRUE)
if(PACKAGE_VERSION VERSION_EQUAL PACKAGE_FIND_VERSION)
set(PACKAGE_VERSION_EXACT TRUE)
endif()
endif()
EOF
# component: cmlist-name b2-lib-name
for pair in "date_time date_time" "iostreams iostreams" \
"program_options program_options" "thread thread" \
"unit_test_framework test" "regex regex" "zlib zlib"; do
comp=${pair% *}
b2name=${pair#* }
cap=$(echo "$comp" | tr 'a-z' 'A-Z')
if [ "$comp" = "zlib" ]; then
# OSRM lists Boost_ZLIB_LIBRARY in BOOST_ENGINE_LIBRARIES; use system zlib
cat > "$CM/Boost${cap}Config.cmake" <<EOF
set(Boost_${cap}_LIBRARY /usr/lib/x86_64-linux-gnu/libz.so)
set(Boost_${cap}_FOUND TRUE)
set(Boost_${comp}_FOUND TRUE)
EOF
continue
fi
lib=$(ls "$P"/lib/libboost_${b2name}*.a 2>/dev/null | head -1 || true)
if [ -z "$lib" ]; then
echo "FATAL: no static lib for $comp (b2name $b2name)" >&2
exit 1
fi
cat > "$CM/Boost${cap}Config.cmake" <<EOF
set(Boost_${cap}_LIBRARY "$lib")
set(Boost_${cap}_FOUND TRUE)
set(Boost_${comp}_FOUND TRUE)
EOF
done
cat > "$CM/BoostConfig.cmake" <<EOF
if(Boost_FOUND)
return()
endif()
set(Boost_VERSION 108400)
set(Boost_VERSION_STRING "1.84.0")
set(Boost_LIB_VERSION "1_84")
get_filename_component(Boost_INCLUDE_DIRS "$P/include" ABSOLUTE)
set(Boost_INCLUDE_DIR "\${Boost_INCLUDE_DIRS}")
set(Boost_LIBRARIES "")
foreach(_comp \${Boost_FIND_COMPONENTS})
string(TOUPPER "\${_comp}" _uc)
include("\${CMAKE_CURRENT_LIST_DIR}/Boost\${_uc}Config.cmake")
list(APPEND Boost_LIBRARIES \${Boost_\${_uc}_LIBRARY})
endforeach()
set(Boost_FOUND TRUE)
EOF
ls "$CM"
echo "boost cmake config installed in $CM"