Commit 5bae8c7a947757e85218be5ec97de6da135b629b
Merge pull request #378 from biometrics/dlib_autobuild
automatically build dlib by default
Showing
5 changed files
with
15 additions
and
6 deletions
.gitignore
CMakeLists.txt
| @@ -42,6 +42,8 @@ else() | @@ -42,6 +42,8 @@ else() | ||
| 42 | set(BITNESS 32) | 42 | set(BITNESS 32) |
| 43 | endif() | 43 | endif() |
| 44 | 44 | ||
| 45 | +include(ExternalProject) | ||
| 46 | + | ||
| 45 | # Define resources | 47 | # Define resources |
| 46 | if(WIN32) | 48 | if(WIN32) |
| 47 | set(CPACK_PACKAGE_ICON "${BR_SHARE_DIR}\\\\openbr_small.png") | 49 | set(CPACK_PACKAGE_ICON "${BR_SHARE_DIR}\\\\openbr_small.png") |
openbr/plugins/classification/dlib.cpp
| @@ -2,11 +2,13 @@ | @@ -2,11 +2,13 @@ | ||
| 2 | #include "openbr/core/qtutils.h" | 2 | #include "openbr/core/qtutils.h" |
| 3 | #include "openbr/core/eigenutils.h" | 3 | #include "openbr/core/eigenutils.h" |
| 4 | 4 | ||
| 5 | +#define DLIB_NO_GUI_SUPPORT | ||
| 5 | #include <dlib/image_processing/frontal_face_detector.h> | 6 | #include <dlib/image_processing/frontal_face_detector.h> |
| 6 | #include <dlib/svm_threaded.h> | 7 | #include <dlib/svm_threaded.h> |
| 7 | #include <dlib/image_processing.h> | 8 | #include <dlib/image_processing.h> |
| 8 | #include <dlib/image_io.h> | 9 | #include <dlib/image_io.h> |
| 9 | #include <dlib/opencv.h> | 10 | #include <dlib/opencv.h> |
| 11 | +#include <dlib/all/source.cpp> | ||
| 10 | 12 | ||
| 11 | #include <QTemporaryFile> | 13 | #include <QTemporaryFile> |
| 12 | 14 |
openbr/plugins/cmake/dlib.cmake
| 1 | -set(BR_WITH_DLIB OFF CACHE BOOL "Build with DLib") | 1 | +set(BR_WITH_DLIB ON CACHE BOOL "Build with DLib") |
| 2 | 2 | ||
| 3 | if(${BR_WITH_DLIB}) | 3 | if(${BR_WITH_DLIB}) |
| 4 | - find_package(DLib REQUIRED) | ||
| 5 | - add_definitions(-DDLIB_NO_GUI_SUPPORT) | ||
| 6 | - set(BR_THIRDPARTY_SRC ${BR_THIRDPARTY_SRC} ${DLib_DIR}/dlib/all/source.cpp) | ||
| 7 | - install(DIRECTORY ${DLib_DIR}/models/ DESTINATION share/openbr/models/dlib) | 4 | + ExternalProject_Add(dlib |
| 5 | + URL http://downloads.sourceforge.net/project/dclib/dlib/v18.16/dlib-18.16.tar.bz2 | ||
| 6 | + URL_MD5 e9e5449bc25370afce2d254327afac99 | ||
| 7 | + SOURCE_DIR "${CMAKE_SOURCE_DIR}/3rdparty/dlib-18.16" | ||
| 8 | + CONFIGURE_COMMAND "" | ||
| 9 | + BUILD_COMMAND "" | ||
| 10 | + INSTALL_COMMAND "") | ||
| 11 | + include_directories("${CMAKE_SOURCE_DIR}/3rdparty/dlib-18.16") | ||
| 8 | else() | 12 | else() |
| 9 | set(BR_EXCLUDED_PLUGINS ${BR_EXCLUDED_PLUGINS} plugins/classification/dlib.cpp) | 13 | set(BR_EXCLUDED_PLUGINS ${BR_EXCLUDED_PLUGINS} plugins/classification/dlib.cpp) |
| 10 | endif() | 14 | endif() |