1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 23:33:05 +04:00

Merge pull request #15059 from hugolm84:improved-support-for-wince

* Improve support for Windows Embedded Compact

* Remove redundant set(WINCE true) and format CMake
This commit is contained in:
Hugo Lindström
2019-07-24 22:12:09 +02:00
committed by Alexander Alekhin
parent ad092bf1ce
commit 2ee00e7f7d
10 changed files with 174 additions and 45 deletions
@@ -9,7 +9,7 @@
#ifndef OPENCV_HAVE_FILESYSTEM_SUPPORT
# if defined(__EMSCRIPTEN__) || defined(__native_client__)
/* no support */
# elif defined WINRT
# elif defined WINRT || defined _WIN32_WCE
/* not supported */
# elif defined __ANDROID__ || defined __linux__ || defined _WIN32 || \
defined __FreeBSD__ || defined __bsdi__ || defined __HAIKU__
+3 -3
View File
@@ -57,7 +57,7 @@ namespace
struct DIR
{
#ifdef WINRT
#if defined(WINRT) || defined(_WIN32_WCE)
WIN32_FIND_DATAW data;
#else
WIN32_FIND_DATAA data;
@@ -78,7 +78,7 @@ namespace
{
DIR* dir = new DIR;
dir->ent.d_name = 0;
#ifdef WINRT
#if defined(WINRT) || defined(_WIN32_WCE)
cv::String full_path = cv::String(path) + "\\*";
wchar_t wfull_path[MAX_PATH];
size_t copied = mbstowcs(wfull_path, full_path.c_str(), MAX_PATH);
@@ -100,7 +100,7 @@ namespace
dirent* readdir(DIR* dir)
{
#ifdef WINRT
#if defined(WINRT) || defined(_WIN32_WCE)
if (dir->ent.d_name != 0)
{
if (::FindNextFileW(dir->handle, &dir->data) != TRUE)
+1 -1
View File
@@ -1722,7 +1722,7 @@ static bool parseOpenCLDeviceConfiguration(const std::string& configurationStr,
return true;
}
#ifdef WINRT
#if defined WINRT || defined _WIN32_WCE
static cl_device_id selectOpenCLDevice()
{
return NULL;
+19 -5
View File
@@ -378,7 +378,7 @@ struct HWFeatures
void initialize(void)
{
#ifndef WINRT
#ifndef NO_GETENV
if (getenv("OPENCV_DUMP_CONFIG"))
{
fprintf(stderr, "\nOpenCV build configuration is:\n%s\n",
@@ -614,10 +614,10 @@ struct HWFeatures
{
bool dump = true;
const char* disabled_features =
#ifndef WINRT
getenv("OPENCV_CPU_DISABLE");
#else
#ifdef NO_GETENV
NULL;
#else
getenv("OPENCV_CPU_DISABLE");
#endif
if (disabled_features && disabled_features[0] != 0)
{
@@ -892,7 +892,7 @@ String format( const char* fmt, ... )
String tempfile( const char* suffix )
{
String fname;
#ifndef WINRT
#ifndef NO_GETENV
const char *temp_dir = getenv("OPENCV_TEMP_PATH");
#endif
@@ -913,6 +913,20 @@ String tempfile( const char* suffix )
CV_Assert((copied != MAX_PATH) && (copied != (size_t)-1));
fname = String(aname);
RoUninitialize();
#elif defined(_WIN32_WCE)
const auto kMaxPathSize = MAX_PATH+1;
wchar_t temp_dir[kMaxPathSize] = {0};
wchar_t temp_file[kMaxPathSize] = {0};
::GetTempPathW(kMaxPathSize, temp_dir);
if(0 != ::GetTempFileNameW(temp_dir, L"ocv", 0, temp_file)) {
DeleteFileW(temp_file);
char aname[MAX_PATH];
size_t copied = wcstombs(aname, temp_file, MAX_PATH);
CV_Assert((copied != MAX_PATH) && (copied != (size_t)-1));
fname = String(aname);
}
#else
char temp_dir2[MAX_PATH] = { 0 };
char temp_file[MAX_PATH] = { 0 };