mirror of
https://github.com/opencv/opencv.git
synced 2024-11-27 12:40:05 +08:00
Merge pull request #25832 from chachoi-world:4.x
Add support for QNX #25832 Build and test instruction for QNX: https://github.com/chachoi-world/qnx-ports/blob/main/opencv/README.md ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [ ] There is a reference to the original bug report and related work - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake
This commit is contained in:
parent
d8bcc2c85d
commit
582a7f32d5
@ -773,7 +773,7 @@ if(UNIX OR MINGW)
|
||||
elseif(EMSCRIPTEN)
|
||||
# no need to link to system libs with emscripten
|
||||
elseif(QNXNTO)
|
||||
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} m)
|
||||
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} m regex)
|
||||
elseif(MINGW)
|
||||
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} pthread)
|
||||
else()
|
||||
|
@ -24,7 +24,13 @@ else()
|
||||
set(_zlib_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES .so)
|
||||
endif()
|
||||
if(QNX)
|
||||
set(ZLIB_FOUND TRUE)
|
||||
set(ZLIB_LIBRARY z)
|
||||
set(ZLIB_LIBRARIES z)
|
||||
else()
|
||||
find_package(ZLIB "${MIN_VER_ZLIB}")
|
||||
endif()
|
||||
if(ANDROID)
|
||||
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_zlib_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES})
|
||||
unset(_zlib_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES)
|
||||
@ -67,8 +73,14 @@ if(WITH_JPEG)
|
||||
ocv_clear_vars(JPEG_FOUND)
|
||||
else()
|
||||
ocv_clear_internal_cache_vars(JPEG_LIBRARY JPEG_INCLUDE_DIR)
|
||||
if(QNX)
|
||||
set(JPEG_LIBRARY jpeg)
|
||||
set(JPEG_LIBRARIES jpeg)
|
||||
set(JPEG_FOUND TRUE)
|
||||
else()
|
||||
include(FindJPEG)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT JPEG_FOUND)
|
||||
ocv_clear_vars(JPEG_LIBRARY JPEG_INCLUDE_DIR)
|
||||
@ -113,7 +125,13 @@ if(WITH_TIFF)
|
||||
ocv_clear_vars(TIFF_FOUND)
|
||||
else()
|
||||
ocv_clear_internal_cache_vars(TIFF_LIBRARY TIFF_INCLUDE_DIR)
|
||||
if(QNX)
|
||||
set(TIFF_LIBRARY tiff)
|
||||
set(TIFF_LIBRARIES tiff)
|
||||
set(TIFF_FOUND TRUE)
|
||||
else()
|
||||
include(FindTIFF)
|
||||
endif()
|
||||
if(TIFF_FOUND)
|
||||
ocv_parse_header("${TIFF_INCLUDE_DIR}/tiff.h" TIFF_VERSION_LINES TIFF_VERSION_CLASSIC TIFF_VERSION_BIG TIFF_VERSION TIFF_BIGTIFF_VERSION)
|
||||
endif()
|
||||
|
@ -56,6 +56,24 @@ elseif(WIN32 AND CMAKE_HOST_SYSTEM_NAME MATCHES Windows)
|
||||
ocv_update(OPENCV_JNI_INSTALL_PATH "java${_jni_suffix}")
|
||||
ocv_update(OPENCV_JNI_BIN_INSTALL_PATH "${OPENCV_JNI_INSTALL_PATH}")
|
||||
|
||||
elseif(QNX)
|
||||
ocv_update(OPENCV_BIN_INSTALL_PATH "${CPUVARDIR}/usr/bin")
|
||||
ocv_update(OPENCV_TEST_INSTALL_PATH "${OPENCV_BIN_INSTALL_PATH}")
|
||||
ocv_update(OPENCV_SAMPLES_BIN_INSTALL_PATH "${OPENCV_BIN_INSTALL_PATH}")
|
||||
ocv_update(OPENCV_LIB_INSTALL_PATH "${CPUVARDIR}/usr/lib")
|
||||
ocv_update(OPENCV_LIB_ARCHIVE_INSTALL_PATH "${OPENCV_LIB_INSTALL_PATH}")
|
||||
ocv_update(OPENCV_3P_LIB_INSTALL_PATH "${CPUVARDIR}/usr/lib")
|
||||
ocv_update(OPENCV_CONFIG_INSTALL_PATH "${CPUVARDIR}/usr/share/OpenCV")
|
||||
ocv_update(OPENCV_INCLUDE_INSTALL_PATH "usr/include/OpenCV/opencv4")
|
||||
ocv_update(OPENCV_OTHER_INSTALL_PATH "usr/share/OpenCV")
|
||||
ocv_update(OPENCV_SAMPLES_SRC_INSTALL_PATH "samples/native")
|
||||
ocv_update(OPENCV_LICENSES_INSTALL_PATH "${OPENCV_OTHER_INSTALL_PATH}/licenses")
|
||||
ocv_update(OPENCV_TEST_DATA_INSTALL_PATH "${OPENCV_OTHER_INSTALL_PATH}/testdata")
|
||||
ocv_update(OPENCV_DOC_INSTALL_PATH "doc")
|
||||
ocv_update(OPENCV_JAR_INSTALL_PATH "${CMAKE_INSTALL_DATAROOTDIR}/java/opencv4")
|
||||
ocv_update(OPENCV_JNI_INSTALL_PATH "${OPENCV_JAR_INSTALL_PATH}")
|
||||
ocv_update(OPENCV_JNI_BIN_INSTALL_PATH "${OPENCV_JNI_INSTALL_PATH}")
|
||||
|
||||
else() # UNIX
|
||||
|
||||
include(GNUInstallDirs)
|
||||
|
@ -308,9 +308,13 @@ function(ocv_include_directories)
|
||||
elseif(((CV_GCC AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.0") OR CV_CLANG) AND
|
||||
dir MATCHES "/usr/include$")
|
||||
# workaround for GCC 6.x bug
|
||||
else()
|
||||
if(${CMAKE_SYSTEM_NAME} MATCHES QNX)
|
||||
include_directories(AFTER "${dir}")
|
||||
else()
|
||||
include_directories(AFTER SYSTEM "${dir}")
|
||||
endif()
|
||||
endif()
|
||||
endforeach()
|
||||
include_directories(BEFORE ${__add_before})
|
||||
endfunction()
|
||||
|
@ -13,7 +13,7 @@
|
||||
/* not supported */
|
||||
# elif defined __ANDROID__ || defined __linux__ || defined _WIN32 || \
|
||||
defined __FreeBSD__ || defined __bsdi__ || defined __HAIKU__ || \
|
||||
defined __GNU__
|
||||
defined __GNU__ || defined __QNX__
|
||||
# define OPENCV_HAVE_FILESYSTEM_SUPPORT 1
|
||||
# elif defined(__APPLE__)
|
||||
# include <TargetConditionals.h>
|
||||
|
@ -72,6 +72,10 @@
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined (__QNX__)
|
||||
#include <sys/syspage.h>
|
||||
#endif
|
||||
|
||||
#ifndef OPENCV_DISABLE_THREAD_SUPPORT
|
||||
#include <thread>
|
||||
#endif
|
||||
@ -1011,7 +1015,9 @@ int getNumberOfCPUs_()
|
||||
|
||||
static unsigned cpu_count_sysconf = (unsigned)sysconf( _SC_NPROCESSORS_ONLN );
|
||||
ncpus = minNonZero(ncpus, cpu_count_sysconf);
|
||||
|
||||
#elif defined (__QNX__)
|
||||
static unsigned cpu_count_sysconf = _syspage_ptr->num_cpu;
|
||||
ncpus = minNonZero(ncpus, cpu_count_sysconf);
|
||||
#endif
|
||||
|
||||
return ncpus != 0 ? ncpus : 1;
|
||||
|
@ -46,6 +46,15 @@
|
||||
#include <iostream>
|
||||
#include <ostream>
|
||||
|
||||
#ifdef __QNX__
|
||||
#include <unistd.h>
|
||||
#include <sys/neutrino.h>
|
||||
#include <sys/syspage.h>
|
||||
#ifdef __aarch64__
|
||||
#include <aarch64/syspage.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#include <opencv2/core/utils/configuration.private.hpp>
|
||||
#include <opencv2/core/utils/trace.private.hpp>
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
||||
#include <errno.h>
|
||||
#include <io.h>
|
||||
#include <stdio.h>
|
||||
#elif defined __linux__ || defined __APPLE__ || defined __HAIKU__ || defined __FreeBSD__ || defined __GNU__ || defined __EMSCRIPTEN__
|
||||
#elif defined __linux__ || defined __APPLE__ || defined __HAIKU__ || defined __FreeBSD__ || defined __GNU__ || defined __EMSCRIPTEN__ || defined __QNX__
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <fcntl.h>
|
||||
@ -194,7 +194,7 @@ cv::String getcwd()
|
||||
sz = GetCurrentDirectoryA((DWORD)buf.size(), buf.data());
|
||||
return cv::String(buf.data(), (size_t)sz);
|
||||
#endif
|
||||
#elif defined __linux__ || defined __APPLE__ || defined __HAIKU__ || defined __FreeBSD__ || defined __EMSCRIPTEN__
|
||||
#elif defined __linux__ || defined __APPLE__ || defined __HAIKU__ || defined __FreeBSD__ || defined __EMSCRIPTEN__ || defined __QNX__
|
||||
for(;;)
|
||||
{
|
||||
char* p = ::getcwd(buf.data(), buf.size());
|
||||
@ -228,7 +228,7 @@ bool createDirectory(const cv::String& path)
|
||||
#else
|
||||
int result = _mkdir(path.c_str());
|
||||
#endif
|
||||
#elif defined __linux__ || defined __APPLE__ || defined __HAIKU__ || defined __FreeBSD__ || defined __EMSCRIPTEN__
|
||||
#elif defined __linux__ || defined __APPLE__ || defined __HAIKU__ || defined __FreeBSD__ || defined __EMSCRIPTEN__ || defined __QNX__
|
||||
int result = mkdir(path.c_str(), 0777);
|
||||
#else
|
||||
int result = -1;
|
||||
@ -343,7 +343,7 @@ private:
|
||||
Impl& operator=(const Impl&); // disabled
|
||||
};
|
||||
|
||||
#elif defined __linux__ || defined __APPLE__ || defined __HAIKU__ || defined __FreeBSD__ || defined __GNU__ || defined __EMSCRIPTEN__
|
||||
#elif defined __linux__ || defined __APPLE__ || defined __HAIKU__ || defined __FreeBSD__ || defined __GNU__ || defined __EMSCRIPTEN__ || defined __QNX__
|
||||
|
||||
struct FileLock::Impl
|
||||
{
|
||||
|
@ -1035,7 +1035,8 @@ static std::string findData(const std::string& relative_path, bool required, boo
|
||||
}
|
||||
}
|
||||
#ifdef OPENCV_TEST_DATA_INSTALL_PATH
|
||||
datapath = path_join("./", OPENCV_TEST_DATA_INSTALL_PATH);
|
||||
datapath = OPENCV_TEST_DATA_INSTALL_PATH;
|
||||
|
||||
if (isDirectory(datapath))
|
||||
{
|
||||
for(size_t i = search_subdir.size(); i > 0; i--)
|
||||
|
Loading…
Reference in New Issue
Block a user