kezunlin · 2019年12月09日

ubuntu 16.04上源码编译dlib教程 | compile dlib on ubuntu 16.04

本文首发于个人博客https://kezunlin.me/post/c6ead512/,欢迎阅读!

compile dlib on ubuntu 16.04

Series

Guide

compile

git clone https://github.com/davisking/dlib.git
cd dlib && mkdir build && cd build 
cmake-gui ..

with options

CMAKE_INSTALL_PREFIX /usr/local
CUDA 9.2 + cuDNN 7.1.4

generate

Found CUDA: /usr/local/cuda (found suitable version "9.2", minimum required is "7.5") 
Looking for cuDNN install...
Found cuDNN: /usr/local/cuda/lib64/libcudnn.so
Building a CUDA test project to see if your compiler is compatible with CUDA...
Checking if you have the right version of cuDNN installed.
Enabling CUDA support for dlib.  DLIB WILL USE CUDA
C++11 activated.

make and install

make -j8 
sudo make install

output

[100%] Linking CXX static library libdlib.a
[100%] Built target dlib
generate static library libdlib.a

CMakeLists.txt

find_package(dlib REQUIRED)

if(MSVC)
    set(dlib_LIBRARIES "C:/Program Files/dlib/lib/dlib.lib") # replace dlib::dlib
else()
endif(MSVC)
# ${dlib_INCLUDE_DIRS} and ${dlib_LIBRARIES} are deprecated, simply use target_link_libraries(your_app dlib::dlib)
MESSAGE( [Main] " dlib_INCLUDE_DIRS = ${dlib_INCLUDE_DIRS}") 
MESSAGE( [Main] " dlib_LIBRARIES = ${dlib_LIBRARIES}")   


add_executable(demo demo.cpp)
#target_link_libraries(demo ${dlib_LIBRARIES})
target_link_libraries(demo dlib::dlib)

Reference

History

  • 20181127: created.

Copyright

推荐阅读
关注数
2
文章数
52
[链接] C++,Python. Computer Vision and Deep Learning.
目录
极术微信服务号
关注极术微信号
实时接收点赞提醒和评论通知
安谋科技学堂公众号
关注安谋科技学堂
实时获取安谋科技及 Arm 教学资源
安谋科技招聘公众号
关注安谋科技招聘
实时获取安谋科技中国职位信息