Fixes for QNX 6.6 Neitrino support.

pull/3363/head
Alexander Smorkalov 10 years ago
parent a77a2f357c
commit 6bb6039ebb
  1. 2
      CMakeLists.txt
  2. 5
      apps/traincascade/imagestorage.h
  3. 2
      cmake/OpenCVCompilerOptions.cmake
  4. 39
      modules/contrib/src/inputoutput.cpp
  5. 7
      modules/core/include/opencv2/core/operations.hpp
  6. 2
      modules/core/src/system.cpp
  7. 10
      modules/highgui/src/grfmt_tiff.cpp
  8. 5
      modules/objdetect/src/linemod.cpp
  9. 5
      modules/ts/src/ts.cpp
  10. 114
      platforms/qnx/arm-unknown-nto-qnx6.6.0eabi.toolchain.cmake

@ -440,6 +440,8 @@ if(UNIX)
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} dl m log) set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} dl m log)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD|NetBSD|DragonFly") elseif(${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD|NetBSD|DragonFly")
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} m pthread) set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} m pthread)
elseif(${CMAKE_SYSTEM_NAME} MATCHES "QNX")
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} m)
else() else()
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} dl m pthread rt) set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} dl m pthread rt)
endif() endif()

@ -1,10 +1,11 @@
#ifndef _OPENCV_IMAGESTORAGE_H_ #ifndef _OPENCV_IMAGESTORAGE_H_
#define _OPENCV_IMAGESTORAGE_H_ #define _OPENCV_IMAGESTORAGE_H_
#include <stdio.h>
#include <string>
#include <vector>
#include "highgui.h" #include "highgui.h"
class CvCascadeImageReader class CvCascadeImageReader
{ {
public: public:

@ -254,7 +254,7 @@ if(MSVC)
endif() endif()
# Extra link libs if the user selects building static libs: # Extra link libs if the user selects building static libs:
if(NOT BUILD_SHARED_LIBS AND CMAKE_COMPILER_IS_GNUCXX AND NOT ANDROID) if(NOT BUILD_SHARED_LIBS AND ((CMAKE_COMPILER_IS_GNUCXX AND NOT ANDROID) OR QNX))
# Android does not need these settings because they are already set by toolchain file # Android does not need these settings because they are already set by toolchain file
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} stdc++) set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} stdc++)
set(OPENCV_EXTRA_FLAGS "-fPIC ${OPENCV_EXTRA_FLAGS}") set(OPENCV_EXTRA_FLAGS "-fPIC ${OPENCV_EXTRA_FLAGS}")

@ -77,9 +77,28 @@ namespace cv
return list; return list;
} }
#ifdef __QNX__
// you have to ask QNX to please include more file information
// and not to report duplicate names as a result of file system unions
if ( -1 == dircntl(dp, D_SETFLAG, D_FLAG_STAT|D_FLAG_FILTER) )
return list;
#endif
while ((dirp = readdir(dp)) != NULL) while ((dirp = readdir(dp)) != NULL)
{ {
#ifdef __QNX__
// QNX looks at the world a little differently
dirent_extra *extra;
dirent_extra_stat *extra_stat;
for (extra = _DEXTRA_FIRST(dirp),
extra_stat = reinterpret_cast<dirent_extra_stat *>(extra);
_DEXTRA_VALID(extra, dirp);
extra = _DEXTRA_NEXT(extra),
extra_stat = reinterpret_cast<dirent_extra_stat *>(extra))
if ((extra->d_type != _DTYPE_NONE) && S_ISREG(extra_stat->d_stat.st_mode))
#else
if (dirp->d_type == DT_REG) if (dirp->d_type == DT_REG)
#endif
{ {
if (exten.compare("*") == 0) if (exten.compare("*") == 0)
list.push_back(static_cast<std::string>(dirp->d_name)); list.push_back(static_cast<std::string>(dirp->d_name));
@ -167,9 +186,29 @@ namespace cv
return list; return list;
} }
#ifdef __QNX__
// you have to ask QNX to please include more file information
// and not to report duplicate names as a result of file system unions
if ( -1 == dircntl(dp, D_SETFLAG, D_FLAG_STAT|D_FLAG_FILTER) )
return list;
#endif
while ((dirp = readdir(dp)) != NULL) while ((dirp = readdir(dp)) != NULL)
{ {
#ifdef __QNX__
// QNX looks at the world a little differently
dirent_extra *extra;
dirent_extra_stat *extra_stat;
for (extra = _DEXTRA_FIRST(dirp),
extra_stat = reinterpret_cast<dirent_extra_stat *>(extra);
_DEXTRA_VALID(extra, dirp);
extra = _DEXTRA_NEXT(extra),
extra_stat = reinterpret_cast<dirent_extra_stat *>(extra))
if ((extra->d_type != _DTYPE_NONE) &&
S_ISDIR(extra_stat->d_stat.st_mode) &&
#else
if (dirp->d_type == DT_DIR && if (dirp->d_type == DT_DIR &&
#endif
strcmp(dirp->d_name, ".") != 0 && strcmp(dirp->d_name, ".") != 0 &&
strcmp(dirp->d_name, "..") != 0 ) strcmp(dirp->d_name, "..") != 0 )
{ {

@ -3750,8 +3750,15 @@ template<typename _Tp> inline ptrdiff_t operator - (const SeqIterator<_Tp>& a,
const SeqIterator<_Tp>& b) const SeqIterator<_Tp>& b)
{ {
ptrdiff_t delta = a.index - b.index, n = a.seq->total; ptrdiff_t delta = a.index - b.index, n = a.seq->total;
#if defined(__QNX__)
// No long std::abs(long) in QNX
long absdelta = (delta < 0) ? -delta : delta;
if( absdelta > n )
#else
if( std::abs(static_cast<long>(delta)) > n ) if( std::abs(static_cast<long>(delta)) > n )
#endif
delta += delta < 0 ? n : -n; delta += delta < 0 ? n : -n;
return delta; return delta;
} }

@ -157,7 +157,7 @@ std::wstring GetTempFileNameWinRT(std::wstring prefix)
#include <stdarg.h> #include <stdarg.h>
#if defined __linux__ || defined __APPLE__ || defined __EMSCRIPTEN__ #if defined __linux__ || defined __APPLE__ || defined __EMSCRIPTEN__ || defined __QNX__
#include <unistd.h> #include <unistd.h>
#include <stdio.h> #include <stdio.h>
#include <sys/types.h> #include <sys/types.h>

@ -45,9 +45,16 @@
(see otherlibs/_graphics/readme.txt for copyright notice) (see otherlibs/_graphics/readme.txt for copyright notice)
\****************************************************************************************/ \****************************************************************************************/
#include <stdarg.h>
#include "precomp.hpp" #include "precomp.hpp"
#include "grfmt_tiff.hpp" #include "grfmt_tiff.hpp"
#ifdef HAVE_TIFF
# include "tiff.h"
# include "tiffio.h"
#endif
namespace cv namespace cv
{ {
static const char fmtSignTiffII[] = "II\x2a\x00"; static const char fmtSignTiffII[] = "II\x2a\x00";
@ -55,9 +62,6 @@ static const char fmtSignTiffMM[] = "MM\x00\x2a";
#ifdef HAVE_TIFF #ifdef HAVE_TIFF
#include "tiff.h"
#include "tiffio.h"
static int grfmt_tiff_err_handler_init = 0; static int grfmt_tiff_err_handler_init = 0;
static void GrFmtSilentTIFFErrorHandler( const char*, const char*, va_list ) {} static void GrFmtSilentTIFFErrorHandler( const char*, const char*, va_list ) {}

@ -604,7 +604,12 @@ void ColorGradient::write(FileStorage& fs) const
static void accumBilateral(long delta, long i, long j, long * A, long * b, int threshold) static void accumBilateral(long delta, long i, long j, long * A, long * b, int threshold)
{ {
#ifdef __QNX__
long absdelta = (delta > 0) ? delta : -delta;
long f = absdelta < threshold ? 1 : 0;
#else
long f = std::abs(delta) < threshold ? 1 : 0; long f = std::abs(delta) < threshold ? 1 : 0;
#endif
const long fi = f * i; const long fi = f * i;
const long fj = f * j; const long fj = f * j;

@ -60,6 +60,8 @@
#else #else
#include <unistd.h> #include <unistd.h>
#include <signal.h>
#include <setjmp.h>
#endif #endif
namespace cvtest namespace cvtest
@ -110,9 +112,6 @@ static void SEHTranslator( unsigned int /*u*/, EXCEPTION_POINTERS* pExp )
#else #else
#include <signal.h>
#include <setjmp.h>
static const int tsSigId[] = { SIGSEGV, SIGBUS, SIGFPE, SIGILL, SIGABRT, -1 }; static const int tsSigId[] = { SIGSEGV, SIGBUS, SIGFPE, SIGILL, SIGABRT, -1 };
static jmp_buf tsJmpMark; static jmp_buf tsJmpMark;

@ -0,0 +1,114 @@
set(TOOLCHAIN QNX)
set(CMAKE_SYSTEM_NAME QNX)
set(CMAKE_SYSTEM_VERSION 6.6.0)
set(CMAKE_SYSTEM_PROCESSOR armv7)
set(TARGET_OS QNX)
set(TARGET_ARCH ARMV7L)
set(TARGET_COMPILER GCC)
set(CMAKE_DL_LIBS "")
set(CMAKE_SHARED_LIBRARY_PREFIX "lib")
set(CMAKE_SHARED_LIBRARY_SUFFIX ".so")
set(CMAKE_STATIC_LIBRARY_PREFIX "lib")
set(CMAKE_STATIC_LIBRARY_SUFFIX ".a")
if("$ENV{QNX_HOST}" STREQUAL "")
message(FATAL_ERROR "QNX_HOST environment variable not found. Please set the variable to your host's build tools")
endif()
if("$ENV{QNX_TARGET}" STREQUAL "")
message(FATAL_ERROR "QNX_TARGET environment variable not found. Please set the variable to the qnx target location")
endif()
if(CMAKE_HOST_WIN32)
set(HOST_EXECUTABLE_SUFFIX ".exe")
#convert windows paths to cmake paths
file(TO_CMAKE_PATH "$ENV{QNX_HOST}" QNX_HOST)
file(TO_CMAKE_PATH "$ENV{QNX_TARGET}" QNX_TARGET)
else()
set(QNX_HOST "$ENV{QNX_HOST}")
set(QNX_TARGET "$ENV{QNX_TARGET}")
endif()
message(STATUS "using QNX_HOST ${QNX_HOST}")
message(STATUS "using QNX_TARGET ${QNX_TARGET}")
set(CMAKE_C_COMPILER "${QNX_HOST}/usr/bin/nto${CMAKE_SYSTEM_PROCESSOR}-gcc${HOST_EXECUTABLE_SUFFIX}" CACHE PATH "QNX C compiler")
set(CMAKE_CXX_COMPILER "${QNX_HOST}/usr/bin/nto${CMAKE_SYSTEM_PROCESSOR}-g++${HOST_EXECUTABLE_SUFFIX}" CACHE PATH "QNX CXX compiler")
set(CMAKE_ASM_COMPILER "${QNX_HOST}/usr/bin/nto${CMAKE_SYSTEM_PROCESSOR}-as${HOST_EXECUTABLE_SUFFIX}" CACHE PATH "QNX CXX compiler assembler")
set(CMAKE_LINKER "${QNX_HOST}/usr/bin/nto${CMAKE_SYSTEM_PROCESSOR}-ld${HOST_EXECUTABLE_SUFFIX}" CACHE PATH "QNX Linker Program")
set(CMAKE_MAKE_PROGRAM "${QNX_HOST}/usr/bin/make${HOST_EXECUTABLE_SUFFIX}" CACHE PATH "QNX Make Program")
set(CMAKE_AR "${QNX_HOST}/usr/bin/nto${CMAKE_SYSTEM_PROCESSOR}-ar${HOST_EXECUTABLE_SUFFIX}" CACHE PATH "QNX ar Program")
set(CMAKE_NM "${QNX_HOST}/usr/bin/nto${CMAKE_SYSTEM_PROCESSOR}-nm${HOST_EXECUTABLE_SUFFIX}" CACHE PATH "QNX nm Program")
set(CMAKE_OBJCOPY "${QNX_HOST}/usr/bin/nto${CMAKE_SYSTEM_PROCESSOR}-objcopy${HOST_EXECUTABLE_SUFFIX}" CACHE PATH "QNX objcopy Program")
set(CMAKE_OBJDUMP "${QNX_HOST}/usr/bin/nto${CMAKE_SYSTEM_PROCESSOR}-objdump${HOST_EXECUTABLE_SUFFIX}" CACHE PATH "QNX objdump Program")
set(CMAKE_RANLIB "${QNX_HOST}/usr/bin/nto${CMAKE_SYSTEM_PROCESSOR}-ranlib${HOST_EXECUTABLE_SUFFIX}" CACHE PATH "QNX ranlib Program")
set(CMAKE_SH "${QNX_HOST}/usr/bin/sh${HOST_EXECUTABLE_SUFFIX}" CACHE PATH "QNX shell Program")
set(CMAKE_STRIP "${QNX_HOST}/usr/bin/nto${CMAKE_SYSTEM_PROCESSOR}-strip${HOST_EXECUTABLE_SUFFIX}" CACHE PATH "QNX Strip Program")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS} -g -D_DEBUG")
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} -O3 -DNDEBUG")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -g -D_DEBUG -ftree-vectorize")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O3 -DNDEBUG -ftree-vectorize")
#set successful exit value on target system
set(THREADS_PTHREAD_ARG 0)
add_definitions("-DTARGET_OS=QNX")
add_definitions("-DTARGET_ARCH=ARM")
add_definitions("-DOS_QNX")
add_definitions("-DARCH_ARM")
# necessary for gmock
add_definitions("-DGTEST_HAS_PTHREAD=1")
add_definitions(-D __GLIBCXX__="1")
set(CMAKE_FIND_ROOT_PATH ${QNX_TARGET})
set(CMAKE_SKIP_RPATH TRUE CACHE BOOL "If set, runtime paths are not added when using shared libraries.")
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
# macro to find programs on the host OS
macro( find_host_program )
set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER )
set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER )
if( CMAKE_HOST_WIN32 )
set( WIN32 1 )
set( UNIX )
elseif( CMAKE_HOST_APPLE )
set( APPLE 1 )
set( UNIX )
endif()
find_program( ${ARGN} )
set( WIN32 )
set( APPLE )
set( UNIX 1 )
set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY )
set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
endmacro()
# macro to find packages on the host OS
macro( find_host_package )
set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER )
set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER )
set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER )
if( CMAKE_HOST_WIN32 )
set( WIN32 1 )
set( UNIX )
elseif( CMAKE_HOST_APPLE )
set( APPLE 1 )
set( UNIX )
endif()
find_package( ${ARGN} )
set( WIN32 )
set( APPLE )
set( UNIX 1 )
set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY )
set( CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY )
set( CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY )
endmacro()
Loading…
Cancel
Save