Build Python libs

This commit is contained in:
Simon Layton
2016-12-06 13:06:16 -05:00
parent 52f09fe2c9
commit 2610d62813
3 changed files with 29 additions and 0 deletions

View File

@ -94,3 +94,6 @@ add_executable(Caffe2_CPU_TEST ${Caffe2_CPU_TEST_SRCS})
target_link_libraries(Caffe2_CPU_TEST Caffe2_CPU gtest glog atlas cblas)
target_compile_features(Caffe2_CPU_TEST PRIVATE cxx_range_for)
# ---[ Python
add_subdirectory(python)

View File

@ -0,0 +1,15 @@
set(Caffe2_PYTHON_CPU_SRC
"/pybind_state.cc"
)
set(Caffe2_PYTHON_GPU_SRC
"/pybind_state.cc"
"/pybind_state_gpu.cc"
)
prepend(Caffe2_PYTHON_CPU_SRC ${CMAKE_CURRENT_SOURCE_DIR} ${Caffe2_PYTHON_CPU_SRC})
prepend(Caffe2_PYTHON_GPU_SRC ${CMAKE_CURRENT_SOURCE_DIR} ${Caffe2_PYTHON_GPU_SRC})
add_library(Caffe2_PYTHON_CPU SHARED ${Caffe2_PYTHON_CPU_SRC})
# target_link_libraries(Caffe2_PYTHON_CPU)
add_library(Caffe2_PYTHON_GPU_SHARED SHARED ${Caffe2_PYTHON_GPU_SRC})

View File

@ -80,3 +80,14 @@ endif()
# ---[ EIGEN
include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/third_party/eigen)
# ---[ pybind11
include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/third_party/pybind11/include)
# ---[ Python + Numpy
find_package(PythonInterp 2.7)
find_package(PythonLibs 2.7)
find_package(NumPy REQUIRED)
include_directories(SYSTEM ${PYTHON_INCLUDE_DIRS} ${NUMPY_INCLUDE_DIRS})
list(APPEND Caffe2_LINKER_LIBS ${PYTHON_LIBRARIES})