Permalink
Browse files

enabled png and jpeg for iOS

  • Loading branch information...
Anatoly Baksheev
Anatoly Baksheev committed Mar 24, 2013
1 parent ec8aec0 commit 7fa01e3fcc9eaac70871e7f3cff52bdb1a1b1544
Showing with 36 additions and 7 deletions.
  1. +2 −2 CMakeLists.txt
  2. +2 −2 cmake/OpenCVFindLibsGrfmt.cmake
  3. +3 −3 ios/build_framework.py
  4. +29 −0 modules/world/CMakeLists.txt
View
@@ -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) )
@@ -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()
View
@@ -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):
@@ -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 "<MODULE_NAME>" "${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 <SRC_NAME_WE> "${srcname_we}" objpath2 "${objpath1}")
+ string(REGEX REPLACE <RELATIVE_SRC_NAME> "${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)

0 comments on commit 7fa01e3

Please sign in to comment.