Commit 154ef865 authored by Tiago Peixoto's avatar Tiago Peixoto

Relax boost version requirements

This allows compilation with older versions of boost (>=1.38), which in
some sistems are the only option. This commit also removes the linking
of the boost_graph shared library, since none of its symbols are
actually required.
parent 5c3c3ae8
......@@ -156,7 +156,7 @@ AC_PYTHON_DEVEL([2.5])
[LDFLAGS="${LDFLAGS} ${PYTHON_LDFLAGS}"]
dnl boost
AX_BOOST_BASE([1.40.0])
AX_BOOST_BASE([1.38.0])
AX_BOOST_PYTHON
if test "$BOOST_PYTHON_LIB" = ""; then
AC_MSG_ERROR([No usable boost::python found])
......@@ -169,10 +169,12 @@ AX_BOOST_REGEX
if test "$BOOST_REGEX_LIB" = ""; then
AC_MSG_ERROR([No usable boost::regex found])
fi
AX_BOOST_GRAPH
if test "$BOOST_GRAPH_LIB" = ""; then
AC_MSG_ERROR([No usable boost::graph found])
fi
[CPPFLAGS="${CPPFLAGS} ${BOOST_CPPFLAGS}"]
dnl CGAL
......@@ -292,7 +294,7 @@ AC_SUBST(MOD_DIR)
# default LIBADD flags for submodules
[MOD_LIBADD="${PYTHON_LDFLAGS} ${BOOST_IOSTREAMS_LIB} -l${BOOST_PYTHON_LIB} \
${BOOST_REGEX_LIB} -l${BOOST_GRAPH_LIB} ${OPENMP_LDFLAGS} -lexpat"]
${BOOST_REGEX_LIB} ${OPENMP_LDFLAGS} -lexpat"]
AC_SUBST(MOD_LIBADD)
# needed for typeinfo objects to work across DSO boundaries.
......
......@@ -22,10 +22,16 @@
#include <boost/type_traits/is_convertible.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/mpl/if.hpp>
#include <boost/property_map/property_map.hpp>
#include <boost/version.hpp>
#if (BOOST_VERSION >= 104000)
# include <boost/property_map/property_map.hpp>
# include <boost/property_map/vector_property_map.hpp>
#else
# include <boost/property_map.hpp>
# include <boost/vector_property_map.hpp>
#endif
#include <boost/graph/named_function_params.hpp>
#include <algorithm>
#include <boost/property_map/vector_property_map.hpp>
namespace boost {
......
......@@ -44,7 +44,12 @@
#include <boost/config.hpp>
#include <vector>
#include <boost/graph/graph_traits.hpp>
#include <boost/property_map/property_map.hpp>
#include <boost/version.hpp>
#if (BOOST_VERSION >= 104000)
# include <boost/property_map/property_map.hpp>
#else
# include <boost/property_map.hpp>
#endif
#include <boost/graph/named_function_params.hpp>
#include <boost/graph/breadth_first_search.hpp>
#include <boost/type_traits/conversion_traits.hpp>
......
// Copyright 2004-9 Trustees of Indiana University
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// read_graphviz_new.hpp -
// Initialize a model of the BGL's MutableGraph concept and an associated
// collection of property maps using a graph expressed in the GraphViz
// DOT Language.
//
// Based on the grammar found at:
// http://www.graphviz.org/cvs/doc/info/lang.html
//
// Jeremiah rewrite used grammar found at:
// http://www.graphviz.org/doc/info/lang.html
// and page 34 or http://www.graphviz.org/pdf/dotguide.pdf
//
// See documentation for this code at:
// http://www.boost.org/libs/graph/doc/read-graphviz.html
//
// Author: Jeremiah Willcock
// Ronald Garcia
//
#ifndef BOOST_READ_GRAPHVIZ_NEW_HPP
#define BOOST_READ_GRAPHVIZ_NEW_HPP
#include <boost/ref.hpp>
#if (BOOST_VERSION >= 104000)
# include <boost/property_map/dynamic_property_map.hpp>
#else
# include <boost/dynamic_property_map.hpp>
#endif
#include <boost/graph/graph_traits.hpp>
#include <boost/detail/workaround.hpp>
#include <algorithm>
#include <string>
#include <vector>
#include <set>
#include <utility>
#include <map>
#include <iostream>
#include <cstdlib>
namespace boost {
namespace read_graphviz_detail {
typedef std::string node_name;
typedef std::string subgraph_name;
typedef std::map<std::string, std::string> properties;
struct node_and_port {
node_name name;
std::string angle; // Or empty if no angle
std::vector<std::string> location; // Up to two identifiers
friend inline bool operator==(const node_and_port& a, const node_and_port& b) {
return a.name == b.name &&
a.angle == b.angle &&
a.location == b.location;
}
friend inline bool operator<(const node_and_port& a, const node_and_port& b) {
if (a.name != b.name) return a.name < b.name;
if (a.angle != b.angle) return a.angle < b.angle;
return a.location < b.location;
}
};
struct edge_info {
node_and_port source;
node_and_port target;
properties props;
};
struct parser_result {
bool graph_is_directed;
bool graph_is_strict;
std::map<node_name, properties> nodes; // Global set
std::vector<edge_info> edges;
std::map<subgraph_name, properties> graph_props; // Root and subgraphs
};
// The actual parser, from libs/graph/src/read_graphviz_new.cpp
void parse_graphviz_from_string(const std::string& str, parser_result& result, bool want_directed);
// Translate from those results to a graph
void translate_results_to_graph(const parser_result& r, ::boost::detail::graph::mutate_graph* mg);
} // namespace read_graphviz_detail
// This is also in boost/graph/graphviz.hpp
namespace detail {
namespace graph {
BOOST_GRAPH_DECL bool read_graphviz(const std::string& str, boost::detail::graph::mutate_graph* mg);
} // end namespace graph
} // end namespace detail
template <typename MutableGraph>
bool read_graphviz(const std::string& str,
MutableGraph& graph, boost::dynamic_properties& dp,
std::string const& node_id = "node_id") {
boost::detail::graph::mutate_graph_impl<MutableGraph> mg(graph, dp, node_id);
return detail::graph::read_graphviz(str, &mg);
}
template <typename InputIter, typename MutableGraph>
bool read_graphviz(InputIter begin, InputIter end,
MutableGraph& graph, boost::dynamic_properties& dp,
std::string const& node_id = "node_id") {
return read_graphviz(std::string(begin, end), graph, dp, node_id);
}
} // namespace boost
#endif // BOOST_READ_GRAPHVIZ_NEW_HPP
This diff is collapsed.
......@@ -33,6 +33,8 @@ libgraph_tool_core_la_SOURCES = \
read_graphviz_new.cpp\
../boost-workaround/boost/graph/filtered_graph.hpp\
../boost-workaround/boost/graph/graphml.hpp\
../boost-workaround/boost/graph/graphviz.hpp\
../boost-workaround/boost/graph/detail/read_graphviz_new.hpp\
../boost-workaround/boost/graph/betweenness_centrality.hpp\
../boost-workaround/boost/graph/copy.hpp\
../boost-workaround/boost/graph/overloading.hpp\
......
......@@ -32,7 +32,12 @@
#ifndef FAST_VECTOR_PROPERTY_MAP_HH
#define FAST_VECTOR_PROPERTY_MAP_HH
#include <boost/property_map/property_map.hpp>
#include <boost/version.hpp>
#if (BOOST_VERSION >= 104000)
# include <boost/property_map/property_map.hpp>
#else
# include <boost/property_map.hpp>
#endif
#include <boost/shared_ptr.hpp>
#include <vector>
......
......@@ -369,7 +369,7 @@ private:
Graph& _g;
EdgeIndexMap _edge_index;
vector<typename graph_traits<Graph>::vertex_descriptor> _vertices;
vector_property_map<bool, EdgeIndexMap> _edge_is_new;
checked_vector_property_map<bool, EdgeIndexMap> _edge_is_new;
rng_t& _rng;
};
......@@ -456,7 +456,7 @@ public:
private:
Graph& _g;
EdgeIndexMap _edge_index;
vector_property_map<bool, EdgeIndexMap> _edge_is_new;
checked_vector_property_map<bool, EdgeIndexMap> _edge_is_new;
rng_t& _rng;
};
......
......@@ -24,8 +24,14 @@
#include <tr1/memory>
#include <boost/python/object.hpp>
#include <boost/property_map/property_map.hpp>
#include <boost/property_map/dynamic_property_map.hpp>
#include <boost/version.hpp>
#if (BOOST_VERSION >= 104000)
# include <boost/property_map/property_map.hpp>
# include <boost/property_map/dynamic_property_map.hpp>
#else
# include <boost/property_map.hpp>
# include <boost/dynamic_property_map.hpp>
#endif
#include "fast_vector_property_map.hh"
#include <boost/functional/hash.hpp>
#include <boost/mpl/vector.hpp>
......
......@@ -27,7 +27,12 @@
#include <boost/ref.hpp>
#include <boost/function/function2.hpp>
#include <boost/property_map/dynamic_property_map.hpp>
#include <boost/version.hpp>
#if (BOOST_VERSION >= 104000)
# include <boost/property_map/dynamic_property_map.hpp>
#else
# include <boost/dynamic_property_map.hpp>
#endif
#include <boost/graph/graph_traits.hpp>
#include <boost/detail/workaround.hpp>
#include <boost/algorithm/string/case_conv.hpp>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment