Add version info on python, java, .NET; add patch info on C++, #2861
This commit is contained in:
@@ -221,7 +221,7 @@ DEPENDENCIES_INC = -I$(INC_DIR) -I$(GEN_DIR) \
|
||||
-Wno-deprecated -DUSE_GLOP -DUSE_BOP \
|
||||
$(GLPK_INC) $(CPLEX_INC) $(XPRESS_INC)
|
||||
|
||||
CFLAGS = $(DEBUG) $(DEPENDENCIES_INC) -DOR_TOOLS_MAJOR=$(OR_TOOLS_MAJOR) -DOR_TOOLS_MINOR=$(OR_TOOLS_MINOR)
|
||||
CFLAGS = $(DEBUG) $(DEPENDENCIES_INC) -DOR_TOOLS_MAJOR=$(OR_TOOLS_MAJOR) -DOR_TOOLS_MINOR=$(OR_TOOLS_MINOR) -DOR_TOOLS_PATCH=$(GIT_REVISION)
|
||||
JNIFLAGS = $(JNIDEBUG) $(DEPENDENCIES_INC)
|
||||
LDFLAGS += $(ZLIB_LNK) $(SYS_LNK) $(LINK_FLAGS)
|
||||
DEPENDENCIES_LNK = $(GLPK_LNK) $(CPLEX_LNK) $(XPRESS_LNK)
|
||||
|
||||
@@ -144,7 +144,7 @@ DEPENDENCIES_INC = /I$(INC_DIR) /I$(GEN_DIR) \
|
||||
/DUSE_GLOP /DUSE_BOP \
|
||||
$(GLPK_INC) $(GUROBI_INC) $(CPLEX_INC) $(XPRESS_INC)
|
||||
|
||||
CFLAGS = $(DEBUG) $(DEPENDENCIES_INC) /DOR_TOOLS_MAJOR=$(OR_TOOLS_MAJOR) /DOR_TOOLS_MINOR=$(OR_TOOLS_MINOR)
|
||||
CFLAGS = $(DEBUG) $(DEPENDENCIES_INC) /DOR_TOOLS_MAJOR=$(OR_TOOLS_MAJOR) /DOR_TOOLS_MINOR=$(OR_TOOLS_MINOR) /DOR_TOOLS_PATCH=$(GIT_REVISION)
|
||||
JNIFLAGS=$(CFLAGS) $(DEPENDENCIES_INC)
|
||||
LDFLAGS =
|
||||
DEPENDENCIES_LNK = $(SYS_LNK) $(STATIC_GLPK_LNK) $(STATIC_CPLEX_LNK) $(STATIC_XPRESS_LNK)
|
||||
|
||||
@@ -39,8 +39,9 @@ cc_library(
|
||||
"vlog_is_on.h",
|
||||
],
|
||||
copts = [
|
||||
"-DOR_TOOLS_MAJOR=8",
|
||||
"-DOR_TOOLS_MAJOR=9",
|
||||
"-DOR_TOOLS_MINOR=1",
|
||||
"-DOR_TOOLS_PATCH=9999",
|
||||
],
|
||||
defines = select({
|
||||
"on_windows": ["OR_TOOLS_EXPORTS"],
|
||||
|
||||
@@ -12,7 +12,8 @@ set_target_properties(${NAME} PROPERTIES
|
||||
)
|
||||
target_compile_definitions(${NAME} PRIVATE
|
||||
-DOR_TOOLS_MAJOR=${PROJECT_VERSION_MAJOR}
|
||||
-DOR_TOOLS_MINOR=${PROJECT_VERSION_MINOR})
|
||||
-DOR_TOOLS_MINOR=${PROJECT_VERSION_MINOR}
|
||||
-DOR_TOOLS_PATCH=${PROJECT_VERSION_PATCH})
|
||||
if(MSVC)
|
||||
target_compile_definitions(${NAME} PRIVATE -DOR_TOOLS_EXPORTS)
|
||||
endif()
|
||||
|
||||
@@ -17,5 +17,6 @@ namespace operations_research {
|
||||
|
||||
int OrToolsMajorVersion() { return OR_TOOLS_MAJOR; }
|
||||
int OrToolsMinorVersion() { return OR_TOOLS_MINOR; }
|
||||
int OrToolsPatchVersion() { return OR_TOOLS_PATCH; }
|
||||
|
||||
} // namespace operations_research
|
||||
|
||||
@@ -18,6 +18,7 @@ namespace operations_research {
|
||||
|
||||
int OrToolsMajorVersion();
|
||||
int OrToolsMinorVersion();
|
||||
int OrToolsPatchVersion();
|
||||
|
||||
} // namespace operations_research
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ target_include_directories(${NAME} PRIVATE
|
||||
${PROJECT_BINARY_DIR})
|
||||
target_link_libraries(${NAME} PRIVATE
|
||||
absl::flags
|
||||
absl::strings
|
||||
protobuf::libprotobuf
|
||||
${PROJECT_NAME}::proto)
|
||||
#add_library(${PROJECT_NAME}::init ALIAS ${NAME})
|
||||
|
||||
@@ -39,6 +39,12 @@
|
||||
%unignore operations_research::CppBridge::SetFlags;
|
||||
%unignore operations_research::CppBridge::LoadGurobiSharedLibrary;
|
||||
|
||||
%unignore operations_research::OrToolsVersion;
|
||||
%unignore operations_research::OrToolsVersion::MajorNumber;
|
||||
%unignore operations_research::OrToolsVersion::MinorNumber;
|
||||
%unignore operations_research::OrToolsVersion::PatchNumber;
|
||||
%unignore operations_research::OrToolsVersion::VersionString;
|
||||
|
||||
%include "ortools/init/init.h"
|
||||
|
||||
%unignoreall
|
||||
%unignoreall
|
||||
|
||||
@@ -18,7 +18,9 @@
|
||||
#include <vector>
|
||||
|
||||
#include "absl/flags/flag.h"
|
||||
#include "absl/strings/str_cat.h"
|
||||
#include "ortools/base/logging.h"
|
||||
#include "ortools/base/version.h"
|
||||
#include "ortools/gurobi/environment.h"
|
||||
#include "ortools/sat/cp_model_solver.h"
|
||||
|
||||
@@ -124,6 +126,39 @@ class CppBridge {
|
||||
}
|
||||
};
|
||||
|
||||
class OrToolsVersion {
|
||||
public:
|
||||
/**
|
||||
* Returns the major version of OR-Tools.
|
||||
*/
|
||||
static int MajorNumber() {
|
||||
return ::operations_research::OrToolsMajorVersion();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the minor version of OR-Tools.
|
||||
*/
|
||||
static int MinorNumber() {
|
||||
return ::operations_research::OrToolsMinorVersion();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the patch version of OR-Tools.
|
||||
*/
|
||||
static int PatchNumber() {
|
||||
return ::operations_research::OrToolsPatchVersion();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the string version of OR-Tools.
|
||||
*/
|
||||
static std::string VersionString() {
|
||||
return absl::StrCat(::operations_research::OrToolsMajorVersion(), ".",
|
||||
::operations_research::OrToolsMinorVersion(), ".",
|
||||
::operations_research::OrToolsPatchVersion(), ".");
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace operations_research
|
||||
|
||||
#endif // OR_TOOLS_OPEN_SOURCE_INIT_INIT_H_
|
||||
|
||||
@@ -39,6 +39,12 @@
|
||||
%rename (setFlags) operations_research::CppBridge::SetFlags;
|
||||
%rename (logGurobiSharedLibrary) operations_research::CppBridge::LoadGurobiSharedLibrary;
|
||||
|
||||
%unignore operations_research::OrToolsVersion;
|
||||
%rename (getMajorNumber) operations_research::OrToolsVersion::MajorNumber;
|
||||
%rename (getMinorNumber) operations_research::OrToolsVersion::MinorNumber;
|
||||
%rename (getPatchNumber) operations_research::OrToolsVersion::PatchNumber;
|
||||
%rename (getVersionString) operations_research::OrToolsVersion::VersionString;
|
||||
|
||||
%include "ortools/init/init.h"
|
||||
|
||||
%unignoreall
|
||||
|
||||
@@ -39,6 +39,12 @@
|
||||
%unignore operations_research::CppBridge::SetFlags;
|
||||
%unignore operations_research::CppBridge::LoadGurobiSharedLibrary;
|
||||
|
||||
%unignore operations_research::OrToolsVersion;
|
||||
%unignore operations_research::OrToolsVersion::MajorNumber;
|
||||
%unignore operations_research::OrToolsVersion::MinorNumber;
|
||||
%unignore operations_research::OrToolsVersion::PatchNumber;
|
||||
%unignore operations_research::OrToolsVersion::VersionString;
|
||||
|
||||
%include "ortools/init/init.h"
|
||||
|
||||
%unignoreall
|
||||
|
||||
Reference in New Issue
Block a user