mirror of
https://github.com/opencv/opencv.git
synced 2026-07-31 00:03:03 +04:00
build: detect Android via '__ANDROID__' macro
https://sourceforge.net/p/predef/wiki/OperatingSystems
This commit is contained in:
@@ -1590,7 +1590,7 @@ void cv::ogl::render(const ogl::Arrays& arr, InputArray indices, int mode, Scala
|
||||
#endif // HAVE_OPENCL
|
||||
|
||||
#if defined(HAVE_OPENGL)
|
||||
# if defined(ANDROID)
|
||||
# if defined(__ANDROID__)
|
||||
# include <EGL/egl.h>
|
||||
# elif defined(__linux__)
|
||||
# include <GL/glx.h>
|
||||
@@ -1659,7 +1659,7 @@ Context& initializeContextFromGL()
|
||||
CL_CONTEXT_PLATFORM, (cl_context_properties)platforms[i],
|
||||
CL_GL_CONTEXT_KHR, (cl_context_properties)wglGetCurrentContext(),
|
||||
CL_WGL_HDC_KHR, (cl_context_properties)wglGetCurrentDC(),
|
||||
#elif defined(ANDROID)
|
||||
#elif defined(__ANDROID__)
|
||||
CL_CONTEXT_PLATFORM, (cl_context_properties)platforms[i],
|
||||
CL_GL_CONTEXT_KHR, (cl_context_properties)eglGetCurrentContext(),
|
||||
CL_EGL_DISPLAY_KHR, (cl_context_properties)eglGetCurrentDisplay(),
|
||||
|
||||
@@ -56,7 +56,7 @@
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#if defined ANDROID
|
||||
#if defined __ANDROID__
|
||||
#include <sys/sysconf.h>
|
||||
#elif defined __APPLE__
|
||||
#include <sys/sysctl.h>
|
||||
@@ -590,7 +590,7 @@ int cv::getThreadNum(void)
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
static inline int getNumberOfCPUsImpl()
|
||||
{
|
||||
FILE* cpuPossible = fopen("/sys/devices/system/cpu/possible", "r");
|
||||
@@ -641,7 +641,7 @@ int cv::getNumberOfCPUs(void)
|
||||
#endif
|
||||
|
||||
return (int)sysinfo.dwNumberOfProcessors;
|
||||
#elif defined ANDROID
|
||||
#elif defined __ANDROID__
|
||||
static int ncpus = getNumberOfCPUsImpl();
|
||||
return ncpus;
|
||||
#elif defined __linux__
|
||||
|
||||
@@ -527,7 +527,7 @@ void ThreadManager::setNumOfThreads(size_t n)
|
||||
|
||||
size_t ThreadManager::defaultNumberOfThreads()
|
||||
{
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
// many modern phones/tables have 4-core CPUs. Let's use no more
|
||||
// than 2 threads by default not to overheat the devices
|
||||
const unsigned int default_number_of_threads = 2;
|
||||
|
||||
@@ -2187,7 +2187,7 @@ static bool ocl_minMaxIdx( InputArray _src, double* minVal, double* maxVal, int*
|
||||
{
|
||||
const ocl::Device & dev = ocl::Device::getDefault();
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
if (dev.isNVidia())
|
||||
return false;
|
||||
#endif
|
||||
@@ -2975,7 +2975,7 @@ static bool ocl_norm( InputArray _src, int normType, InputArray _mask, double &
|
||||
{
|
||||
const ocl::Device & d = ocl::Device::getDefault();
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
if (d.isNVidia())
|
||||
return false;
|
||||
#endif
|
||||
@@ -3317,7 +3317,7 @@ namespace cv {
|
||||
|
||||
static bool ocl_norm( InputArray _src1, InputArray _src2, int normType, InputArray _mask, double & result )
|
||||
{
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
if (ocl::Device::getDefault().isNVidia())
|
||||
return false;
|
||||
#endif
|
||||
|
||||
@@ -66,16 +66,16 @@ Mutex* __initialization_mutex_initializer = &getInitializationMutex();
|
||||
# endif
|
||||
#endif
|
||||
|
||||
#if defined ANDROID || defined __linux__ || defined __FreeBSD__
|
||||
#if defined __ANDROID__ || defined __linux__ || defined __FreeBSD__
|
||||
# include <unistd.h>
|
||||
# include <fcntl.h>
|
||||
# include <elf.h>
|
||||
#if defined ANDROID || defined __linux__
|
||||
#if defined __ANDROID__ || defined __linux__
|
||||
# include <linux/auxvec.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined ANDROID && defined HAVE_CPUFEATURES
|
||||
#if defined __ANDROID__ && defined HAVE_CPUFEATURES
|
||||
# include <cpu-features.h>
|
||||
#endif
|
||||
|
||||
@@ -206,12 +206,12 @@ std::wstring GetTempFileNameWinRT(std::wstring prefix)
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <sys/types.h>
|
||||
#if defined ANDROID
|
||||
#if defined __ANDROID__
|
||||
#include <sys/sysconf.h>
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
# include <android/log.h>
|
||||
#endif
|
||||
|
||||
@@ -833,7 +833,7 @@ String tempfile( const char* suffix )
|
||||
fname = temp_file;
|
||||
#endif
|
||||
# else
|
||||
# ifdef ANDROID
|
||||
# ifdef __ANDROID__
|
||||
//char defaultTemplate[] = "/mnt/sdcard/__opencv_temp.XXXXXX";
|
||||
char defaultTemplate[] = "/data/local/tmp/__opencv_temp.XXXXXX";
|
||||
# else
|
||||
|
||||
@@ -331,7 +331,7 @@ OCL_TEST_P(Mul, Mat_Scale)
|
||||
OCL_OFF(cv::multiply(src1_roi, src2_roi, dst1_roi, val[0]));
|
||||
OCL_ON(cv::multiply(usrc1_roi, usrc2_roi, udst1_roi, val[0]));
|
||||
|
||||
#ifdef ANDROID
|
||||
#ifdef __ANDROID__
|
||||
Near(udst1_roi.depth() >= CV_32F ? 2e-1 : 1);
|
||||
#else
|
||||
Near(udst1_roi.depth() >= CV_32F ? 1e-3 : 1);
|
||||
|
||||
Reference in New Issue
Block a user