Commit 2f34c05c authored by Simon de Givry's avatar Simon de Givry Committed by Thomas Schiex
Browse files

[error] compilation issue with LZMA on old Boost versions

parent f7c4dac4
......@@ -7,7 +7,7 @@ SET (source_files ${source_files} ${boost_file})
# boost detection
MESSAGE(STATUS "- boost flag on .")
find_package(Boost 1.65.0 REQUIRED COMPONENTS graph iostreams)
find_package(Boost 1.34.0 REQUIRED COMPONENTS graph iostreams)
#find_package(ZLIB)
MESSAGE(STATUS " Boost_INCLUDE_DIRS: ${Boost_INCLUDE_DIRS}")
......
SET(CPACK_PACKAGE_VERSION "1.0.0")
SET(CPACK_NSIS_DISPLAY_NAME "toulbar2 1.0.0")
SET(CPACK_NSIS_PACKAGE_NAME "toulbar2 1.0.0")
SET(CPACK_PACKAGE_FILE_NAME "toulbar2-1.0.0-x86_64")
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "toulbar2 1.0.0")
SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "toulbar2 1.0.0")
SET(CPACK_PACKAGE_VERSION "1.0.1")
SET(CPACK_NSIS_DISPLAY_NAME "toulbar2 1.0.1")
SET(CPACK_NSIS_PACKAGE_NAME "toulbar2 1.0.1")
SET(CPACK_PACKAGE_FILE_NAME "toulbar2-1.0.1-x86_64")
SET(CPACK_PACKAGE_INSTALL_DIRECTORY "toulbar2 1.0.1")
SET(CPACK_PACKAGE_INSTALL_REGISTRY_KEY "toulbar2 1.0.1")
SET(CPACK_PACKAGE_VERSION_MAJOR "1")
SET(CPACK_PACKAGE_VERSION_MINOR "0")
SET(CPACK_PACKAGE_VERSION_PATCH "0")
SET(CPACK_PACKAGE_VERSION_PATCH "1")
// Cmake generated version
#define Toulbar_VERSION "1.0.0-134-g1f3e9e6-master-tainted (1544195635)"
#define Toulbar_VERSION "1.0.1-2-g5263a9d-master-tainted (1544259913)"
......@@ -13,6 +13,20 @@
#include "core/tb2globaldecomposable.hpp"
#include "core/tb2clqcover.hpp"
#ifdef BOOST
#include <boost/version.hpp>
#include <boost/tokenizer.hpp>
#include <boost/iostreams/filtering_streambuf.hpp>
#include <boost/iostreams/copy.hpp>
#include <boost/iostreams/filter/gzip.hpp>
#if (BOOST_VERSION >= 106500)
#include <boost/iostreams/filter/lzma.hpp>
#endif
#include <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/compressed_pair.hpp>
#endif
typedef struct {
EnumeratedVariable* var;
vector<Cost> costs;
......@@ -2023,6 +2037,7 @@ Cost WCSP::read_wcsp(const char* fileName)
#endif
} else if (ToulBar2::cfn && ToulBar2::xz) {
#ifdef BOOST
#if (BOOST_VERSION >= 106500)
ifstream Rfile(fileName, std::ios_base::in | std::ios_base::binary);
istream& file = Rfile;
boost::iostreams::filtering_streambuf<boost::iostreams::input> inbuf;
......@@ -2039,6 +2054,10 @@ Cost WCSP::read_wcsp(const char* fileName)
CFNStreamReader fileReader(stream, this);
return getUb();
}
#else
cerr << "Error: compiling with Boost version 1.65 or higher is needed to allow to read xz compressed CFN format files." << endl;
exit(EXIT_FAILURE);
#endif
#else
cerr << "Error: compiling with Boost iostreams library is needed to allow to read xz compressed CFN format files." << endl;
exit(EXIT_FAILURE);
......@@ -2121,10 +2140,16 @@ Cost WCSP::read_wcsp(const char* fileName)
ifstream rfile(fileName, (ToulBar2::gz || ToulBar2::xz) ? (std::ios_base::in | std::ios_base::binary) : (std::ios_base::in));
#ifdef BOOST
boost::iostreams::filtering_streambuf<boost::iostreams::input> zfile;
if (ToulBar2::gz)
if (ToulBar2::gz) {
zfile.push(boost::iostreams::gzip_decompressor());
else if (ToulBar2::xz)
} else if (ToulBar2::xz) {
#if (BOOST_VERSION >= 106500)
zfile.push(boost::iostreams::lzma_decompressor());
#else
cerr << "Error: compiling with Boost version 1.65 or higher is needed to allow to read xz compressed wcsp format files." << endl;
exit(EXIT_FAILURE);
#endif
}
zfile.push(rfile);
istream ifile(&zfile);
......@@ -2663,10 +2688,16 @@ void WCSP::read_uai2008(const char* fileName)
ifstream rfile(fileName, (ToulBar2::gz || ToulBar2::xz) ? (std::ios_base::in | std::ios_base::binary) : (std::ios_base::in));
#ifdef BOOST
boost::iostreams::filtering_streambuf<boost::iostreams::input> zfile;
if (ToulBar2::gz)
if (ToulBar2::gz) {
zfile.push(boost::iostreams::gzip_decompressor());
else if (ToulBar2::xz)
} else if (ToulBar2::xz) {
#if (BOOST_VERSION >= 106500)
zfile.push(boost::iostreams::lzma_decompressor());
#else
cerr << "Error: compiling with Boost version 1.65 or higher is needed to allow to read xz compressed uai/LG format files." << endl;
exit(EXIT_FAILURE);
#endif
}
zfile.push(rfile);
istream ifile(&zfile);
......@@ -3127,10 +3158,16 @@ void WCSP::read_wcnf(const char* fileName)
ifstream rfile(fileName, (ToulBar2::gz || ToulBar2::xz) ? (std::ios_base::in | std::ios_base::binary) : (std::ios_base::in));
#ifdef BOOST
boost::iostreams::filtering_streambuf<boost::iostreams::input> zfile;
if (ToulBar2::gz)
if (ToulBar2::gz) {
zfile.push(boost::iostreams::gzip_decompressor());
else if (ToulBar2::xz)
} else if (ToulBar2::xz) {
#if (BOOST_VERSION >= 106500)
zfile.push(boost::iostreams::lzma_decompressor());
#else
cerr << "Error: compiling with Boost version 1.65 or higher is needed to allow to read xz compressed cnf/wcnf format files." << endl;
exit(EXIT_FAILURE);
#endif
}
zfile.push(rfile);
istream ifile(&zfile);
......@@ -3326,10 +3363,16 @@ void WCSP::read_qpbo(const char* fileName)
ifstream rfile(fileName, (ToulBar2::gz || ToulBar2::xz) ? (std::ios_base::in | std::ios_base::binary) : (std::ios_base::in));
#ifdef BOOST
boost::iostreams::filtering_streambuf<boost::iostreams::input> zfile;
if (ToulBar2::gz)
if (ToulBar2::gz) {
zfile.push(boost::iostreams::gzip_decompressor());
else if (ToulBar2::xz)
} else if (ToulBar2::xz) {
#if (BOOST_VERSION >= 106500)
zfile.push(boost::iostreams::lzma_decompressor());
#else
cerr << "Error: compiling with Boost version 1.65 or higher is needed to allow to read xz compressed qpbo format files." << endl;
exit(EXIT_FAILURE);
#endif
}
zfile.push(rfile);
istream ifile(&zfile);
......
......@@ -38,17 +38,6 @@
#include <numeric>
using namespace std;
#ifdef BOOST
#include <boost/tokenizer.hpp>
#include <boost/iostreams/filtering_streambuf.hpp>
#include <boost/iostreams/copy.hpp>
#include <boost/iostreams/filter/gzip.hpp>
#include <boost/iostreams/filter/lzma.hpp>
#include <boost/algorithm/string.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/compressed_pair.hpp>
#endif
#ifdef NDEBUG
#define DEBONLY(x)
#else
......
......@@ -12,6 +12,7 @@
#include "tb2localsearch.hpp"
#include <boost/version.hpp>
#include <boost/tokenizer.hpp>
#include <boost/graph/graph_traits.hpp>
#include <boost/graph/adjacency_list.hpp>
......@@ -19,9 +20,6 @@
#include <boost/graph/kruskal_min_spanning_tree.hpp>
#include <boost/graph/connected_components.hpp>
//TODO: is it need for other versions???
#define BOOSTGRAPH134
/**
* Basic structure
*/
......@@ -50,7 +48,7 @@ typedef boost::graph_traits<TCDGraph>::vertex_descriptor TDCluster;
typedef boost::graph_traits<TCDGraph>::edge_descriptor Cluster_edge;
typedef set<int> zone;
#ifdef BOOSTGRAPH134
#if (BOOST_VERSION >= 103400)
namespace boost {
inline bool operator<(const Cluster_edge& __x, const Cluster_edge& __y)
{
......
Supports Markdown
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