"doc/vscode:/vscode.git/clone" did not exist on "c92a300bd8bee05144add05365e24b6cb2db82e7"
CMakeLists.txt 2.17 KB
Newer Older
1

2
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12)
3

4

5
set(USE_SSE4_INSTRUCTIONS ON CACHE BOOL "Use SSE4 instructions")
6
7
8
# Make DLIB_ASSERT statements not abort the python interpreter, but just return an error.
add_definitions(-DDLIB_NO_ABORT_ON_2ND_FATAL_ERROR)

9
include(../../dlib/cmake_utils/add_python_module)
10

11
# Test for numpy
Davis King's avatar
Davis King committed
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
find_package(PythonInterp)
if(PYTHONINTERP_FOUND)
   execute_process( COMMAND ${PYTHON_EXECUTABLE} -c "import numpy" OUTPUT_QUIET ERROR_QUIET RESULT_VARIABLE NUMPYRC)
   if(NUMPYRC EQUAL 1)
      message(WARNING "Numpy not found. Functions that return numpy arrays will throw exceptions!")
   else()
      message(STATUS "Found Python with installed numpy package")
      execute_process( COMMAND ${PYTHON_EXECUTABLE} -c "import sys; from numpy import get_include; sys.stdout.write(get_include())" OUTPUT_VARIABLE NUMPY_INCLUDE_PATH)
      message(STATUS "Numpy include path '${NUMPY_INCLUDE_PATH}'")
      include_directories(${NUMPY_INCLUDE_PATH})
   endif()
else()
   message(WARNING "Numpy not found. Functions that return numpy arrays will throw exceptions!")
   set(NUMPYRC 1)
endif()
27

28
29
add_definitions(-DDLIB_VERSION=${DLIB_VERSION})

Davis King's avatar
Davis King committed
30
# Tell cmake to compile all these cpp files into a dlib python module.
31
32
33
set(python_srcs
   src/dlib.cpp
   src/matrix.cpp
34
   src/vector.cpp
35
   src/svm_c_trainer.cpp
36
   src/svm_rank_trainer.cpp
Davis King's avatar
Davis King committed
37
   src/decision_functions.cpp
Davis King's avatar
Davis King committed
38
39
   src/other.cpp
   src/basic.cpp
Davis King's avatar
Davis King committed
40
   src/cca.cpp
41
   src/sequence_segmenter.cpp
42
   src/svm_struct.cpp
43
   src/image.cpp
44
   src/rectangles.cpp
45
   src/object_detection.cpp
46
   src/shape_predictor.cpp
47
   src/correlation_tracker.cpp
48
   src/face_recognition.cpp
49
   src/cnn_face_detector.cpp
50
   src/global_optimization.cpp
51
52
)

53
# Only add the Numpy returning functions if Numpy is present
Davis King's avatar
Davis King committed
54
55
56
57
58
if(NUMPYRC EQUAL 1)
   list(APPEND python_srcs src/numpy_returns_stub.cpp)
else()
   list(APPEND python_srcs src/numpy_returns.cpp)
endif()
59

60
61
62
# Only add the GUI module if requested
if(NOT ${DLIB_NO_GUI_SUPPORT})
   list(APPEND python_srcs src/gui.cpp)
Davis King's avatar
Davis King committed
63
endif()
64
65

add_python_module(dlib ${python_srcs})
66

67
# When you run "make install" we will copy the compiled dlib.so (or dlib.pyd)
Davis King's avatar
Davis King committed
68
# library file to the python_examples folder.
69
install_dlib_to(../../python_examples)