如何为 iOS 构建 DLIB [英] how to build DLIB for iOS

查看:50
本文介绍了如何为 iOS 构建 DLIB的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试为 iOS 项目构建 DLIB.运行 cmake 会生成一个 libdlib.a 和一系列 .o 文件.

I'm trying to build DLIB for an iOS project. Running the cmake results in a libdlib.a and a load of .o files.

当我将库添加到 Xcode 项目时,我收到警告说该库尚未为 arm64 构建.

When I add the library to an Xcode project I get warning that the library hasn't been built for arm64.

我的问题分为两部分:

  1. 我如何为 iOS 构建 DLIB(我尝试了 cmake **path_to_source** -DCMAKE_OSX_ARCHITECTURE="arm64" 但它导致了大量错误,例如 unknown type name '__uint32_t'; 没有你的意思是'__uint128_t')?
  2. 运行 cmake 时构建的所有 .o 文件的目的是什么?我需要将它们包含在 Xcode 项目中吗?
  1. How can I build DLIB for iOS (I tried cmake **path_to_source** -DCMAKE_OSX_ARCHITECTURE="arm64" but it caused loads of errors e.g. unknown type name '__uint32_t'; did you mean '__uint128_t')?
  2. What is the purpose of all the .o files that get built when you run cmake? Do I need to include them in an Xcode project?

推荐答案

我终于想出了怎么做:

要求

  • X11(在 Mac 上,您只需打开 X11 应用程序,如果未安装 X11,它会带您进行下载).
  • Xcode
  • cmake(你可以使用自制软件)
  • 步骤

    • 在终端中将 lib-xx.xx/examples 作为根目录
    • 运行:

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

        mkdir 构建

        cd build

        cmake -G Xcode ..

        cmake --build .--config 发布

        这将创建一个名为 dlib_build 的文件夹,您可以在其中找到一个编译库的 Xcode 项目.在该 Xcode 项目的构建设置中,您可以为您喜欢的任何 Xcode 支持的操作系统设置构建架构和 SDK!

        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!

        您必须包含大量自定义编译器标志和第 3 方库才能使 dlib 在项目中工作.查看 examples.xcproject 构建设置.

        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.

        这篇关于如何为 iOS 构建 DLIB的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆