Skip to content

Commit

Permalink
Remove the Boost_VERSION_MACRO define from C++
Browse files Browse the repository at this point in the history
Boost provides a header, <boost/version.hpp>, which provides a
BOOST_VERSION macro with the same semantics.

This change simplifies the build process and makes this project easier to
incorporate in other build systems.
  • Loading branch information
vslashg authored and cvvergara committed Oct 10, 2024
1 parent 084a843 commit 19bde3f
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 5 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ find_package(Boost ${BOOST_MINIMUM_VERSION} REQUIRED)
if (NOT Boost_VERSION_MACRO)
set(Boost_VERSION_MACRO ${Boost_VERSION})
endif()
add_definitions(-DBoost_VERSION_MACRO=${Boost_VERSION_MACRO})
set(BOOST_VERSION "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}")

include(CheckCCompilerFlag)
Expand Down
3 changes: 2 additions & 1 deletion include/coloring/pgr_edgeColoring.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

#include <boost/config.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/version.hpp>

#include "c_types/edge_t.h"
#include "c_types/ii_t_rt.h"
Expand All @@ -59,7 +60,7 @@ class Pgr_edgeColoring : public Pgr_messages {
Pgr_edgeColoring(Edge_t*, size_t);
Pgr_edgeColoring() = delete;

#if Boost_VERSION_MACRO >= 106800
#if BOOST_VERSION >= 106800
friend std::ostream& operator<<(std::ostream &, const Pgr_edgeColoring&);
#endif

Expand Down
3 changes: 2 additions & 1 deletion include/tsp/tsp.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.

#include <boost/config.hpp>
#include <boost/graph/adjacency_list.hpp>
#include <boost/version.hpp>

#include "c_types/iid_t_rt.h"
#include "c_types/coordinate_t.h"
Expand Down Expand Up @@ -77,7 +78,7 @@ class TSP : public Pgr_messages {
TSP(Coordinate_t *, size_t, bool);
TSP() = delete;

#if Boost_VERSION_MACRO >= 106800
#if BOOST_VERSION >= 106800
friend std::ostream& operator<<(std::ostream &, const TSP&);
#endif
bool has_vertex(int64_t id) const;
Expand Down
3 changes: 2 additions & 1 deletion src/alpha_shape/pgr_alphaShape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#include <boost/geometry/algorithms/num_points.hpp>
#include <boost/geometry/algorithms/append.hpp>
#include <boost/geometry/algorithms/area.hpp>
#if Boost_VERSION_MACRO >= 107500
#include <boost/version.hpp>
#if BOOST_VERSION >= 107500
# include <boost/geometry/strategies/strategies.hpp>
#else
# include <boost/geometry/strategies/agnostic/point_in_point.hpp>
Expand Down
3 changes: 2 additions & 1 deletion src/tsp/tsp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#include <boost/graph/connected_components.hpp>
#include <boost/graph/dijkstra_shortest_paths.hpp>
#include <boost/graph/graph_utility.hpp>
#include <boost/version.hpp>

#include "cpp_common/identifiers.hpp"
#include "cpp_common/pgr_messages.h"
Expand Down Expand Up @@ -510,7 +511,7 @@ TSP::get_edge_id(E e) const {



#if Boost_VERSION_MACRO >= 106800
#if BOOST_VERSION >= 106800
std::ostream& operator<<(std::ostream &log, const TSP& data) {
log << "Number of Vertices is:" << num_vertices(data.graph) << "\n";
log << "Number of Edges is:" << num_edges(data.graph) << "\n";
Expand Down

0 comments on commit 19bde3f

Please sign in to comment.