Fixes RocksDB build

pull/216/head
Tpt 3 years ago
parent 489d271148
commit ed5004a70d
  1. 52
      oxrocksdb-sys/api/build_version.cc

@ -3,34 +3,36 @@
#include <memory> #include <memory>
#include "rocksdb/version.h" #include "rocksdb/version.h"
#include "util/string_util.h" #include "rocksdb/utilities/object_registry.h"
namespace ROCKSDB_NAMESPACE { namespace ROCKSDB_NAMESPACE {
const std::unordered_map<std::string, std::string>& GetRocksBuildProperties() { std::unordered_map<std::string, RegistrarFunc> ObjectRegistry::builtins_ = {};
static std::unique_ptr<std::unordered_map<std::string, std::string>> props(new std::unordered_map<std::string, std::string>());
return *props;
}
std::string GetRocksVersionAsString(bool with_patch) { const std::unordered_map<std::string, std::string>& GetRocksBuildProperties() {
std::string version = ToString(ROCKSDB_MAJOR) + "." + ToString(ROCKSDB_MINOR); static std::unique_ptr<std::unordered_map<std::string, std::string>> props(new std::unordered_map<std::string, std::string>());
if (with_patch) { return *props;
return version + "." + ToString(ROCKSDB_PATCH); }
} else {
return version;
}
}
std::string GetRocksBuildInfoAsString(const std::string& program, bool verbose) { std::string GetRocksVersionAsString(bool with_patch) {
std::string info = program + " (RocksDB) " + GetRocksVersionAsString(true); std::string version = std::to_string(ROCKSDB_MAJOR) + "." + std::to_string(ROCKSDB_MINOR);
if (verbose) { if (with_patch) {
for (const auto& it : GetRocksBuildProperties()) { return version + "." + std::to_string(ROCKSDB_PATCH);
info.append("\n "); } else {
info.append(it.first); return version;
info.append(": "); }
info.append(it.second);
} }
}
return info;
}
} // namespace ROCKSDB_NAMESPACE
std::string GetRocksBuildInfoAsString(const std::string& program, bool verbose) {
std::string info = program + " (RocksDB) " + GetRocksVersionAsString(true);
if (verbose) {
for (const auto& it : GetRocksBuildProperties()) {
info.append("\n ");
info.append(it.first);
info.append(": ");
info.append(it.second);
}
}
return info;
}
} // namespace ROCKSDB_NAMESPACE

Loading…
Cancel
Save