How to build OpenCV 2.4.9 for iOS?

后端 未结 2 1173
情书的邮戳
情书的邮戳 2021-01-12 09:06

I am following these instructions which belong to the openCV doc, but they are really outdated: iOS4 or iOS5 is mentioned, XCode 4.2 installed in /Developer, etc..

I

2条回答
  •  佛祖请我去吃肉
    2021-01-12 09:34

    As per 3rdParty/libjpeg/CMakeLists.txt:12, jmemansi.c is excluded from build :

    if(ANDROID OR IOS)
      ocv_list_filterout(lib_srcs jmemansi.c)
    else()
      ocv_list_filterout(lib_srcs jmemnobs.c)
    endif()
    

    However, in world module build, the corresponding object file is not excluded from linker input. This can be fixed by filtering out jmemansi.o from linker input :

    modules/world/CMakeLists.txt:84

    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()
      ocv_list_filterout(objlist jmemansi) # <<= dirty fix
    endmacro()
    

提交回复
热议问题