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

查看:1291
本文介绍了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 flag to 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天全站免登陆