1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 15:23:05 +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
+11 -18
View File
@@ -553,13 +553,9 @@ static int tsErrorCallback( int status, const char* func_name, const char* err_m
void TS::init( const string& modulename )
{
data_search_subdir.push_back(modulename);
#ifndef WINRT
char* datapath_dir = getenv("OPENCV_TEST_DATA_PATH");
#else
char* datapath_dir = OPENCV_TEST_DATA_PATH;
#endif
std::string datapath_dir = cv::utils::getConfigurationParameterString("OPENCV_TEST_DATA_PATH");
if( datapath_dir )
if( !datapath_dir.empty() )
{
data_path = path_join(path_join(datapath_dir, modulename), "");
}
@@ -903,11 +899,7 @@ void parseCustomOptions(int argc, char **argv)
test_ipp_check = parser.get<bool>("test_ipp_check");
if (!test_ipp_check)
#ifndef WINRT
test_ipp_check = getenv("OPENCV_IPP_CHECK") != NULL;
#else
test_ipp_check = false;
#endif
test_ipp_check = cv::utils::getConfigurationParameterBool("OPENCV_IPP_CHECK");
param_seed = parser.get<unsigned int>("test_seed");
@@ -953,9 +945,14 @@ static bool isDirectory(const std::string& path)
void addDataSearchPath(const std::string& path)
{
if (isDirectory(path))
if (!path.empty() && isDirectory(path))
TS::ptr()->data_search_path.push_back(path);
}
void addDataSearchEnv(const std::string& env_name)
{
const std::string val = cv::utils::getConfigurationParameterString(env_name.c_str());
cvtest::addDataSearchPath(val);
}
void addDataSearchSubDirectory(const std::string& subdir)
{
TS::ptr()->data_search_subdir.push_back(subdir);
@@ -1001,14 +998,10 @@ static std::string findData(const std::string& relative_path, bool required, boo
const std::vector<std::string>& search_subdir = TS::ptr()->data_search_subdir;
#ifndef WINRT
char* datapath_dir = getenv("OPENCV_TEST_DATA_PATH");
#else
char* datapath_dir = OPENCV_TEST_DATA_PATH;
#endif
std::string datapath_dir = cv::utils::getConfigurationParameterString("OPENCV_TEST_DATA_PATH");
std::string datapath;
if (datapath_dir)
if (!datapath_dir.empty())
{
datapath = datapath_dir;
//CV_Assert(isDirectory(datapath) && "OPENCV_TEST_DATA_PATH is specified but it doesn't exist");