Commit f01afdc1 authored by Hugo Lefeuvre's avatar Hugo Lefeuvre

New upstream version 19.10

parent 2472534a
...@@ -2,11 +2,18 @@ ...@@ -2,11 +2,18 @@
/build2/ /build2/
/build_clang/ /build_clang/
\.swp$ \.swp$
\.swo$
\.o$ \.o$
\.a$ \.a$
\.so$
\.orig$ \.orig$
\.obj$ \.obj$
\.pyc$ \.pyc$
^build/
^dist/
^\.cache/
^\.eggs/
^dlib\.egg-info/
^docs/release/ ^docs/release/
^docs/docs/web/ ^docs/docs/web/
^docs/docs/chm/ ^docs/docs/chm/
...@@ -25,3 +32,12 @@ docs/docs/python/functions.txt ...@@ -25,3 +32,12 @@ docs/docs/python/functions.txt
syntax: glob syntax: glob
dlib/test/build64/* dlib/test/build64/*
*.svm *.svm
dlib/test/build_python
dlib/test/test_log.txt
dlib/test/build_vc2015_64/*
dlib/test/build_vc2013_64/*
dlib/test/build_vc2012_64/*
dlib/java/libmyproject.so
dlib/java/myproject.jar
dlib/java/swig_test.class
sudo: required
matrix:
include:
###################
- language: cpp
compiler: clang
os: linux
env:
- VARIANT=test
script:
- dlib/travis/build-and-test.sh
###################
- language: cpp
compiler: clang
os: linux
env:
- VARIANT=examples
script:
- dlib/travis/build-and-test.sh
###################
- language: cpp
compiler: gcc
os: linux
env:
- VARIANT=test
script:
- dlib/travis/build-and-test.sh
###################
- language: cpp
compiler: gcc
os: linux
env:
- VARIANT=tools
script:
- dlib/travis/build-and-test.sh
###################
- language: cpp
compiler: gcc
os: linux
env:
- VARIANT=dlib_all_source_cpp
script:
- dlib/travis/build-and-test.sh
########### test with C++17 ########
- language: cpp
compiler: gcc
os: linux
env:
- VARIANT=test
- CXXFLAGS=-std=c++17
# Need to set MATRIX_EVAL to set CC and CXX env vars. You would
# think you could just set them in the env area like any other, but
# travis is wonky about CC and CXX vars so you have to do it this way.
- MATRIX_EVAL="CC=gcc-7 && CXX=g++-7"
addons:
apt:
sources:
- ubuntu-toolchain-r-test
packages:
- g++-7
script:
- dlib/travis/build-and-test.sh
###################
- language: cpp
compiler: gcc
os: linux
env:
- VARIANT=examples
script:
- dlib/travis/build-and-test.sh
###################
- language: python
python: 2.7
env:
- VARIANT=python-api
script:
- dlib/travis/build-and-test.sh
###################
- language: python
python: 3.5
env:
- VARIANT=python-api
script:
- dlib/travis/build-and-test.sh
###################
# # Disabled because travis's OS X machines take hours (or days) to begin
# running. Or maybe they are just broken entirely. Who knows.
#- language: cpp
# os: osx
# osx_image: xcode9.2
# env:
# - VARIANT=test
# script:
# - dlib/travis/build-and-test.sh
cmake_minimum_required(VERSION 2.8.12)
#############################################################################
# #
# READ examples/CMakeLists.txt TO SEE HOW TO USE DLIB FROM C++ WITH CMAKE #
# #
#############################################################################
get_directory_property(has_parent PARENT_DIRECTORY)
if(NOT has_parent)
# When you call add_subdirectory(dlib) from a parent CMake project dlib's
# CMake scripts will assume you want to statically compile dlib into
# whatever you are building rather than create a standalone copy of dlib.
# This means CMake will build dlib as a static library, disable dlib's
# install targets so they don't clutter your project, and adjust a few other
# minor things that are convenient when statically building dlib as part of
# your own projects.
#
# On the other hand, if there is no parent CMake project or if
# DLIB_IN_PROJECT_BUILD is set to false, CMake will compile dlib as a normal
# standalone library (either shared or static, based on the state of CMake's
# BUILD_SHARED_LIBS flag), and include the usual install targets so you can
# install dlib on your computer via `make install`. Since the only reason
# to build this CMakeLists.txt (the one you are reading right now) by itself
# is if you want to install dlib, we indicate as such by setting
# DLIB_IN_PROJECT_BUILD to false.
set(DLIB_IN_PROJECT_BUILD false)
endif()
add_subdirectory(dlib)
IF YOU ARE REPORTING A BUG OR PROBLEM WITH DLIB THEN FILL OUT THE ENTIRE TEMPLATE BELOW. ISSUES ASKING QUESTIONS ABOUT WHY SOMETHING DOESN'T WORK THAT FAIL TO FILL OUT THE ENTIRE TEMPLATE WILL BE CLOSED.
It is OK to suggest interesting improvements to dlib, even if you are not volunteering to implement them. **However, the issue tracker is not a code writing service, do not ask for someone to write code for you.** E.g. Do not ask for feature improvements to the example programs. **If there is some feature improvement you want in an example program then it's up to you to write it**.
Before you ask a question, check Google for a solution, [the dlib FAQ](http://dlib.net/faq.html), or consult the dlib documentation. Every single function in dlib is documented in detail. If you obviously haven't read the documentation your issue will be closed.
If you aren't reporting a bug or problem with dlib then delete this template and write whatever you want here.
<!-- ================================================================== -->
<!-- ================== BUG/PROBLEM REPORT TEMPLATE ================== -->
<!-- ================================================================== -->
<!-- Delete the above instructions and then provide a general summary of the issue in the Title above. Then fill out the template below. FAILURE TO FILL OUT EVERY PART WILL RESULT IN YOUR ISSUE BEING CLOSED -->
## Expected Behavior
<!--- Tell us what should happen. What were you doing? What part of dlib are you using? What do you think should happen? -->
## Current Behavior
<!--- Tell us what happens instead of the expected behavior. If you get an error, include the entire error message in the bug report. DO NOT POST SCREEN SHOTS. Paste in the text instead. If the issue is some kind of build problem, include the entire CMake output along with the error message. -->
## Steps to Reproduce
<!--- Provide an unambiguous set of steps to reproduce this problem. Include code to reproduce, if relevant -->
* **Version**: <!-- What version of dlib? -->
* **Where did you get dlib**: <!-- Did you get it from an official source like dlib.net, this github repo, or somewhere else? -->
* **Platform**: <!-- include something like `lsb_release -a` output, or if Windows, version and 32-bit or
64-bit -->
* **Compiler**: <!-- What compiler are you using? What version of that compiler? -->
...@@ -5,18 +5,11 @@ ...@@ -5,18 +5,11 @@
include MANIFEST.in include MANIFEST.in
include setup.py include setup.py
include README.txt include README.md
# sources # sources
recursive-include dlib ** recursive-include dlib **
recursive-exclude dlib/test ** recursive-include python_examples *.txt *.py
recursive-exclude dlib/build **
recursive-include docs **
recursive-include python_examples *.txt *.py *.bat
recursive-exclude python_examples/build **
recursive-include tools/python ** recursive-include tools/python **
recursive-exclude tools/python/build **
# dlib package
recursive-include dist/dlib **
# dlib C++ library [![Travis Status](https://travis-ci.org/davisking/dlib.svg?branch=master)](https://travis-ci.org/davisking/dlib)
Dlib is a modern C++ toolkit containing machine learning algorithms and tools for creating complex software in C++ to solve real world problems. See [http://dlib.net](http://dlib.net) for the main project documentation and API reference.
## Compiling dlib C++ example programs
Go into the examples folder and type:
```bash
mkdir build; cd build; cmake .. ; cmake --build .
```
That will build all the examples.
If you have a CPU that supports AVX instructions then turn them on like this:
```bash
mkdir build; cd build; cmake .. -DUSE_AVX_INSTRUCTIONS=1; cmake --build .
```
Doing so will make some things run faster.
Finally, Visual Studio users should usually do everything in 64bit mode. By default Visual Studio is 32bit, both in its outputs and its own execution, so you have to explicitly tell it to use 64bits. Since it's not the 1990s anymore you probably want to use 64bits. Do that with a cmake invocation like this:
```bash
cmake .. -G "Visual Studio 14 2015 Win64" -T host=x64
```
## Compiling your own C++ programs that use dlib
The examples folder has a [CMake tutorial](https://github.com/davisking/dlib/blob/master/examples/CMakeLists.txt) that tells you what to do. There are also additional instructions on the [dlib web site](http://dlib.net/compile.html).
## Compiling dlib Python API
Before you can run the Python example programs you must compile dlib. Type:
```bash
python setup.py install
```
or type
```bash
python setup.py install --yes USE_AVX_INSTRUCTIONS
```
if you have a CPU that supports AVX instructions, since this makes some things run faster.
## Running the unit test suite
Type the following to compile and run the dlib unit test suite:
```bash
cd dlib/test
mkdir build
cd build
cmake ..
cmake --build . --config Release
./dtest --runall
```
Note that on windows your compiler might put the test executable in a subfolder called `Release`. If that's the case then you have to go to that folder before running the test.
This library is licensed under the Boost Software License, which can be found in [dlib/LICENSE.txt](https://github.com/davisking/dlib/blob/master/dlib/LICENSE.txt). The long and short of the license is that you can use dlib however you like, even in closed source commercial software.
## dlib sponsors
This research is based in part upon work supported by the Office of the Director of National Intelligence (ODNI), Intelligence Advanced Research Projects Activity (IARPA) under contract number 2014-14071600010. The views and conclusions contained herein are those of the authors and should not be interpreted as necessarily representing the official policies or endorsements, either expressed or implied, of ODNI, IARPA, or the U.S. Government.
dlib C++ library
Dlib is a modern C++ toolkit containing machine learning algorithms and tools
for creating complex software in C++ to solve real world problems. See
http://dlib.net for the main project documentation and API reference.
COMPILING DLIB C++ EXAMPLE PROGRAMS
Go into the examples folder and type:
mkdir build; cd build; cmake .. ; cmake --build .
That will build all the examples. If you have a CPU that supports AVX
instructions then turn them on like this:
mkdir build; cd build; cmake .. -DUSE_AVX_INSTRUCTIONS=1; cmake --build .
Doing so will make some things run faster.
COMPILING DLIB Python API
Before you can run the Python example programs you must compile dlib. Type:
python setup.py install
or type
python setup.py install --yes USE_AVX_INSTRUCTIONS
if you have a CPU that supports AVX instructions, since this makes some
things run faster.
RUNNING THE UNIT TEST SUITE
Type the following to compile and run the dlib unit test suite:
cd dlib/test
mkdir build
cd build
cmake ..
cmake --build . --config Release
./dtest --runall
Note that on windows your compiler might put the test executable in a
subfolder called Release. If that's the case then you have to go to that
folder before running the test.
This library is licensed under the Boost Software License, which can be found
in dlib/LICENSE.txt. The long and short of the license is that you can use
dlib however you like, even in closed source commercial software.
Dlib Sponsors:
This code development was funded by the Office of the Director of National
Intelligence (ODNI), Intelligence Advanced Research Projects Activity (IARPA),
via IARPA R&D Contract No. 2014-14071600010
This diff is collapsed.
# This is a CMake file that sets up the add_python_module() macro. This macro
# lets you easily make python modules that use dlib.
#
# The macro takes the module name as its first argument and then a list of
# source files to compile into the module. See ../tools/python/CMakeLists.txt
# for an example.
#
# It also sets up a macro called install_${module_name}_to() where
# ${module_name} is whatever you named your module. This install_*_to() macro
# takes a folder name and creates an install target that will copy the compiled
# python module to that folder when you run "make install". Note that the path
# given to install_*_to() is relative to your CMakeLists.txt file.
#
option(PYTHON3 "Build a Python3 compatible library rather than Python2." OFF)
# Avoid cmake warnings about changes in behavior of some Mac OS X path
# variable we don't care about.
if (POLICY CMP0042)
cmake_policy(SET CMP0042 NEW)
endif()
# Sometimes a computer will have multiple python verions installed. So in this
# block of code we find the one in the user's path and add its home folder into
# cmake's search path. That way it will use that version of python first.
find_program(PYTHON_EXECUTABLE python)
# Resolve symbolic links, hopefully this will give us a path in the proper
# python home directory.
get_filename_component(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE} REALPATH)
# Pick out the parent directories
get_filename_component(PYTHON_PATH ${PYTHON_EXECUTABLE} PATH)
get_filename_component(PYTHON_PATH ${PYTHON_PATH} PATH)
set(CMAKE_PREFIX_PATH ${PYTHON_PATH})
# To avoid dll hell, always link everything statically when compiling in
# visual studio. This way, the resulting library won't depend on a bunch
# of other dll files and can be safely copied to someone elese's computer
# and expected to run.
if (MSVC)
string(REGEX REPLACE "add_python_module$" "" dlib_path ${CMAKE_CURRENT_LIST_FILE})
include(${dlib_path}/tell_visual_studio_to_use_static_runtime.cmake)
add_definitions(-DBOOST_PYTHON_STATIC_LIB)
SET(Boost_USE_STATIC_LIBS ON)
SET(Boost_USE_MULTITHREADED ON)
SET(Boost_USE_STATIC_RUNTIME ON)
endif()
set(Boost_NO_BOOST_CMAKE ON)
if (NOT WIN32)
set(BOOST_LIBRARYDIR ${BOOST_LIBRARYDIR} $ENV{BOOST_LIBRARYDIR}
/usr/lib/x86_64-linux-gnu/)
endif()
if (PYTHON3)
# On some systems the boost python3 module is called python-py34 so check
# for that one first.
FIND_PACKAGE(Boost 1.41.0 COMPONENTS python-py34 )
if (NOT Boost_FOUND)
FIND_PACKAGE(Boost 1.41.0 COMPONENTS python)
endif()
FIND_PACKAGE(PythonLibs 3.4 REQUIRED)
else()
FIND_PACKAGE(Boost 1.41.0 COMPONENTS python)
FIND_PACKAGE(PythonLibs 2.6 REQUIRED)
endif()
if (NOT Boost_FOUND)
message(STATUS " *****************************************************************************************************")
if (WIN32)
message(STATUS "We couldn't find the right version of boost python. If you installed boost and you are still "
"getting this error then you might have installed a version of boost that was compiled with a different "
"version of visual studio than the one you are using. So you have to make sure that the version of "
"visual studio is the same version that was used to compile the copy of boost you are using.")
message(STATUS " Set the BOOST_ROOT and BOOST_LIBRARYDIR environment variables before running cmake. ")
message(STATUS " E.g. Some