Last active
July 16, 2018 23:48
-
-
Save springmeyer/00eb7f6c0c301e6e5f2aa2061e51e5ad to your computer and use it in GitHub Desktop.
build valhalla node bindings statically
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
: ' | |
Script to build valhalla against mason deps | |
Intended to be run inside a valhalla checkout of https://github.com/valhalla/valhalla/pull/1341 | |
' | |
# put mason on path | |
mkdir -p ./mason | |
export MASON_GITSHA="f116d21" | |
curl -sSfL https://github.com/mapbox/mason/archive/${MASON_GITSHA}.tar.gz | tar --gunzip --extract --strip-components=1 --exclude="*md" --exclude="test*" --directory=./mason | |
export PATH=$(pwd)/mason:${PATH} | |
export CLANG_VERSION="6.0.0" | |
export CMAKE_VERSION="3.8.2" | |
export CCACHE_VERSION="3.3.4" | |
# install boost via mason | |
function dep { | |
mason install ${1} ${2} | |
mason link ${1} ${2} | |
} | |
# Careful: don't update this until you are running latest cmake that | |
# can understand how to detect latest boost | |
export BOOST_VERSION="1.63.0" | |
dep clang++ ${CLANG_VERSION} | |
dep ccache ${CCACHE_VERSION} | |
dep boost ${BOOST_VERSION} | |
dep boost_libprogram_options ${BOOST_VERSION} | |
dep boost_libdate_time ${BOOST_VERSION} | |
dep boost_libregex ${BOOST_VERSION} | |
dep boost_libfilesystem ${BOOST_VERSION} | |
dep boost_libsystem ${BOOST_VERSION} | |
dep boost_libiostreams ${BOOST_VERSION} | |
dep protobuf 3.5.1 | |
dep lz4 1.8.2 | |
# install node-cmake which the build depends on | |
# without actually trying to build node bindings | |
npm install --ignore-scripts | |
export MASON_LINK_PREFIX=$(pwd)/mason_packages/.link | |
MASON_CLANG=$(mason prefix clang++ ${CLANG_VERSION}) | |
MASON_CCACHE=$(mason prefix ccache ${CCACHE_VERSION}) | |
export CXX="${CUSTOM_CXX:-${MASON_CLANG}/bin/clang++}" | |
export CC="${CUSTOM_CC:-${MASON_CLANG}/bin/clang}" | |
echo "using CXX=${CXX}" | |
echo "using CC=${CC}" | |
# for protoc | |
export PATH=$(pwd)/mason_packages/.link/bin:${PATH} | |
# build valhalla | |
git submodule sync && git submodule update --init | |
mkdir -p build | |
rm -rf build/* | |
cd build | |
cmake .. \ | |
-DCMAKE_BUILD_TYPE=Release \ | |
-DCMAKE_CXX_COMPILER_LAUNCHER=${MASON_CCACHE}/bin/ccache \ | |
-DCMAKE_CXX_COMPILER="$CXX" -DCMAKE_C_COMPILER="$CC" \ | |
-DENABLE_NODE_BINDINGS=ON \ | |
-DENABLE_DATA_TOOLS=OFF \ | |
-DENABLE_SERVICES=OFF \ | |
-DENABLE_PYTHON_BINDINGS=OFF \ | |
-DCMAKE_PREFIX_PATH=${MASON_LINK_PREFIX} \ | |
-DBoost_NO_SYSTEM_PATHS=ON \ | |
-DBoost_USE_STATIC_LIBS=ON \ | |
-DCMAKE_CXX_FLAGS="-isystem ${MASON_LINK_PREFIX}/include" | |
VERBOSE=1 make -j4 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment