Skip to content

Commit

Permalink
Corrected python lib path on windows to be consistent with Linux (#13848
Browse files Browse the repository at this point in the history
)

Summary:
The python lib path on Windows was set to an incorrect path. This fixes it to be consistent with Linux.
Pull Request resolved: #13848

Differential Revision: D13030945

Pulled By: soumith

fbshipit-source-id: 7fb9013ffe66cff98018aea25fdb5cda03cbceb1
  • Loading branch information
CircleCI authored and facebook-github-bot committed Nov 12, 2018
1 parent 53a3c46 commit f1a2bc4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
11 changes: 8 additions & 3 deletions setup.py
Expand Up @@ -231,9 +231,14 @@ def hotpatch_var(var, prefix='USE_'):
# full absolute path to the dir above
full_site_packages = distutils.sysconfig.get_python_lib()
# CMAKE: full path to python library
cmake_python_library = "{}/{}".format(
distutils.sysconfig.get_config_var("LIBDIR"),
distutils.sysconfig.get_config_var("INSTSONAME"))
if IS_WINDOWS:
cmake_python_library = "{}/libs/python{}.lib".format(
distutils.sysconfig.get_config_var("prefix"),
distutils.sysconfig.get_config_var("VERSION"))
else:
cmake_python_library = "{}/{}".format(
distutils.sysconfig.get_config_var("LIBDIR"),
distutils.sysconfig.get_config_var("INSTSONAME"))
cmake_python_include_dir = distutils.sysconfig.get_python_inc()


Expand Down
4 changes: 3 additions & 1 deletion tools/build_pytorch_libs.bat
Expand Up @@ -214,18 +214,20 @@ goto:eof
: Invalid escape sequence \i
: which is said to become an error in the future.
: As an alternative, we should use forward slashes instead.
: Here those paths should be espaced before passing to CMake.
: Here those paths should be escaped before passing to CMake.
set NVTOOLEXT_HOME=%NVTOOLEXT_HOME:\=/%
set CUDNN_INCLUDE_DIR=%CUDNN_INCLUDE_DIR:\=/%
set CUDNN_LIB_DIR=%CUDNN_LIB_DIR:\=/%
set CUDNN_LIBRARY=%CUDNN_LIBRARY:\=/%
set PYTORCH_PYTHON_LIBRARY=%PYTORCH_PYTHON_LIBRARY:\=/%

IF NOT "%PREBUILD_COMMAND%"=="" call "%PREBUILD_COMMAND%" %PREBUILD_COMMAND_ARGS%
if not exist build mkdir build
pushd build
cmake .. %CMAKE_GENERATOR_COMMAND% ^
-DCMAKE_BUILD_TYPE=%BUILD_TYPE% ^
-DTORCH_BUILD_VERSION="%PYTORCH_BUILD_VERSION%" ^
-DPYTHON_LIBRARY="%PYTORCH_PYTHON_LIBRARY%" ^
-DBUILD_TORCH="%BUILD_TORCH%" ^
-DNVTOOLEXT_HOME="%NVTOOLEXT_HOME%" ^
-DNO_API=ON ^
Expand Down

0 comments on commit f1a2bc4

Please sign in to comment.