mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
cmake: make python dependencies separate from the C++ dependencies
This commit is contained in:
@ -97,13 +97,13 @@ endif()
|
||||
# ---[ Python.
|
||||
add_library(caffe2_pybind11_state SHARED ${Caffe2_CPU_PYTHON_SRCS})
|
||||
set_target_properties(caffe2_pybind11_state PROPERTIES PREFIX "")
|
||||
target_link_libraries(caffe2_pybind11_state ${Caffe2_MAIN_LIBS} ${Caffe2_DEPENDENCY_LIBS})
|
||||
target_link_libraries(caffe2_pybind11_state ${Caffe2_MAIN_LIBS} ${Caffe2_DEPENDENCY_LIBS} ${Caffe2_PYTHON_DEPENDENCY_LIBS})
|
||||
install(TARGETS caffe2_pybind11_state DESTINATION ${CMAKE_INSTALL_PREFIX}/caffe2/python)
|
||||
|
||||
if(HAVE_CUDA)
|
||||
add_library(caffe2_pybind11_state_gpu SHARED ${Caffe2_GPU_PYTHON_SRCS})
|
||||
set_target_properties(caffe2_pybind11_state_gpu PROPERTIES PREFIX "")
|
||||
target_link_libraries(caffe2_pybind11_state_gpu ${Caffe2_MAIN_LIBS} ${Caffe2_DEPENDENCY_LIBS})
|
||||
target_link_libraries(caffe2_pybind11_state_gpu ${Caffe2_MAIN_LIBS} ${Caffe2_DEPENDENCY_LIBS} ${Caffe2_PYTHON_DEPENDENCY_LIBS})
|
||||
install(TARGETS caffe2_pybind11_state_gpu DESTINATION ${CMAKE_INSTALL_PREFIX}/caffe2/python)
|
||||
endif()
|
||||
|
||||
|
@ -2,7 +2,8 @@ if(USE_MPI)
|
||||
set(Caffe2_MPI_CPU_SRC
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/mpi_common.cc"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/mpi_ops.cc"
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/mpi_python.cc"
|
||||
# TODO: properly compile this together with python.
|
||||
# "${CMAKE_CURRENT_SOURCE_DIR}/mpi_python.cc"
|
||||
)
|
||||
set(Caffe2_MPI_GPU_SRC
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/mpi_ops_gpu.cc"
|
||||
|
@ -1,5 +1,6 @@
|
||||
# This list is required for static linking and exported to Caffe2Config.cmake
|
||||
set(Caffe2_DEPENDENCY_LIBS "")
|
||||
set(Caffe2_PYTHON_DEPENDENCY_LIBS "")
|
||||
|
||||
# ---[ Custom Protobuf
|
||||
include("cmake/ProtoBuf.cmake")
|
||||
@ -113,7 +114,7 @@ find_package(PythonLibs 2.7)
|
||||
find_package(NumPy REQUIRED)
|
||||
|
||||
include_directories(SYSTEM ${PYTHON_INCLUDE_DIRS} ${NUMPY_INCLUDE_DIR})
|
||||
list(APPEND Caffe2_DEPENDENCY_LIBS ${PYTHON_LIBRARIES})
|
||||
list(APPEND Caffe2_PYTHON_DEPENDENCY_LIBS ${PYTHON_LIBRARIES})
|
||||
|
||||
# ---[ pybind11
|
||||
include_directories(SYSTEM ${CMAKE_SOURCE_DIR}/third_party/pybind11/include)
|
||||
|
Reference in New Issue
Block a user