RPM packages improvements: part 2 (#14306)
* Updated install_dependencies.sh * Added Fedora support * Improvements for RPM generation * Refactored work with gflags * Apply suggestions from code review * Improvements * Several improvements for Ubuntu 18.04 * Improvements in gflags * Update thirdparty/CMakeLists.txt temporary install samples dependencies * Fixed several mistakes * Fixed issues with gflags * Don't install dependencies on Linux * Added nlohmann findinds on debian9 case * Added FATAL_ERROR is gflags is not found in samples * Fixes for samples on CentOS 7 * Cross-compiled debian packakges with proper libraries location * Fixed include for old nlohman-json versions * Fixed compilation with old json * Applied review comments * Added support of old nlohmann versions via submodule * Temporary WA for CentOS 7 * Fixed compilation with old gflags * Fixed compilation of C samples * Fixed gflags on RHEL8.2 / Debian 9
This commit is contained in:
@@ -6,7 +6,6 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <map>
|
||||
#include <nlohmann/json.hpp>
|
||||
#include <regex>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
@@ -20,6 +19,12 @@
|
||||
#include "utils.hpp"
|
||||
// clang-format on
|
||||
|
||||
#ifdef JSON_HEADER
|
||||
# include <json.hpp>
|
||||
#else
|
||||
# include <nlohmann/json.hpp>
|
||||
#endif
|
||||
|
||||
#ifdef USE_OPENCV
|
||||
# include <opencv2/core.hpp>
|
||||
#endif
|
||||
@@ -767,21 +772,28 @@ void load_config(const std::string& filename, std::map<std::string, ov::AnyMap>&
|
||||
nlohmann::json jsonConfig;
|
||||
try {
|
||||
ifs >> jsonConfig;
|
||||
} catch (const nlohmann::json::parse_error& e) {
|
||||
} catch (const std::exception& e) {
|
||||
throw std::runtime_error("Can't parse config file \"" + filename + "\".\n" + e.what());
|
||||
}
|
||||
|
||||
for (const auto& item : jsonConfig.items()) {
|
||||
std::string deviceName = item.key();
|
||||
for (const auto& option : item.value().items()) {
|
||||
for (auto item = jsonConfig.cbegin(), end = jsonConfig.cend(); item != end; ++item) {
|
||||
const std::string& deviceName = item.key();
|
||||
const auto& itemValue = item.value();
|
||||
for (auto option = itemValue.cbegin(), itemValueEnd = itemValue.cend(); option != itemValueEnd; ++option) {
|
||||
if (option.key() != "DEVICE_PROPERTIES") {
|
||||
config[deviceName][option.key()] = option.value().get<std::string>();
|
||||
continue;
|
||||
}
|
||||
for (const auto& hw_properties : option.value().items()) {
|
||||
auto hw_device_name = hw_properties.key();
|
||||
const auto& optionValue = option.value();
|
||||
for (auto hw_properties = optionValue.cbegin(), optionValueEnd = optionValue.cend();
|
||||
hw_properties != optionValueEnd;
|
||||
++hw_properties) {
|
||||
const std::string& hw_device_name = hw_properties.key();
|
||||
std::map<std::string, ov::Any> hw_device_properties;
|
||||
for (const auto& property : hw_properties.value().items())
|
||||
const auto& hw_propertiesValue = hw_properties.value();
|
||||
for (auto property = hw_propertiesValue.cbegin(), hw_propertiesEnd = hw_propertiesValue.cend();
|
||||
property != hw_propertiesEnd;
|
||||
++property)
|
||||
hw_device_properties[property.key()] = property.value().get<std::string>();
|
||||
config[deviceName][hw_device_name] = hw_device_properties;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user