merged iOS framework from the trunk

This commit is contained in:
Marina Kolpakova
2012-06-28 15:13:57 +00:00
parent 59ce0a9f81
commit 150aeee58f
8 changed files with 459 additions and 0 deletions

View File

@@ -46,7 +46,21 @@
#include <deque>
#include <iterator>
#include <wchar.h>
#define USE_ZLIB 1
#ifdef __APPLE__
# include "TargetConditionals.h"
# if (defined TARGET_OS_IPHONE && TARGET_OS_IPHONE) || (defined TARGET_IPHONE_SIMULATOR && TARGET_IPHONE_SIMULATOR)
# undef USE_ZLIB
# define USE_ZLIB 0
typedef void* gzFile;
# endif
#endif
#if USE_ZLIB
#include <zlib.h>
#endif
/****************************************************************************************\
* Common macros and type definitions *
@@ -258,8 +272,10 @@ static void icvPuts( CvFileStorage* fs, const char* str )
std::copy(str, str + strlen(str), std::back_inserter(*fs->outbuf));
else if( fs->file )
fputs( str, fs->file );
#if USE_ZLIB
else if( fs->gzfile )
gzputs( fs->gzfile, str );
#endif
else
CV_Error( CV_StsError, "The storage is not opened" );
}
@@ -286,8 +302,10 @@ static char* icvGets( CvFileStorage* fs, char* str, int maxCount )
}
if( fs->file )
return fgets( str, maxCount, fs->file );
#if USE_ZLIB
if( fs->gzfile )
return gzgets( fs->gzfile, str, maxCount );
#endif
CV_Error( CV_StsError, "The storage is not opened" );
return 0;
}
@@ -298,8 +316,10 @@ static int icvEof( CvFileStorage* fs )
return fs->strbufpos >= fs->strbufsize;
if( fs->file )
return feof(fs->file);
#if USE_ZLIB
if( fs->gzfile )
return gzeof(fs->gzfile);
#endif
return false;
}
@@ -307,8 +327,10 @@ static void icvCloseFile( CvFileStorage* fs )
{
if( fs->file )
fclose( fs->file );
#if USE_ZLIB
else if( fs->gzfile )
gzclose( fs->gzfile );
#endif
fs->file = 0;
fs->gzfile = 0;
fs->strbuf = 0;
@@ -320,8 +342,10 @@ static void icvRewind( CvFileStorage* fs )
{
if( fs->file )
rewind(fs->file);
#if USE_ZLIB
else if( fs->gzfile )
gzrewind(fs->gzfile);
#endif
fs->strbufpos = 0;
}
@@ -2713,10 +2737,14 @@ cvOpenFileStorage( const char* filename, CvMemStorage* dststorage, int flags, co
}
else
{
#if USE_ZLIB
char mode[] = { fs->write_mode ? 'w' : 'r', 'b', compression ? compression : '3', '\0' };
fs->gzfile = gzopen(fs->filename, mode);
if( !fs->gzfile )
goto _exit_;
#else
CV_Error(CV_StsNotImplemented, "There is no compressed file storage support in this configuration");
#endif
}
}

View File

@@ -0,0 +1,102 @@
if(NOT IOS)
ocv_module_disable(world)
endif()
set(the_description "All the selected OpenCV modules in a single binary")
set(OPENCV_MODULE_IS_PART_OF_WORLD FALSE)
set(BUILD_opencv_world_INIT OFF)
if(IOS OR NOT BUILD_SHARED_LIBS)
set(OPENCV_MODULE_TYPE STATIC)
set(OPENCV_WORLD_FLAGS_PROPERTY STATIC_LIBRARY_FLAGS)
else()
set(OPENCV_WORLD_FLAGS_PROPERTY LINK_FLAGS)
endif()
ocv_add_module(world opencv_core)
if(MSVC)
foreach(_var CMAKE_EXE_LINKER_FLAGS_RELEASE CMAKE_MODULE_LINKER_FLAGS_RELEASE CMAKE_SHARED_LINKER_FLAGS_RELEASE
CMAKE_EXE_LINKER_FLAGS_DEBUG CMAKE_MODULE_LINKER_FLAGS_DEBUG CMAKE_SHARED_LINKER_FLAGS_DEBUG)
string(REPLACE "/INCREMENTAL:NO" "/INCREMENTAL:YES" ${_var} "${${_var}}")
endforeach()
endif()
ocv_glob_module_sources()
ocv_module_include_directories()
ocv_create_module(SKIP_LINK)
#TODO: try to use try_compile to find real object file extension/location
if(CMAKE_GENERATOR MATCHES "^Visual.*$")
set(have_cfg 1)
set(objpath0 "<MODULE_NAME>.dir/<CONFIGURATION>/<SRC_NAME_WE>.obj")
elseif (CMAKE_GENERATOR MATCHES Xcode)
set(have_cfg 1)
set(objpath0 "OpenCV.build/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/<MODULE_NAME>.build/Objects-normal/$(CURRENT_ARCH)/<SRC_NAME_WE>.o")
else()
set(have_cfg 0)
set(objpath0 "CMakeFiles/<MODULE_NAME>.dir/<RELATIVE_SRC_NAME>.o")
if(MINGW OR MSVC)
set(objpath0 "${objpath0}bj")
endif()
endif()
set(objlist "")
foreach(m ${OPENCV_MODULE_${the_module}_DEPS})
# build order dependencies
add_dependencies(${the_module} ${m})
# link dependencies
string(REGEX REPLACE "(general|debug|optimized);opencv_[^;]*(;|$)" "" _link_deps "${${m}_LIB_DEPENDS}")
if(_link_deps)
target_link_libraries(${the_module} ${_link_deps})
endif()
string(REGEX REPLACE "<MODULE_NAME>" "${m}" objpath1 "${${m}_BINARY_DIR}/${objpath0}")
foreach(srcname ${OPENCV_MODULE_${m}_SOURCES})
if(srcname MATCHES "\\.(cpp|mm|c|cxx|cc|o|obj)$")
if(srcname MATCHES "\\.(o|obj)$")
if(IS_ABSOLUTE "${srcname}")
set(objpath3 "${srcname}")
else()
set(objpath3 "${${m}_SOURCE_DIR}/${srcname}")
endif()
else()
if(IS_ABSOLUTE "${srcname}")
if(srcname MATCHES "/(qrc|moc)_[^/]*\\.cxx$")
# QT generated sources
file(RELATIVE_PATH srcname "${${m}_BINARY_DIR}" "${srcname}")
else()
file(RELATIVE_PATH srcname "${OPENCV_MODULE_${m}_LOCATION}" "${srcname}")
endif()
endif()
string(REPLACE ".." "__" srcname "${srcname}")
get_filename_component(srcname_we ${srcname} NAME_WE)
string(REGEX REPLACE <SRC_NAME_WE> "${srcname_we}" objpath2 "${objpath1}")
string(REGEX REPLACE <RELATIVE_SRC_NAME> "${srcname}" objpath3 "${objpath2}")
endif()
if(CMAKE_GENERATOR MATCHES Makefiles)
file(RELATIVE_PATH objpath4 "${CMAKE_CURRENT_BINARY_DIR}" "${objpath3}")
else()
set(objpath4 ${objpath3})
endif()
list(APPEND objlist "\"${objpath4}\"")
endif()
endforeach()
endforeach()
string(REPLACE ";" " " objlist "${objlist}")
if(have_cfg)
string(REGEX REPLACE "<CONFIGURATION>" "Debug" objlist_dbg "${objlist}")
string(REGEX REPLACE "<CONFIGURATION>" "Release" objlist_rls "${objlist}")
set_target_properties(${the_module} PROPERTIES
${OPENCV_WORLD_FLAGS_PROPERTY}_DEBUG ${objlist_dbg}
${OPENCV_WORLD_FLAGS_PROPERTY}_RELEASE ${objlist_rls})
else()
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/world_objects.list" "${objlist}")
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_BINARY_DIR}/world_objects.list" "${CMAKE_CURRENT_BINARY_DIR}/world_objects.rsp" OUTPUT_QUIET)
set_target_properties(${the_module} PROPERTIES
${OPENCV_WORLD_FLAGS_PROPERTY} "@${CMAKE_CURRENT_BINARY_DIR}/world_objects.rsp")
endif()
ocv_add_precompiled_headers(${the_module})

View File

@@ -0,0 +1,58 @@
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
// Copyright (C) 2009-2010, Willow Garage Inc., all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#ifndef __OPENCV_WORLD_HPP__
#define __OPENCV_WORLD_HPP__
#include "opencv2/core/core.hpp"
#ifdef __cplusplus
namespace cv
{
CV_EXPORTS_W bool initAll();
}
#endif
#endif

View File

View File

@@ -0,0 +1,66 @@
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#ifndef __OPENCV_PRECOMP_H__
#define __OPENCV_PRECOMP_H__
#ifdef HAVE_CVCONFIG_H
#include "cvconfig.h"
#endif
#include "opencv2/opencv_modules.hpp"
#ifdef HAVE_OPENCV_VIDEO
#include "opencv2/video/video.hpp"
#endif
#ifdef HAVE_OPENCV_FEATURES2D
#include "opencv2/features2d/features2d.hpp"
#endif
#ifdef HAVE_OPENCV_NONFREE
#include "opencv2/nonfree/nonfree.hpp"
#endif
#ifdef HAVE_OPENCV_ML
#include "opencv2/ml/ml.hpp"
#endif
#include "opencv2/world/world.hpp"
#endif

View File

@@ -0,0 +1,61 @@
/*M///////////////////////////////////////////////////////////////////////////////////////
//
// IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.
//
// By downloading, copying, installing or using the software you agree to this license.
// If you do not agree to this license, do not download, install,
// copy or use the software.
//
//
// License Agreement
// For Open Source Computer Vision Library
//
// Copyright (C) 2000-2008, Intel Corporation, all rights reserved.
// Copyright (C) 2009, Willow Garage Inc., all rights reserved.
// Third party copyrights are property of their respective owners.
//
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
//
// * Redistribution's of source code must retain the above copyright notice,
// this list of conditions and the following disclaimer.
//
// * Redistribution's in binary form must reproduce the above copyright notice,
// this list of conditions and the following disclaimer in the documentation
// and/or other materials provided with the distribution.
//
// * The name of the copyright holders may not be used to endorse or promote products
// derived from this software without specific prior written permission.
//
// This software is provided by the copyright holders and contributors "as is" and
// any express or implied warranties, including, but not limited to, the implied
// warranties of merchantability and fitness for a particular purpose are disclaimed.
// In no event shall the Intel Corporation or contributors be liable for any direct,
// indirect, incidental, special, exemplary, or consequential damages
// (including, but not limited to, procurement of substitute goods or services;
// loss of use, data, or profits; or business interruption) however caused
// and on any theory of liability, whether in contract, strict liability,
// or tort (including negligence or otherwise) arising in any way out of
// the use of this software, even if advised of the possibility of such damage.
//
//M*/
#include "precomp.hpp"
bool cv::initAll()
{
return true
#ifdef HAVE_OPENCV_VIDEO
&& initModule_video()
#endif
#ifdef HAVE_OPENCV_FEATURES2D
&& initModule_features2d()
#endif
#ifdef HAVE_OPENCV_NONFREE
&& initModule_nonfree()
#endif
#ifdef HAVE_OPENCV_ML
&& initModule_ml()
#endif
;
}