mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Build Python libs
This commit is contained in:
@ -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)
|
||||
|
15
caffe2/python/CMakeLists.txt
Normal file
15
caffe2/python/CMakeLists.txt
Normal 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})
|
@ -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})
|
||||
|
Reference in New Issue
Block a user