diff --git a/ortools/base/version.cc b/ortools/base/version.cc index 1d120dae8d..625b1a1a00 100644 --- a/ortools/base/version.cc +++ b/ortools/base/version.cc @@ -13,10 +13,18 @@ #include +#include "absl/strings/str_cat.h" + namespace operations_research { int OrToolsMajorVersion() { return OR_TOOLS_MAJOR; } + int OrToolsMinorVersion() { return OR_TOOLS_MINOR; } + int OrToolsPatchVersion() { return OR_TOOLS_PATCH; } +std::string OrToolsVersionString() { + return absl::StrCat(OR_TOOLS_MAJOR, ".", OR_TOOLS_MINOR, ".", OR_TOOLS_PATCH); +} + } // namespace operations_research diff --git a/ortools/base/version.h b/ortools/base/version.h index 4340aea67b..6781704df1 100644 --- a/ortools/base/version.h +++ b/ortools/base/version.h @@ -14,12 +14,18 @@ #ifndef OR_TOOLS_BASE_VERSION_H_ #define OR_TOOLS_BASE_VERSION_H_ +#include + namespace operations_research { int OrToolsMajorVersion(); + int OrToolsMinorVersion(); + int OrToolsPatchVersion(); +std::string OrToolsVersionString(); + } // namespace operations_research #endif // OR_TOOLS_BASE_VERSION_H_ diff --git a/ortools/init/init.h b/ortools/init/init.h index becb0991c9..c4b34499f8 100644 --- a/ortools/init/init.h +++ b/ortools/init/init.h @@ -18,7 +18,6 @@ #include #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" @@ -153,9 +152,7 @@ class OrToolsVersion { * Returns the string version of OR-Tools. */ static std::string VersionString() { - return absl::StrCat(::operations_research::OrToolsMajorVersion(), ".", - ::operations_research::OrToolsMinorVersion(), ".", - ::operations_research::OrToolsPatchVersion(), "."); + return ::operations_research::OrToolsVersionString(); } };