dlib交叉编译到arm

dlib交叉编译到arm

使用dlib是很方便的,开发者可以将其视为一个工具来使用,看其说明:

High Quality Portable Code
Good unit test coverage. The ratio of unit test lines of code to library lines of code is about 1 to 4.
The library is tested regularly on MS Windows, Linux, and Mac OS X systems. However, it should work on any POSIX system and has been used on Solaris, HPUX, and the BSDs.
No other packages are required to use the library. Only APIs that are provided by an out of the box OS are needed. 
There is no installation or configure step needed before you can use the library. See the How to compile page for details.
All operating system specific code is isolated inside the OS abstraction layers which are kept as small as possible. The rest of the library is either layered on top of the OS abstraction layers or is pure ISO standard C++.

看这一句:

There is no installation or configure step needed before you can use the library. See the How to compile page for details.

所以,根据dlib写的代码,一般直接静态链接到dlib的静态库,而编译dlib的静态库也很简单,一个cmake就可以了。由此可见,这里很方便。

这里简单记录交叉编译example的过程。
1、增加交叉编译配置文件
这个在之前opencv以前说过了,也是照抄即可
2、编辑example的CMakeLists.txt
编辑之前是这样的:


  cmake_minimum_required(VERSION 2.8.4)

  PROJECT(examples)

  include(../dlib/cmake)
...

编辑为:


   include(./toolchainfile.cmake)
   set(pthreadlib /opt/hisi-linux/x86-arm/arm-hisiv300-linux/target/a7_softfp_neon-vfpv4/libpthread.so.0)

   cmake_minimum_required(VERSION 2.8.4)

  PROJECT(examples)

  include(../dlib/cmake)

除了增加了一个交叉编译的设定文件外,还增加了一个pthreadlib的路径。这个是因为需要编译dlib的时候需要依赖这个库。

因为板子上没有窗口相关的库,所以,不能使用那些用到了x11的接口。

而直接使用g++编译也很简单,如(在example目录):
arm-hisiv300-linux-g++ -O3 -I.. ../dlib/all/source.cpp -lpthread timer_ex.cpp -DDLIB_NO_GUI_SUPPORT=1

那个source.cpp就是dlib的所有了,通过各中宏来控制选择各种特性。

评论 6
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值