OpenCV 作为静态库(cmake 选项) [英] OpenCV as a static library (cmake options)

查看:86
本文介绍了OpenCV 作为静态库(cmake 选项)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在嵌入式系统中使用 OpenCV 库,我需要使用 OpenCV 作为静态库来编译我的项目.

I want to use OpenCV library in an embedded system and I need to compile my project using OpenCV as a static library.

如何使用 cmake 选项创建库?

How can I create the library using cmake options ?

推荐答案

要将 OpenCV 构建为静态库,您需要将 BUILD_SHARED_LIBS 标志设置为 false/off:

To build OpenCV as static library you need to set BUILD_SHARED_LIBS flag to false/off:

cmake -DBUILD_SHARED_LIBS=OFF ..

但我认为这对您的任务来说还不够,因为您实际上需要为您的架构交叉编译库.在 Android 或 IOS 的情况下,此类端口已经存在,您可以简单地使用它.如果是其他平台,您需要创建自己的 cmake 工具链文件以进行交叉编译,并可能在 OpenCV 构建系统中进行一些修复.

But I think it is not enough for your task because you actually need to cross-compile library for you architecture. In case of Android or IOS such port already exists and you can simply use it. In case of another platform you need to create your own cmake toolchain file for cross-compiling and probably make a number of fixes in OpenCV build system.

这篇关于OpenCV 作为静态库(cmake 选项)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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