Add get sdk dirs
This commit is contained in:
parent
f7abe90c04
commit
fccc52eceb
|
@ -16,6 +16,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <string>
|
||||||
|
|
||||||
#include "mynteye/mynteye.h"
|
#include "mynteye/mynteye.h"
|
||||||
|
|
||||||
|
@ -55,6 +56,20 @@ namespace utils {
|
||||||
MYNTEYE_API float get_real_exposure_time(
|
MYNTEYE_API float get_real_exposure_time(
|
||||||
std::int32_t frame_rate, std::uint16_t exposure_time);
|
std::int32_t frame_rate, std::uint16_t exposure_time);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ingroup utils
|
||||||
|
*
|
||||||
|
* Get sdk root dir.
|
||||||
|
*/
|
||||||
|
MYNTEYE_API std::string get_sdk_root_dir();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @ingroup utils
|
||||||
|
*
|
||||||
|
* Get sdk install dir.
|
||||||
|
*/
|
||||||
|
MYNTEYE_API std::string get_sdk_install_dir();
|
||||||
|
|
||||||
} // namespace utils
|
} // namespace utils
|
||||||
|
|
||||||
MYNTEYE_END_NAMESPACE
|
MYNTEYE_END_NAMESPACE
|
||||||
|
|
|
@ -88,7 +88,7 @@ bool dir_exists(const std::string &p) {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
std::vector<std::string> get_plugin_paths() {
|
std::vector<std::string> get_plugin_paths() {
|
||||||
std::string info_path(MYNTEYE_SDK_INSTALL_DIR);
|
std::string info_path = utils::get_sdk_install_dir();
|
||||||
info_path.append(MYNTEYE_OS_SEP "share" MYNTEYE_OS_SEP "mynteye" MYNTEYE_OS_SEP "build.info");
|
info_path.append(MYNTEYE_OS_SEP "share" MYNTEYE_OS_SEP "mynteye" MYNTEYE_OS_SEP "build.info");
|
||||||
|
|
||||||
cv::FileStorage fs(info_path, cv::FileStorage::READ);
|
cv::FileStorage fs(info_path, cv::FileStorage::READ);
|
||||||
|
@ -183,7 +183,8 @@ std::vector<std::string> get_plugin_paths() {
|
||||||
}
|
}
|
||||||
plats.push_back(host_os + "-" + host_arch);
|
plats.push_back(host_os + "-" + host_arch);
|
||||||
|
|
||||||
std::vector<std::string> dirs{MYNTEYE_SDK_ROOT_DIR, MYNTEYE_SDK_INSTALL_DIR};
|
std::vector<std::string> dirs{
|
||||||
|
utils::get_sdk_root_dir(), utils::get_sdk_install_dir()};
|
||||||
for (auto &&plat : plats) {
|
for (auto &&plat : plats) {
|
||||||
for (auto &&dir : dirs) {
|
for (auto &&dir : dirs) {
|
||||||
auto &&plat_dir = dir + MYNTEYE_OS_SEP "plugins" + MYNTEYE_OS_SEP + plat;
|
auto &&plat_dir = dir + MYNTEYE_OS_SEP "plugins" + MYNTEYE_OS_SEP + plat;
|
||||||
|
|
|
@ -13,6 +13,8 @@
|
||||||
// limitations under the License.
|
// limitations under the License.
|
||||||
#include "mynteye/device/utils.h"
|
#include "mynteye/device/utils.h"
|
||||||
|
|
||||||
|
#include <cstdlib>
|
||||||
|
|
||||||
#include "mynteye/logger.h"
|
#include "mynteye/logger.h"
|
||||||
|
|
||||||
#include "mynteye/device/context.h"
|
#include "mynteye/device/context.h"
|
||||||
|
@ -110,6 +112,24 @@ float get_real_exposure_time(
|
||||||
return exposure_time * real_max / 480.f;
|
return exposure_time * real_max / 480.f;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string get_sdk_root_dir() {
|
||||||
|
if (const char* root = std::getenv("MYNTEYES_SDK_ROOT")) {
|
||||||
|
// LOG(INFO) << "Environment variable MYNTEYES_SDK_ROOT found: " << root;
|
||||||
|
return std::string(root);
|
||||||
|
} else {
|
||||||
|
return std::string(MYNTEYE_SDK_ROOT_DIR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string get_sdk_install_dir() {
|
||||||
|
if (const char* root = std::getenv("MYNTEYES_SDK_ROOT")) {
|
||||||
|
// LOG(INFO) << "Environment variable MYNTEYES_SDK_ROOT found: " << root;
|
||||||
|
return std::string(root);
|
||||||
|
} else {
|
||||||
|
return std::string(MYNTEYE_SDK_INSTALL_DIR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // namespace utils
|
} // namespace utils
|
||||||
|
|
||||||
MYNTEYE_END_NAMESPACE
|
MYNTEYE_END_NAMESPACE
|
||||||
|
|
Loading…
Reference in New Issue
Block a user