forked from BVLC/caffe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
58 lines (40 loc) · 2.02 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
project( Python )
# Python
find_package(PythonLibs 2.7 REQUIRED)
# Numpy
find_package(NumPy REQUIRED)
# Boost.Python
find_package(Boost 1.46 COMPONENTS python REQUIRED)
#In case you have both python2 and python3 installed the quickest way to
#compile pycaffe with cmake is to replace the following hardcoded paths.
#Althernativley the Find* scripts could be rewritten to support choice of
#of python version.
#if(${PYTHONLIBS_VERSION_STRING} MATCHES "^[3-9]+\\.[0-9]+(\\.[0-9]+.*)?$")
#
# set( PYTHON_INCLUDE_DIRS "/usr/include/python2.7")
# set( PYTHON_LIBRARIES "/usr/lib64/libpython2.7.so")
# set( NUMPY_INCLUDE_DIRS "/usr/lib64/python2.7/site-packages/numpy/core/include/")
# set( PYTHON_LIBRARIES "/usr/lib64/python2.7/site-packages/numpy/lib/")
# set(Boost_LIBRARIES "/usr/lib64/libboost_python-2.7-mt.so")
#
# message( "Warning: cmake found python3 by default, switching to hardcoded paths")
#
# message( "PYTHON_INCLUDE_DIRS =/usr/include/python2.7")
# message( "PYTHON_LIBRARIES =/usr/lib64/libpython2.7.so")
# message( "NUMPY_INCLUDE_DIRS =/usr/lib64/python2.7/site-packages/numpy/core/include/")
# message( "PYTHON_LIBRARIES =/usr/lib64/python2.7/site-packages/numpy/lib/")
# message( "Boost_LIBRARIES =/usr/lib64/libboost_python-2.7-mt.so")
#endif()
include_directories(${PYTHON_INCLUDE_DIRS} ${NUMPY_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS})
file(GLOB_RECURSE Python_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
add_library(pycaffe SHARED ${Python_SOURCES})
add_dependencies(pycaffe protoPy)
target_link_libraries(pycaffe ${CAFFE_STATIC_LINK} ${PYTHON_LIBRARIES} ${Boost_LIBRARIES})
set_target_properties(pycaffe PROPERTIES PREFIX "")
set_target_properties(pycaffe PROPERTIES OUTPUT_NAME "_caffe")
### Install #############################################################
install(DIRECTORY caffe DESTINATION python)
install(FILES requirements.txt DESTINATION python)
#This installs a library named "libpycaffe.so"
install(TARGETS pycaffe DESTINATION python/caffe)