add a new dependencies: google/glog; Cleanup Makefile.local
This commit is contained in:
@@ -21,7 +21,6 @@ BASE_LIB_OBJS = \
|
||||
$(OBJ_DIR)/base/file.$O \
|
||||
$(OBJ_DIR)/base/filelinereader.$O \
|
||||
$(OBJ_DIR)/base/join.$O \
|
||||
$(OBJ_DIR)/base/logging.$O \
|
||||
$(OBJ_DIR)/base/mutex.$O \
|
||||
$(OBJ_DIR)/base/numbers.$O \
|
||||
$(OBJ_DIR)/base/random.$O \
|
||||
@@ -3241,4 +3240,3 @@ $(GEN_DIR)/ortools/constraint_solver/solver_parameters.pb.h: $(GEN_DIR)/ortools/
|
||||
|
||||
$(OBJ_DIR)/constraint_solver/solver_parameters.pb.$O: $(GEN_DIR)/ortools/constraint_solver/solver_parameters.pb.cc
|
||||
$(CCC) $(CFLAGS) -c $(GEN_DIR)/ortools/constraint_solver/solver_parameters.pb.cc $(OBJ_OUT)$(OBJ_DIR)$Sconstraint_solver$Ssolver_parameters.pb.$O
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
GFLAGS_TAG = 2.2.0
|
||||
PROTOBUF_TAG = 3.2.0
|
||||
GLOG_TAG = 0.3.5
|
||||
CBC_TAG = 2.9.8
|
||||
SWIG_TAG = 3.0.12
|
||||
PCRE_TAG = 8.37
|
||||
@@ -70,6 +71,7 @@ install_third_party: \
|
||||
missing_directories \
|
||||
install_gflags \
|
||||
install_protobuf \
|
||||
install_glog \
|
||||
install_swig \
|
||||
install_cbc \
|
||||
$(CSHARP_THIRD_PARTY)
|
||||
@@ -205,6 +207,18 @@ dependencies/sources/protobuf-$(PROTOBUF_TAG)/configure: dependencies/sources/pr
|
||||
dependencies/sources/protobuf-$(PROTOBUF_TAG)/autogen.sh:
|
||||
git clone https://github.com/google/protobuf.git dependencies/sources/protobuf-$(PROTOBUF_TAG) && cd dependencies/sources/protobuf-$(PROTOBUF_TAG) && git checkout 3d9d1a1
|
||||
|
||||
# Install GLOG.
|
||||
install_glog: dependencies/install/include/glog/logging.h
|
||||
|
||||
dependencies/install/include/glog/logging.h: dependencies/sources/glog-$(GLOG_TAG)/Makefile $(ACLOCAL_TARGET)
|
||||
cd dependencies/sources/glog-$(GLOG_TAG) && $(SET_PATH) $(SET_COMPILER) make install
|
||||
|
||||
dependencies/sources/glog-$(GLOG_TAG)/Makefile: dependencies/sources/glog-$(GLOG_TAG)/Makefile.in $(ACLOCAL_TARGET) install_gflags
|
||||
cd dependencies/sources/glog-$(GLOG_TAG) && $(SET_PATH) $(SET_COMPILER) ./configure --prefix=$(OR_ROOT_FULL)/dependencies/install --enable-static --enable-shared --with-pic ADD_CXXFLAGS="$(MAC_VERSION)" --with-gflags=$(OR_TOOLS_TOP)/dependencies/install
|
||||
|
||||
dependencies/sources/glog-$(GLOG_TAG)/Makefile.in:
|
||||
git clone -b v$(GLOG_TAG) https://github.com/google/glog.git dependencies/sources/glog-$(CBC_TAG)
|
||||
|
||||
# Install Coin CBC.
|
||||
install_cbc: dependencies/install/bin/cbc
|
||||
|
||||
@@ -365,8 +379,6 @@ Makefile.local: makefiles/Makefile.third_party.unix.mk
|
||||
@echo "# Define UNIX_GUROBI_DIR and GUROBI_LIB_VERSION to use Gurobi" >> Makefile.local
|
||||
@echo "# Define UNIX_CPLEX_DIR to use CPLEX" >> Makefile.local
|
||||
@echo >> Makefile.local
|
||||
@echo UNIX_GFLAGS_DIR = $(OR_ROOT_FULL)/dependencies/install>> Makefile.local
|
||||
@echo UNIX_PROTOBUF_DIR = $(OR_ROOT_FULL)/dependencies/install>> Makefile.local
|
||||
@echo UNIX_SWIG_BINARY = $(OR_ROOT_FULL)/dependencies/install/bin/swig>> Makefile.local
|
||||
@echo UNIX_CLP_DIR = $(OR_ROOT_FULL)/dependencies/install>> Makefile.local
|
||||
@echo UNIX_CBC_DIR = $(OR_ROOT_FULL)/dependencies/install>> Makefile.local
|
||||
@echo "# Define UNIX_GFLAGS_DIR, UNIX_PROTOBUF_DIR, UNIX_GLOG_DIR," >> Makefile.local
|
||||
@echo "# UNIX_SWIG_BINARY, UNIX_CLP_DIR, UNIX_CBC_DIR if you wish to use " >> Makefile.local
|
||||
@echo "# a custom version" >> Makefile.local
|
||||
|
||||
@@ -2,6 +2,33 @@
|
||||
# ----- configuration is not standard. In that case, please tell us -----
|
||||
# ----- about it. -----
|
||||
|
||||
# Checks if the user has overwritten default libraries and binaries.
|
||||
|
||||
ifndef UNIX_GFLAGS_DIR
|
||||
UNIX_GFLAGS_DIR = $(OR_TOOLS_TOP)/dependencies/install
|
||||
endif
|
||||
|
||||
ifndef UNIX_PROTOBUF_DIR
|
||||
UNIX_PROTOBUF_DIR = $(OR_TOOLS_TOP)/dependencies/install
|
||||
endif
|
||||
|
||||
ifndef UNIX_GLOG_DIR
|
||||
UNIX_GLOG_DIR = $(OR_TOOLS_TOP)/dependencies/install
|
||||
endif
|
||||
|
||||
ifndef UNIX_SWIG_BINARY
|
||||
UNIX_SWIG_BINARY = $(OR_ROOT_FULL)/dependencies/install/bin/swig
|
||||
endif
|
||||
|
||||
ifndef UNIX_CBC_DIR
|
||||
UNIX_CBC_DIR = $(OR_ROOT_FULL)/dependencies/install
|
||||
endif
|
||||
|
||||
ifndef UNIX_CLP_DIR
|
||||
UNIX_CLP_DIR = $(OR_ROOT_FULL)/dependencies/install
|
||||
endif
|
||||
|
||||
|
||||
# Unix specific definitions
|
||||
PROTOBUF_DIR = $(UNIX_PROTOBUF_DIR)
|
||||
SWIG_BINARY = $(UNIX_SWIG_BINARY)
|
||||
@@ -61,7 +88,7 @@ GFLAGS_INC = -I$(UNIX_GFLAGS_DIR)/include
|
||||
# This is needed to find protocol buffers.
|
||||
PROTOBUF_INC = -I$(UNIX_PROTOBUF_DIR)/include
|
||||
# This is needed to find sparse hash containers.
|
||||
SPARSEHASH_INC = -I$(UNIX_SPARSEHASH_DIR)/include
|
||||
GLOG_INC = -I$(UNIX_GLOG_DIR)/include
|
||||
|
||||
# Define UNIX_CLP_DIR if unset and if UNIX_CBC_DIR is set.
|
||||
ifdef UNIX_CBC_DIR
|
||||
@@ -134,6 +161,9 @@ ifeq ($(PLATFORM),LINUX)
|
||||
ZLIB_LNK = -lz
|
||||
# This is needed to find libprotobuf.a
|
||||
PROTOBUF_LNK = $(UNIX_PROTOBUF_DIR)/lib/libprotobuf.a
|
||||
# This is needed to find libglog.a
|
||||
GLOG_LNK = $(UNIX_GLOG_DIR)/lib/libglog.a
|
||||
|
||||
ifdef UNIX_GLPK_DIR
|
||||
GLPK_LNK = $(UNIX_GLPK_DIR)/lib/libglpk.a
|
||||
endif
|
||||
@@ -197,6 +227,8 @@ ifeq ($(PLATFORM),MACOSX)
|
||||
GFLAGS_LNK = $(UNIX_GFLAGS_DIR)/lib/libgflags.a
|
||||
ZLIB_LNK = -lz
|
||||
PROTOBUF_LNK = $(UNIX_PROTOBUF_DIR)/lib/libprotobuf.a
|
||||
GLOG_LNK = $(UNIX_GLOG_DIR)/lib/libglog.a
|
||||
|
||||
ARCH = -DARCH_K8
|
||||
SYS_LNK =
|
||||
|
||||
@@ -235,9 +267,9 @@ endif # MAC OS X
|
||||
|
||||
CFLAGS = $(DEBUG) -I$(INC_DIR) -I$(EX_DIR) -I$(GEN_DIR) $(GFLAGS_INC) $(ARCH) \
|
||||
-Wno-deprecated $(PROTOBUF_INC) $(CBC_INC) $(CLP_INC) $(GLPK_INC) \
|
||||
$(SCIP_INC) $(GUROBI_INC) $(CPLEX_INC) -DUSE_GLOP -DUSE_BOP $(SPARSEHASH_INC)
|
||||
$(SCIP_INC) $(GUROBI_INC) $(CPLEX_INC) -DUSE_GLOP -DUSE_BOP $(GLOG_INC)
|
||||
|
||||
JNIFLAGS = $(JNIDEBUG) -I$(INC_DIR) -I$(EX_DIR) -I$(GEN_DIR) $(GFLAGS_INC) $(ARCH) \
|
||||
-Wno-deprecated $(PROTOBUF_INC) $(CBC_INC) $(CLP_INC) $(GLPK_INC) $(SCIP_INC) $(GUROBI_INC) $(CPLEX_INC) -DUSE_GLOP -DUSE_BOP
|
||||
DEPENDENCIES_LNK = $(GLPK_LNK) $(CBC_LNK) $(CLP_LNK) $(SCIP_LNK) $(LM_LNK) $(GUROBI_LNK) $(CPLEX_LNK) $(GFLAGS_LNK) $(PROTOBUF_LNK)
|
||||
DEPENDENCIES_LNK = $(GLPK_LNK) $(CBC_LNK) $(CLP_LNK) $(SCIP_LNK) $(LM_LNK) $(GUROBI_LNK) $(CPLEX_LNK) $(GFLAGS_LNK) $(PROTOBUF_LNK) $(GLOG_LNK)
|
||||
OR_TOOLS_LD_FLAGS = $(ZLIB_LNK) $(SYS_LNK)
|
||||
|
||||
@@ -15,158 +15,9 @@
|
||||
#define OR_TOOLS_BASE_LOGGING_H_
|
||||
|
||||
#include <cassert>
|
||||
#include <cstdlib>
|
||||
#include <iostream> // NOLINT
|
||||
#include "ortools/base/commandlineflags.h"
|
||||
|
||||
#include "glog/logging.h"
|
||||
#include "ortools/base/integral_types.h"
|
||||
#include "ortools/base/macros.h"
|
||||
|
||||
DECLARE_int32(log_level);
|
||||
DECLARE_bool(log_prefix);
|
||||
|
||||
#if defined(_MSC_VER)
|
||||
#pragma warning(disable : 4722)
|
||||
#endif
|
||||
|
||||
// Always-on checking
|
||||
#define CHECK(x) \
|
||||
if (!(x)) \
|
||||
LogMessageFatal(__FILE__, __LINE__).stream() << "Check " \
|
||||
"failed: " #x
|
||||
#define CHECK_LT(x, y) CHECK((x) < (y))
|
||||
#define CHECK_GT(x, y) CHECK((x) > (y))
|
||||
#define CHECK_LE(x, y) CHECK((x) <= (y))
|
||||
#define CHECK_GE(x, y) CHECK((x) >= (y))
|
||||
#define CHECK_EQ(x, y) CHECK((x) == (y))
|
||||
#define CHECK_NE(x, y) CHECK((x) != (y))
|
||||
|
||||
// Debug-only checking.
|
||||
#ifdef NDEBUG
|
||||
#define DCHECK(x) \
|
||||
while (false) CHECK(x)
|
||||
#define DCHECK_LT(x, y) \
|
||||
while (false) CHECK((x) < (y))
|
||||
#define DCHECK_GT(x, y) \
|
||||
while (false) CHECK((x) > (y))
|
||||
#define DCHECK_LE(x, y) \
|
||||
while (false) CHECK((x) <= (y))
|
||||
#define DCHECK_GE(x, y) \
|
||||
while (false) CHECK((x) >= (y))
|
||||
#define DCHECK_EQ(x, y) \
|
||||
while (false) CHECK((x) == (y))
|
||||
#define DCHECK_NE(x, y) \
|
||||
while (false) CHECK((x) != (y))
|
||||
#else
|
||||
#define DCHECK(x) CHECK(x)
|
||||
#define DCHECK_LT(x, y) CHECK((x) < (y))
|
||||
#define DCHECK_GT(x, y) CHECK((x) > (y))
|
||||
#define DCHECK_LE(x, y) CHECK((x) <= (y))
|
||||
#define DCHECK_GE(x, y) CHECK((x) >= (y))
|
||||
#define DCHECK_EQ(x, y) CHECK((x) == (y))
|
||||
#define DCHECK_NE(x, y) CHECK((x) != (y))
|
||||
#endif // NDEBUG
|
||||
|
||||
#define LOG_INFO LogMessage(__FILE__, __LINE__)
|
||||
#define LOG_ERROR LOG_INFO
|
||||
#define LOG_WARNING LOG_INFO
|
||||
#define LOG_FATAL LogMessageFatal(__FILE__, __LINE__)
|
||||
#define LOG_QFATAL LOG_FATAL
|
||||
|
||||
#define VLOG(x) \
|
||||
if ((x) <= FLAGS_log_level) LOG_INFO.stream()
|
||||
|
||||
#define VLOG_IS_ON(x) ((x) <= FLAGS_log_level)
|
||||
|
||||
#define LOG(severity) LOG_##severity.stream()
|
||||
#define LG LOG_INFO.stream()
|
||||
#define LOG_IF(severity, condition) \
|
||||
!(condition) ? (void)0 : LogMessageVoidify() & LOG(severity)
|
||||
|
||||
#ifdef NDEBUG
|
||||
#define LOG_DFATAL LOG_ERROR
|
||||
#define DFATAL ERROR
|
||||
#define DLOG(severity) true ? (void)0 : LogMessageVoidify() & LOG(severity)
|
||||
#define DLOG_IF(severity, condition) \
|
||||
(true || !(condition)) ? (void)0 : LogMessageVoidify() & LOG(severity)
|
||||
#define DVLOG(x) \
|
||||
while (false && VLOG_IS_ON(x)) LogMessageVoidify() & LOG_INFO.stream()
|
||||
#else
|
||||
#define LOG_DFATAL LOG_FATAL
|
||||
#define DFATAL FATAL
|
||||
#define DLOG(severity) LOG(severity)
|
||||
#define DLOG_IF(severity, condition) LOG_IF(severity, condition)
|
||||
#define DVLOG VLOG
|
||||
#endif
|
||||
|
||||
// Poor man version of LOG_EVERY_N
|
||||
#define LOG_EVERY_N(severity, n) LOG(severity)
|
||||
#define LOG_EVERY_N_SEC(severity, n) LOG(severity)
|
||||
|
||||
namespace operations_research {
|
||||
class DateLogger {
|
||||
public:
|
||||
DateLogger();
|
||||
char* const HumanDate();
|
||||
|
||||
private:
|
||||
char buffer_[9];
|
||||
};
|
||||
} // namespace operations_research
|
||||
|
||||
class LogMessage {
|
||||
public:
|
||||
LogMessage(const char* file, int line)
|
||||
:
|
||||
#ifdef __ANDROID__
|
||||
log_stream_(std::cout)
|
||||
#else
|
||||
log_stream_(std::cerr)
|
||||
#endif
|
||||
{
|
||||
if (FLAGS_log_prefix) {
|
||||
log_stream_ << "[" << pretty_date_.HumanDate() << "] " << file << ":"
|
||||
<< line << ": ";
|
||||
}
|
||||
}
|
||||
~LogMessage() { log_stream_ << "\n"; }
|
||||
std::ostream& stream() { return log_stream_; }
|
||||
|
||||
protected:
|
||||
std::ostream& log_stream_;
|
||||
|
||||
private:
|
||||
operations_research::DateLogger pretty_date_;
|
||||
DISALLOW_COPY_AND_ASSIGN(LogMessage);
|
||||
};
|
||||
|
||||
class LogMessageFatal : public LogMessage {
|
||||
public:
|
||||
LogMessageFatal(const char* file, int line) : LogMessage(file, line) {}
|
||||
~LogMessageFatal() {
|
||||
log_stream_ << "\n";
|
||||
abort();
|
||||
}
|
||||
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(LogMessageFatal);
|
||||
};
|
||||
|
||||
// This class is used to explicitly ignore values in the conditional
|
||||
// logging macros. This avoids compiler warnings like "value computed
|
||||
// is not used" and "statement has no effect".
|
||||
class LogMessageVoidify {
|
||||
public:
|
||||
LogMessageVoidify() {}
|
||||
// This has to be an operator with a precedence lower than << but
|
||||
// higher than "?:". See its usage.
|
||||
void operator&(std::ostream&) {}
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
T&& CheckNotNull(T&& t) {
|
||||
CHECK(t != nullptr);
|
||||
return std::forward<T>(t);
|
||||
}
|
||||
#define CHECK_NOTNULL(x) CheckNotNull((x))
|
||||
|
||||
#endif // OR_TOOLS_BASE_LOGGING_H_
|
||||
|
||||
@@ -681,9 +681,9 @@ bool RevisedSimplex::InitializeMatrixAndTestIfUnchanged(
|
||||
const LinearProgram& lp, bool* only_change_is_new_rows,
|
||||
bool* only_change_is_new_cols, ColIndex* num_new_cols) {
|
||||
SCOPED_TIME_STAT(&function_stats_);
|
||||
DCHECK_NE(only_change_is_new_rows, nullptr);
|
||||
DCHECK_NE(only_change_is_new_cols, nullptr);
|
||||
DCHECK_NE(num_new_cols, nullptr);
|
||||
DCHECK(only_change_is_new_rows != nullptr);
|
||||
DCHECK(only_change_is_new_cols != nullptr);
|
||||
DCHECK(num_new_cols != nullptr);
|
||||
DCHECK_NE(kInvalidCol, lp.GetFirstSlackVariable());
|
||||
DCHECK_EQ(num_cols_, compact_matrix_.num_cols());
|
||||
DCHECK_EQ(num_rows_, compact_matrix_.num_rows());
|
||||
|
||||
@@ -618,10 +618,10 @@ void MPSolver::SolveWithProto(const MPModelRequest& model_request,
|
||||
std::string error_message;
|
||||
response->set_status(solver.LoadModelFromProto(model, &error_message));
|
||||
if (response->status() != MPSOLVER_MODEL_IS_VALID) {
|
||||
LOG_EVERY_N_SEC(WARNING, 1.0)
|
||||
<< "Loading model from protocol buffer failed, load status = "
|
||||
<< MPSolverResponseStatus_Name(response->status()) << " ("
|
||||
<< response->status() << "); Error: " << error_message;
|
||||
// LOG_EVERY_N_SEC(WARNING, 1.0)
|
||||
// << "Loading model from protocol buffer failed, load status = "
|
||||
// << MPSolverResponseStatus_Name(response->status()) << " ("
|
||||
// << response->status() << "); Error: " << error_message;
|
||||
return;
|
||||
}
|
||||
if (model_request.has_solver_time_limit_seconds()) {
|
||||
@@ -1606,4 +1606,3 @@ int MPSolverParameters::GetIntegerParam(MPSolverParameters::IntegerParam param)
|
||||
|
||||
|
||||
} // namespace operations_research
|
||||
|
||||
|
||||
Reference in New Issue
Block a user