Skip to content

Commit 2983998

Browse files
anderspapittofacebook-github-bot
authored andcommitted
add torch-python target (pytorch#12742)
Summary: This is the next minimal step towards moving _C into cmake. For now, leave _C in setup.py, but reduce it to an empty stub file. All of its sources are now part of the new torch-python cmake target. Pull Request resolved: pytorch#12742 Reviewed By: soumith Differential Revision: D13089691 Pulled By: anderspapitto fbshipit-source-id: 1c746fda33cfebb26e02a7f0781fefa8b0d86385
1 parent cb86ae3 commit 2983998

File tree

10 files changed

+309
-325
lines changed

10 files changed

+309
-325
lines changed

cmake/Dependencies.cmake

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,15 @@ if(BUILD_PYTHON)
534534
set(Python_ADDITIONAL_VERSIONS 3.7 3.6 3.5 2.8 2.7 2.6)
535535
find_package(PythonInterp 2.7)
536536
find_package(PythonLibs 2.7)
537-
find_package(NumPy)
537+
538+
# When building pytorch, we pass this in directly from setup.py, and
539+
# don't want to overwrite it because we trust python more than cmake
540+
if (NUMPY_INCLUDE_DIR)
541+
set(NUMPY_FOUND ON)
542+
else()
543+
find_package(NumPy)
544+
endif()
545+
538546
if(PYTHONINTERP_FOUND AND PYTHONLIBS_FOUND)
539547
include_directories(SYSTEM ${PYTHON_INCLUDE_DIR})
540548
caffe2_update_option(USE_NUMPY OFF)

0 commit comments

Comments
 (0)