From 7fa01e3fcc9eaac70871e7f3cff52bdb1a1b1544 Mon Sep 17 00:00:00 2001 From: Anatoly Baksheev Date: Sun, 24 Mar 2013 20:07:55 +0400 Subject: [PATCH] enabled png and jpeg for iOS --- CMakeLists.txt | 4 ++-- cmake/OpenCVFindLibsGrfmt.cmake | 4 ++-- ios/build_framework.py | 6 +++--- modules/world/CMakeLists.txt | 29 +++++++++++++++++++++++++++++ 4 files changed, 36 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 351273e888..e3c8259a1e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -124,11 +124,11 @@ OCV_OPTION(WITH_GTK "Include GTK support" ON OCV_OPTION(WITH_IMAGEIO "ImageIO support for OS X" OFF IF APPLE) OCV_OPTION(WITH_IPP "Include Intel IPP support" OFF IF (MSVC OR X86 OR X86_64) ) OCV_OPTION(WITH_JASPER "Include JPEG2K support" ON IF (NOT IOS) ) -OCV_OPTION(WITH_JPEG "Include JPEG support" ON IF (NOT IOS) ) +OCV_OPTION(WITH_JPEG "Include JPEG support" ON) OCV_OPTION(WITH_OPENEXR "Include ILM support via OpenEXR" ON IF (NOT IOS) ) OCV_OPTION(WITH_OPENGL "Include OpenGL support" OFF IF (NOT ANDROID AND NOT APPLE) ) OCV_OPTION(WITH_OPENNI "Include OpenNI support" OFF IF (NOT ANDROID AND NOT IOS) ) -OCV_OPTION(WITH_PNG "Include PNG support" ON IF (NOT IOS) ) +OCV_OPTION(WITH_PNG "Include PNG support" ON) OCV_OPTION(WITH_PVAPI "Include Prosilica GigE support" ON IF (NOT ANDROID AND NOT IOS) ) OCV_OPTION(WITH_GIGEAPI "Include Smartek GigE support" ON IF (NOT ANDROID AND NOT IOS) ) OCV_OPTION(WITH_QT "Build with Qt Backend support" OFF IF (NOT ANDROID AND NOT IOS) ) diff --git a/cmake/OpenCVFindLibsGrfmt.cmake b/cmake/OpenCVFindLibsGrfmt.cmake index 5988169919..08af604ae9 100644 --- a/cmake/OpenCVFindLibsGrfmt.cmake +++ b/cmake/OpenCVFindLibsGrfmt.cmake @@ -67,7 +67,7 @@ if(NOT TIFF_VERSION_STRING AND TIFF_INCLUDE_DIR) endif() # --- libjpeg (optional) --- -if(WITH_JPEG) +if(WITH_JPEG AND NOT IOS) if(BUILD_JPEG) ocv_clear_vars(JPEG_FOUND) else() @@ -110,7 +110,7 @@ if(NOT JASPER_VERSION_STRING) endif() # --- libpng (optional, should be searched after zlib) --- -if(WITH_PNG) +if(WITH_PNG AND NOT IOS) if(BUILD_PNG) ocv_clear_vars(PNG_FOUND) else() diff --git a/ios/build_framework.py b/ios/build_framework.py index 3f0e85f725..ceef4b71d7 100755 --- a/ios/build_framework.py +++ b/ios/build_framework.py @@ -103,10 +103,10 @@ def put_framework_together(srcroot, dstroot): # TODO ... # make symbolic links - os.symlink(dstdir + "/Headers", "Headers") - os.symlink(dstdir + "/Resources", "Resources") - os.symlink(dstdir + "/opencv2", "opencv2") os.symlink("A", "Versions/Current") + os.symlink("Versions/Current/Headers", "Headers") + os.symlink("Versions/Current/Resources", "Resources") + os.symlink("Versions/Current/opencv2", "opencv2") def build_framework(srcroot, dstroot): diff --git a/modules/world/CMakeLists.txt b/modules/world/CMakeLists.txt index a75037cfc7..23901bf62a 100644 --- a/modules/world/CMakeLists.txt +++ b/modules/world/CMakeLists.txt @@ -80,6 +80,35 @@ foreach(m ${OPENCV_MODULE_${the_module}_DEPS}) endforeach() endforeach() + +macro(ios_include_3party_libs) + foreach(l ${ARGN}) + add_dependencies(${the_module} ${l}) + string(REGEX REPLACE "" "${l}" objpath1 "${CMAKE_BINARY_DIR}/3rdparty/${l}/${objpath0}") + file(GLOB sources ${CMAKE_SOURCE_DIR}/3rdparty/${l}/*.c) + foreach(srcname ${sources}) + if(IS_ABSOLUTE "${srcname}") + file(RELATIVE_PATH srcname "${CMAKE_SOURCE_DIR}/3rdparty/${l}" "${srcname}") + endif() + + string(REPLACE ".." "__" srcname "${srcname}") + get_filename_component(srcname_we ${srcname} NAME_WE) + string(REGEX REPLACE "${srcname_we}" objpath2 "${objpath1}") + string(REGEX REPLACE "${srcname}" objpath3 "${objpath2}") + + list(APPEND objlist "\"${objpath3}\"") + endforeach() # (srcname ${sources}) + endforeach() +endmacro() + +if(IOS AND WITH_PNG) + ios_include_3party_libs(zlib libpng) +endif() + +if(IOS AND WITH_JPEG) + ios_include_3party_libs(libjpeg) +endif() + string(REPLACE ";" " " objlist "${objlist}") if(have_cfg)