Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
This is for building osm2pgrouting under mingw-w64 chain. Requires all the pgrouting dependencies. https://gist.github.com/robe2/5935101
export OS_BUILD=64
export PROJECTS=/projects
export PG_VER=9.4
export GCC_TYPE=gcc48
export PGPATH=${PROJECTS}/postgresql/rel/pg${PG_VER}w${OS_BUILD}${GCC_TYPE}
GMP_VER=5.1.2
MPFR_VER=3.1.2
CGAL_VER=4.2
#BOOST_VER=1.47.0
BOOST_VER=1.53.0
#BOOST_VER_WU=1_47_0
BOOST_VER_WU=1_53_0
BOOST_VER_WUM=1_53
PGROUTING_VER=2.0
EXPAT_VER=2.1.0
if [[ "${OS_BUILD}" == "64" ]] ; then
export MINGHOST=x86_64-w64-mingw32
export PG_BITS=
else
export MINGHOST=i686-w64-mingw32
export PG_BITS=w32
fi
#in addition to pgRouting Boost and PostgreSQL, also need expat
#Get expat from - http://sourceforge.net/projects/expat/ (I used 2.1.0)
#it is assumed you have an expat folder and have the expat-2.1.0.tar.gz in there
if true; then
cd ${PROJECTS}/expat
tar xvfz expat-${EXPAT_VER}.tar.gz
cd expat-${EXPAT_VER}
./configure --host=${MINGHOST} --target=${MINGHOST} --prefix=${PROJECTS}/expat/rel-expat-${EXPAT_VER}w${OS_BUILD}${GCC_TYPE}
make && make install
fi
## building os2pgrouting
#gmp
PATH="${PATH}:${PROJECTS}/CGAL/rel-gmp-${GMP_VER}w${OS_BUILD}${GCC_TYPE}/include:${PROJECTS}/CGAL/rel-gmp-${GMP_VER}w${OS_BUILD}${GCC_TYPE}/lib"
#mpfr
PATH="${PATH}:${PROJECTS}/CGAL/rel-mpfr-${MPFR_VER}w${OS_BUILD}${GCC_TYPE}/include:${PROJECTS}/CGAL/rel-mpfr-${MPFR_VER}w${OS_BUILD}${GCC_TYPE}/lib:${PROJECTS}/CGAL/rel-mpfr-${MPFR_VER}w${OS_BUILD}${GCC_TYPE}/bin"
#boost
PATH="${PATH}:${PROJECTS}/boost/rel-${BOOST_VER_WU}w${OS_BUILD}${GCC_TYPE}/lib"
#cgal
PATH="${PATH}:${PROJECTS}/CGAL/rel-cgal-${CGAL_VER}w${OS_BUILD}${GCC_TYPE}/include:${PROJECTS}/CGAL/rel-cgal-${CGAL_VER}w${OS_BUILD}${GCC_TYPE}/lib"
#expat
PATH="${PATH}:${PROJECTS}/expat/rel-${EXPAT_VER}w${OS_BUILD}${GCC_TYPE}/include:${PROJECTS}/expat/rel-${EXPAT_VER}w${OS_BUILD}${GCC_TYPE}/lib:${PROJECTS}/expat/rel-${EXPAT_VER}w${OS_BUILD}${GCC_TYPE}/bin"
cd ${PROJECTS}
mkdir osm2pgrouting
cd osm2pgrouting
mkdir branches
#only need to do clone once
git clone -b master https://github.com/pgRouting/osm2pgrouting.git ${PROJECTS}/osm2pgrouting/branches/${PGROUTING_VER}
cd ${PROJECTS}/osm2pgrouting/branches/${PGROUTING_VER}
git pull
export PostgreSQL_ROOT=${PGPATH}
cd ${PROJECTS}/osm2pgrouting/branches/${PGROUTING_VER}
git pull
cd ${PROJECTS}/osm2pgrouting
export PostgreSQL_ROOT=${PGPATH}
rm -rf build
mkdir build
cd build
# CMAKE_INSTALL_PREFIX is currently ignored so always installs in c:/usr/share or whatever drive compiled from
cmake -G "MSYS Makefiles" -DCMAKE_VERBOSE_MAKEFILE=ON -DCMAKE_INSTALL_PREFIX:PATH=${PROJECTS}/pgrouting/rel-osm2pgrouting-${PGROUTING_VER}w${OS_BUILD}${GCC_TYPE} -DBOOST_ROOT:PATH=${PROJECTS}/boost/rel-${BOOST_VER_WU}w${OS_BUILD}${GCC_TYPE} -DEXPAT_INCLUDE_DIR:PATH=${PROJECTS}/expat/rel-expat-${EXPAT_VER}w${OS_BUILD}${GCC_TYPE}/include -DEXPAT_LIBRARY:PATH=${PROJECTS}/expat/rel-expat-${EXPAT_VER}w${OS_BUILD}${GCC_TYPE}/bin/libexpat-1.dll -DBoost_USE_STATIC_LIBS=ON -DBoost_USE_MULTITHREADED=ON ../branches/${PGROUTING_VER}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.