1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-31 00:03:03 +04:00

build: made environment access a separate feature

This commit is contained in:
Maksim Shabunin
2024-10-17 23:35:38 +03:00
parent 2756c20e3e
commit 04818d6dd5
44 changed files with 176 additions and 275 deletions
+3 -3
View File
@@ -99,9 +99,9 @@ namespace
auto dump_info = cv::gapi::getCompileArg<cv::graph_dump_path>(args);
if (!dump_info.has_value())
{
const char* path = std::getenv("GRAPH_DUMP_PATH");
return path
? cv::util::make_optional(std::string(path))
const std::string path = cv::utils::getConfigurationParameterString("GRAPH_DUMP_PATH");
return !path.empty()
? cv::util::make_optional(path)
: cv::util::optional<std::string>();
}
else
+1
View File
@@ -10,6 +10,7 @@
#if !defined(GAPI_STANDALONE)
# include <opencv2/core.hpp>
# include <opencv2/core/utils/configuration.private.hpp>
# include <opencv2/imgproc.hpp>
# include <opencv2/gapi/core.hpp>
# include <opencv2/gapi/imgproc.hpp>
@@ -101,22 +101,18 @@ public:
// FIXME: taken from DNN module
static void initDLDTDataPath()
{
#ifndef WINRT
static bool initialized = false;
if (!initialized)
{
const char* omzDataPath = getenv("OPENCV_OPEN_MODEL_ZOO_DATA_PATH");
if (omzDataPath)
cvtest::addDataSearchPath(omzDataPath);
const char* dnnDataPath = getenv("OPENCV_DNN_TEST_DATA_PATH");
if (dnnDataPath) {
cvtest::addDataSearchEnv("OPENCV_OPEN_MODEL_ZOO_DATA_PATH");
const std::string dnnDataPath = cv::utils::getConfigurationParameterString("OPENCV_DNN_TEST_DATA_PATH");
if (!dnnDataPath.empty()) {
// Add the dnnDataPath itself - G-API is using some images there directly
cvtest::addDataSearchPath(dnnDataPath);
cvtest::addDataSearchPath(dnnDataPath + std::string("/omz_intel_models"));
}
initialized = true;
}
#endif // WINRT
}
#if INF_ENGINE_RELEASE >= 2020010000
@@ -58,10 +58,7 @@ public:
};
struct ONNXInitPath {
ONNXInitPath() {
const char* env_path = getenv("OPENCV_GAPI_ONNX_MODEL_PATH");
if (env_path) {
cvtest::addDataSearchPath(env_path);
}
cvtest::addDataSearchEnv("OPENCV_GAPI_ONNX_MODEL_PATH");
}
};
static ONNXInitPath g_init_path;
@@ -25,11 +25,9 @@ void initDLDTDataPath()
static bool initialized = false;
if (!initialized)
{
const char* omzDataPath = getenv("OPENCV_OPEN_MODEL_ZOO_DATA_PATH");
if (omzDataPath)
cvtest::addDataSearchPath(omzDataPath);
const char* dnnDataPath = getenv("OPENCV_DNN_TEST_DATA_PATH");
if (dnnDataPath) {
cvtest::addDataSearchEnv("OPENCV_OPEN_MODEL_ZOO_DATA_PATH");
const std::string dnnDataPath = cv::utils::getConfigurationParameterString("OPENCV_DNN_TEST_DATA_PATH");
if (!dnnDataPath.empty()) {
// Add the dnnDataPath itself - G-API is using some images there directly
cvtest::addDataSearchPath(dnnDataPath);
cvtest::addDataSearchPath(dnnDataPath + std::string("/omz_intel_models"));
+2
View File
@@ -16,6 +16,8 @@
#include <opencv2/ts.hpp>
#include <opencv2/core/utils/configuration.private.hpp>
#include <opencv2/gapi.hpp>
#include <opencv2/gapi/core.hpp>
#include <opencv2/gapi/imgproc.hpp>