how to build DLIB for iOS

走远了吗. 提交于 2019-11-28 17:36:05

I finally figured out how to do this:

Requirements

  • X11 (on a mac you can just open the X11 app and if X11 isn't installed it'll take you to the download).
  • Xcode
  • cmake (you can use home-brew for that)

Steps

  • In terminal make the lib-xx.xx/examples your root
  • Run:

    mkdir build

    cd build

    cmake -G Xcode ..

    cmake --build . --config Release

This will create a folder called dlib_build in which you can find an Xcode project that compiles the library. In the build settings of that Xcode project you can set the build architecture and SDK for any Xcode supported OS you like!

EDIT:

You have to include a lot of custom compiler flags and 3rd party libraries to get dlib to work in a project. Check out the examples.xcproject build settings.

To compliment RASS's answer, I am attaching screenshots showing how to change this to and from an iOS and OSX lib

After opening the project,

  1. Select the project file from the project navigator
  2. Select the dlib target all the way down the bottom
  3. Select 'Build Settings'
  4. Expand 'Base SDK' drop down

  1. Select either iOS or macOS (OSX)

I hope this helps some people out! gl

Rob Sanders and mylogon already show how to build dlib for ios, here is how to use it:

  1. add libdlib.a to project, and add path to library search paths
  2. add all source to include directory(do not add to project), and add path to header search paths.
  3. add accelerate framework, which contains blas symbols.
  4. add preprocessor macros, from building settings, "custom compiler flag"/"other c flags". these macros make sure the header files match the lib.

    -DDLIB_JPEG_SUPPORT
    -DDLIB_NO_GUI_SUPPORT
    -DNDEBUG
    -DDLIB_USE_BLAS
    -DDLIB_USE_LAPACK
    
标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!