zoukankan      html  css  js  c++  java
  • windows 10上源码编译dlib教程 | compile dlib on windows 10

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

    compile dlib on windows 10

    Series

    Guide

    compile

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

    with options

    CMAKE_INSTALL_PREFIX  C:/Program Files/dlib
    

    configure and compile with Visual Studio 2015 and install to C:/Program Files/dlib.

    By default, dlib19.10.0_release_64bit_msvc1900.lib will be generated.

    CMakeLists.txt

    cmake_minimum_required(VERSION 2.8.12)
    # Every project needs a name.  We call this the "examples" project.
    project(examples)
    
    
    # Tell cmake we will need dlib.  This command will pull in dlib and compile it
    # into your project.  Note that you don't need to compile or install dlib.  All
    # cmake needs is the dlib source code folder and it will take care of everything.
    add_subdirectory(../dlib dlib_build)
    
    add_executable(demo demo.cpp)
    target_link_libraries(demo dlib::dlib)
    

    or

    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)
    

    dlib for python api

    cd tools/python
    mkdir build && cd build
    cmake-gui ..
    

    compile dlib_python with Visual Studio 2015 and dlib.pyd will be generated.

    copy dlib.pyd to C:Python27Libsite-packages.

    test dlib for python

    import dlib
    dir(dlib)
    

    Reference

    History

    • 20180330: created.

    Copyright

  • 相关阅读:
    google 以图搜图
    一个idear
    负责
    腾讯笔试
    迅雷笔试题
    如何删除表中重复的字段
    sed的使用
    C++ Html解析器HtmlCxx用户手册和源代码解析
    makefile从无到有
    深入理解函数指针
  • 原文地址:https://www.cnblogs.com/kezunlin/p/11841722.html
Copyright © 2011-2022 走看看