Skip to content

Instantly share code, notes, and snippets.

@charlax
Created October 7, 2011 20:40
Show Gist options
  • Save charlax/1271301 to your computer and use it in GitHub Desktop.
Save charlax/1271301 to your computer and use it in GitHub Desktop.
Patch to install pgrouting on Mac Os X
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1d6612c..852fd1b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -64,7 +64,9 @@ OPTION(WITH_DD "Build Driving distance library" OFF)
IF(UNIX)
SET(LIBRARY_INSTALL_PATH ${LIB_DIR})
- SET(SQL_INSTALL_PATH /usr/share/postlbs)
+ if(NOT SQL_INSTALL_PATH)
+ SET(SQL_INSTALL_PATH /usr/share/postlbs)
+ endif(NOT SQL_INSTALL_PATH)
MESSAGE("Installation directory for libraries is set to ${LIBRARY_INSTALL_PATH} and for SQL files is set to ${SQL_INSTALL_PATH}")
ELSE(UNIX)
SET(LIBRARY_INSTALL_PATH ${PGROUTING_BINARY_DIR}/lib)
diff --git a/cmake/FindPostgreSQL.cmake b/cmake/FindPostgreSQL.cmake
index 8b1b4c8..aa7aacd 100644
--- a/cmake/FindPostgreSQL.cmake
+++ b/cmake/FindPostgreSQL.cmake
@@ -4,6 +4,7 @@
# POSTGRESQL_INCLUDE_DIR, where to find POSTGRESQL.h
# POSTGRESQL_LIBRARIES, the libraries needed to use POSTGRESQL.
# POSTGRESQL_FOUND, If false, do not try to use PostgreSQL.
+# POSTGRESQL_EXECUTABLE
#
# Copyright (c) 2006, Jaroslaw Staniek, <js@iidea.pl>
#
@@ -12,13 +13,16 @@
# Add the postgresql and mysql include paths here
-if(POSTGRESQL_INCLUDE_DIR AND POSTGRESQL_LIBRARIES)
+if(POSTGRESQL_INCLUDE_DIR AND POSTGRESQL_LIBRARIES AND POSTGRESQL_EXECUTABLE)
set(POSTGRESQL_FOUND TRUE)
-else(POSTGRESQL_INCLUDE_DIR AND POSTGRESQL_LIBRARIES)
+else(POSTGRESQL_INCLUDE_DIR AND POSTGRESQL_LIBRARIES AND POSTGRESQL_EXECUTABLE)
# find_path(POSTGRESQL_INCLUDE_DIR libpq-fe.h
+ FIND_PROGRAM(POSTGRESQL_EXECUTABLE postgres)
+ MESSAGE(STATUS "POSTGRESQL_EXECUTABLE is " ${POSTGRESQL_EXECUTABLE})
+
FIND_PATH(POSTGRESQL_INCLUDE_DIR postgres.h
/usr/include/server
/usr/include/pgsql/server
@@ -54,4 +58,4 @@ else(POSTGRESQL_INCLUDE_DIR AND POSTGRESQL_LIBRARIES)
mark_as_advanced(POSTGRESQL_INCLUDE_DIR POSTGRESQL_LIBRARIES)
-endif(POSTGRESQL_INCLUDE_DIR AND POSTGRESQL_LIBRARIES)
+endif(POSTGRESQL_INCLUDE_DIR AND POSTGRESQL_LIBRARIES AND POSTGRESQL_EXECUTABLE)
diff --git a/core/src/CMakeLists.txt b/core/src/CMakeLists.txt
index ba070df..be2ca04 100644
--- a/core/src/CMakeLists.txt
+++ b/core/src/CMakeLists.txt
@@ -1,6 +1,11 @@
-
SET(LIBRARY_OUTPUT_PATH ../../lib/)
-ADD_LIBRARY(routing SHARED dijkstra.c astar.c shooting_star.c boost_wrapper.cpp astar_boost_wrapper.cpp shooting_star_boost_wrapper.cpp)
+IF(APPLE)
+ SET(LIBRARY_MODE_TARGET "MODULE")
+ELSE(APPLE)
+ SET(LIBRARY_MODE_TARGET "SHARED")
+ENDIF(APPLE)
+ADD_LIBRARY(routing ${LIBRARY_MODE_TARGET} dijkstra.c astar.c shooting_star.c boost_wrapper.cpp astar_boost_wrapper.cpp shooting_star_boost_wrapper.cpp)
INSTALL(TARGETS routing DESTINATION ${LIBRARY_INSTALL_PATH})
-
-
+IF(APPLE)
+ SET_TARGET_PROPERTIES(routing PROPERTIES LINK_FLAGS "-bundle_loader ${POSTGRESQL_EXECUTABLE} -bundle")
+ENDIF(APPLE)
\ No newline at end of file
diff --git a/core/src/astar.c b/core/src/astar.c
index 138c763..d3be2d4 100644
--- a/core/src/astar.c
+++ b/core/src/astar.c
@@ -21,6 +21,7 @@
#include "postgres.h"
#include "executor/spi.h"
+#include "catalog/pg_type.h"
#include "funcapi.h"
#include "catalog/pg_type.h"
diff --git a/core/src/dijkstra.c b/core/src/dijkstra.c
index e35124d..902c856 100644
--- a/core/src/dijkstra.c
+++ b/core/src/dijkstra.c
@@ -21,6 +21,7 @@
#include "postgres.h"
#include "executor/spi.h"
+#include "catalog/pg_type.h"
#include "funcapi.h"
#include "catalog/pg_type.h"
diff --git a/core/src/edge_visitors.hpp b/core/src/edge_visitors.hpp
index 45e37ee..fc44252 100644
--- a/core/src/edge_visitors.hpp
+++ b/core/src/edge_visitors.hpp
@@ -3,10 +3,10 @@
#include <iosfwd>
#include <boost/config.hpp>
-#include <boost/property_map.hpp>
+#include <boost/property_map/property_map.hpp>
#include <boost/graph/graph_traits.hpp>
#include <boost/limits.hpp>
-#include <boost/graph/detail/is_same.hpp>
+#include <boost/type_traits/is_same.hpp>
namespace boost
{
diff --git a/core/src/shooting_star.c b/core/src/shooting_star.c
index eaeded2..5d5f19a 100644
--- a/core/src/shooting_star.c
+++ b/core/src/shooting_star.c
@@ -21,6 +21,7 @@
#include "postgres.h"
#include "executor/spi.h"
+#include "catalog/pg_type.h"
#include "funcapi.h"
#include "catalog/pg_type.h"
diff --git a/core/src/shooting_star_boost_wrapper.cpp b/core/src/shooting_star_boost_wrapper.cpp
index 55c8e38..bf28713 100644
--- a/core/src/shooting_star_boost_wrapper.cpp
+++ b/core/src/shooting_star_boost_wrapper.cpp
@@ -23,7 +23,7 @@
#include <boost/graph/graph_traits.hpp>
#include <boost/graph/adjacency_list.hpp>
-#include <boost/vector_property_map.hpp>
+#include <boost/property_map/vector_property_map.hpp>
#include <shooting_star_search.hpp>
#include "shooting_star.h"
diff --git a/core/src/shooting_star_relax.hpp b/core/src/shooting_star_relax.hpp
index 8e65be6..95b222e 100644
--- a/core/src/shooting_star_relax.hpp
+++ b/core/src/shooting_star_relax.hpp
@@ -15,7 +15,7 @@
#include <functional>
#include <boost/limits.hpp> // for numeric limits
#include <boost/graph/graph_traits.hpp>
-#include <boost/property_map.hpp>
+#include <boost/property_map/property_map.hpp>
#include <postgres.h>
diff --git a/extra/driving_distance/src/alpha.c b/extra/driving_distance/src/alpha.c
index 301e0e4..0da9f4c 100644
--- a/extra/driving_distance/src/alpha.c
+++ b/extra/driving_distance/src/alpha.c
@@ -22,6 +22,7 @@
#include "postgres.h"
#include "executor/spi.h"
+#include "catalog/pg_type.h"
#include "funcapi.h"
#include "catalog/pg_type.h"
diff --git a/extra/driving_distance/src/drivedist.c b/extra/driving_distance/src/drivedist.c
index d0324bd..d7cbc45 100644
--- a/extra/driving_distance/src/drivedist.c
+++ b/extra/driving_distance/src/drivedist.c
@@ -21,6 +21,7 @@
#include "postgres.h"
#include "executor/spi.h"
+#include "catalog/pg_type.h"
#include "funcapi.h"
#include "catalog/pg_type.h"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment