Update build.info and support native system on win
This commit is contained in:
parent
ee6d9f5a3b
commit
ac88a68ebc
|
@ -57,8 +57,12 @@ if(Boost_FOUND)
|
|||
set(WITH_BOOST_FILESYSTEM true)
|
||||
add_definitions(-DWITH_FILESYSTEM)
|
||||
add_definitions(-DWITH_BOOST_FILESYSTEM)
|
||||
message(STATUS "Found boost filesystem: ${Boost_VERSION}")
|
||||
message(STATUS "With boost filesystem: ${Boost_VERSION}")
|
||||
#message(STATUS " Boost_LIBRARIES: ${Boost_LIBRARIES}")
|
||||
elseif(OS_WIN)
|
||||
add_definitions(-DWITH_FILESYSTEM)
|
||||
add_definitions(-DWITH_NATIVE_FILESYSTEM)
|
||||
message(STATUS "With native filesystem")
|
||||
endif()
|
||||
|
||||
LIST(APPEND CMAKE_MODULE_PATH cmake)
|
||||
|
@ -72,8 +76,13 @@ set(MYNTEYE_NAME ${PROJECT_NAME})
|
|||
set(MYNTEYE_NAMESPACE "mynteye")
|
||||
message(STATUS "Namespace: ${MYNTEYE_NAMESPACE}")
|
||||
|
||||
if(MSVC)
|
||||
string(REPLACE "/" "\\\\" MYNTEYE_SDK_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
|
||||
string(REPLACE "/" "\\\\" MYNTEYE_SDK_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}")
|
||||
else()
|
||||
file(TO_NATIVE_PATH "${CMAKE_CURRENT_SOURCE_DIR}" MYNTEYE_SDK_ROOT_DIR)
|
||||
file(TO_NATIVE_PATH "${CMAKE_INSTALL_PREFIX}" MYNTEYE_SDK_INSTALL_DIR)
|
||||
endif()
|
||||
|
||||
configure_file(
|
||||
include/mynteye/mynteye.h.in
|
||||
|
@ -243,7 +252,7 @@ install(EXPORT ${MYNTEYE_NAME}-targets
|
|||
DESTINATION ${MYNTEYE_CMAKE_INSTALLDIR}
|
||||
)
|
||||
|
||||
find_package(CUDA QUIET)
|
||||
## build.info
|
||||
|
||||
macro(set_default_value VARIABLE DEFAULT)
|
||||
if(NOT ${VARIABLE})
|
||||
|
@ -251,8 +260,18 @@ macro(set_default_value VARIABLE DEFAULT)
|
|||
endif()
|
||||
endmacro()
|
||||
|
||||
set_default_value(GCC_VERSION_MAJOR 0)
|
||||
set_default_value(GCC_VERSION_MINOR 0)
|
||||
string(REPLACE "." ";" VERSION_LIST ${CMAKE_CXX_COMPILER_VERSION})
|
||||
list(GET VERSION_LIST 0 CXX_COMPILER_VERSION_MAJOR)
|
||||
list(GET VERSION_LIST 1 CXX_COMPILER_VERSION_MINOR)
|
||||
list(GET VERSION_LIST 2 CXX_COMPILER_VERSION_PATCH)
|
||||
list(GET VERSION_LIST 3 CXX_COMPILER_VERSION_TWEAK)
|
||||
|
||||
find_package(CUDA QUIET)
|
||||
|
||||
set_default_value(CXX_COMPILER_VERSION_MAJOR 0)
|
||||
set_default_value(CXX_COMPILER_VERSION_MINOR 0)
|
||||
set_default_value(CXX_COMPILER_VERSION_PATCH 0)
|
||||
set_default_value(CXX_COMPILER_VERSION_TWEAK 0)
|
||||
set_default_value(CUDA_VERSION_MAJOR 0)
|
||||
set_default_value(CUDA_VERSION_MINOR 0)
|
||||
set_default_value(OpenCV_VERSION_MAJOR 0)
|
||||
|
|
|
@ -50,15 +50,10 @@ include(${CMAKE_CURRENT_LIST_DIR}/TargetArch.cmake)
|
|||
target_architecture(HOST_ARCH)
|
||||
message(STATUS "HOST_ARCH: ${HOST_ARCH}")
|
||||
|
||||
if(CMAKE_COMPILER_IS_GNUCC)
|
||||
execute_process(COMMAND gcc -dumpversion COMMAND cut -c 1-3 COMMAND tr -d '\n' OUTPUT_VARIABLE GCC_VERSION)
|
||||
string(REGEX MATCHALL "[0-9]+" GCC_VERSION_COMPONMENTS ${GCC_VERSION})
|
||||
list(GET GCC_VERSION_COMPONMENTS 0 GCC_VERSION_MAJOR)
|
||||
list(GET GCC_VERSION_COMPONMENTS 1 GCC_VERSION_MINOR)
|
||||
message(STATUS "GCC_VERSION: ${GCC_VERSION}")
|
||||
#message(STATUS "GCC_VERSION_MAJOR: ${GCC_VERSION_MAJOR}")
|
||||
#message(STATUS "GCC_VERSION_MINOR: ${GCC_VERSION_MINOR}")
|
||||
endif()
|
||||
# CMAKE_CXX_COMPILER_ID
|
||||
# https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER_ID.html
|
||||
# CMAKE_CXX_COMPILER_VERSION
|
||||
# https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER_VERSION.html
|
||||
|
||||
# set_outdir(ARCHIVE_OUTPUT_DIRECTORY
|
||||
# LIBRARY_OUTPUT_DIRECTORY
|
||||
|
|
|
@ -3,9 +3,12 @@
|
|||
HOST_OS: "@HOST_OS@"
|
||||
HOST_NAME: "@HOST_NAME@"
|
||||
HOST_ARCH: "@HOST_ARCH@"
|
||||
GCC_VERSION: "@GCC_VERSION@"
|
||||
GCC_VERSION_MAJOR: @GCC_VERSION_MAJOR@
|
||||
GCC_VERSION_MINOR: @GCC_VERSION_MINOR@
|
||||
HOST_COMPILER: "@CMAKE_CXX_COMPILER_ID@"
|
||||
COMPILER_VERSION: "@CMAKE_CXX_COMPILER_VERSION@"
|
||||
COMPILER_VERSION_MAJOR: @CXX_COMPILER_VERSION_MAJOR@
|
||||
COMPILER_VERSION_MINOR: @CXX_COMPILER_VERSION_MINOR@
|
||||
COMPILER_VERSION_PATCH: @CXX_COMPILER_VERSION_PATCH@
|
||||
COMPILER_VERSION_TWEAK: @CXX_COMPILER_VERSION_TWEAK@
|
||||
CUDA_VERSION: "@CUDA_VERSION@"
|
||||
CUDA_VERSION_MAJOR: @CUDA_VERSION_MAJOR@
|
||||
CUDA_VERSION_MINOR: @CUDA_VERSION_MINOR@
|
||||
|
|
|
@ -31,13 +31,19 @@
|
|||
#include "device/device.h"
|
||||
#include "internal/dl.h"
|
||||
|
||||
#if defined(WITH_FILESYSTEM) && defined(WITH_NATIVE_FILESYSTEM)
|
||||
#if defined(OS_WIN)
|
||||
#include <windows.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
MYNTEYE_BEGIN_NAMESPACE
|
||||
|
||||
namespace {
|
||||
|
||||
#ifdef WITH_FILESYSTEM
|
||||
#if defined(WITH_FILESYSTEM)
|
||||
|
||||
#ifdef WITH_BOOST_FILESYSTEM
|
||||
#if defined(WITH_BOOST_FILESYSTEM)
|
||||
|
||||
namespace fs = boost::filesystem;
|
||||
|
||||
|
@ -61,6 +67,24 @@ bool dir_exists(const fs::path &p) {
|
|||
}
|
||||
}
|
||||
|
||||
#elif defined(WITH_NATIVE_FILESYSTEM)
|
||||
|
||||
#if defined(OS_WIN)
|
||||
|
||||
bool file_exists(const std::string &p) {
|
||||
DWORD attrs = GetFileAttributes(p.c_str());
|
||||
return (attrs != INVALID_FILE_ATTRIBUTES && !(attrs & FILE_ATTRIBUTE_DIRECTORY));
|
||||
}
|
||||
|
||||
bool dir_exists(const std::string &p) {
|
||||
DWORD attrs = GetFileAttributes(p.c_str());
|
||||
return (attrs != INVALID_FILE_ATTRIBUTES && (attrs & FILE_ATTRIBUTE_DIRECTORY));
|
||||
}
|
||||
|
||||
#else
|
||||
#error "Unsupported native filesystem"
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
std::vector<std::string> get_plugin_paths() {
|
||||
|
@ -69,7 +93,7 @@ std::vector<std::string> get_plugin_paths() {
|
|||
|
||||
cv::FileStorage fs(info_path, cv::FileStorage::READ);
|
||||
if (!fs.isOpened()) {
|
||||
// LOG(ERROR) << "build.info not found";
|
||||
LOG(WARNING) << "build.info not found: " << info_path;
|
||||
return {};
|
||||
}
|
||||
|
||||
|
@ -83,19 +107,27 @@ std::vector<std::string> get_plugin_paths() {
|
|||
to_lower(host_name);
|
||||
std::string host_arch = fs["HOST_ARCH"];
|
||||
to_lower(host_arch);
|
||||
// std::string gcc_version = fs["GCC_VERSION"];
|
||||
int gcc_version_major = fs["GCC_VERSION_MAJOR"];
|
||||
// int gcc_version_minor = fs["GCC_VERSION_MINOR"];
|
||||
std::string host_compiler = fs["HOST_COMPILER"];
|
||||
to_lower(host_compiler);
|
||||
|
||||
// std::string compiler_version = fs["COMPILER_VERSION"];
|
||||
int compiler_version_major = fs["COMPILER_VERSION_MAJOR"];
|
||||
// int compiler_version_minor = fs["COMPILER_VERSION_MINOR"];
|
||||
// int compiler_version_patch = fs["COMPILER_VERSION_PATCH"];
|
||||
// int compiler_version_tweak = fs["COMPILER_VERSION_TWEAK"];
|
||||
|
||||
std::string cuda_version = fs["CUDA_VERSION"];
|
||||
// int cuda_version_major = fs["CUDA_VERSION_MAJOR"];
|
||||
// int cuda_version_minor = fs["CUDA_VERSION_MINOR"];
|
||||
// std::string cuda_version_string = fs["CUDA_VERSION_STRING"];
|
||||
|
||||
std::string opencv_version = fs["OpenCV_VERSION"];
|
||||
// int opencv_version_major = fs["OpenCV_VERSION_MAJOR"];
|
||||
// int opencv_version_minor = fs["OpenCV_VERSION_MINOR"];
|
||||
// int opencv_version_patch = fs["OpenCV_VERSION_PATCH"];
|
||||
// int opencv_version_tweak = fs["OpenCV_VERSION_TWEAK"];
|
||||
// std::string opencv_version_status = fs["OpenCV_VERSION_STATUS"];
|
||||
|
||||
std::string mynteye_version = fs["MYNTEYE_VERSION"];
|
||||
// int mynteye_version_major = fs["MYNTEYE_VERSION_MAJOR"];
|
||||
// int mynteye_version_minor = fs["MYNTEYE_VERSION_MINOR"];
|
||||
|
@ -107,7 +139,7 @@ std::vector<std::string> get_plugin_paths() {
|
|||
std::string lib_prefix;
|
||||
std::string lib_suffix;
|
||||
if (host_os == "linux") {
|
||||
if (gcc_version_major < 5)
|
||||
if (host_compiler != "gnu" || compiler_version_major < 5)
|
||||
return {};
|
||||
lib_prefix = "lib";
|
||||
lib_suffix = ".so";
|
||||
|
|
Loading…
Reference in New Issue
Block a user