mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-20 21:14:14 +08:00
Eliminate PYCMD in favor of PYTHON_EXECUTABLE in CMake.
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/16522 Differential Revision: D13867376 Pulled By: resistor fbshipit-source-id: 6bce68facea83c5161a31fcdfafe08827999eb2b
This commit is contained in:
committed by
Facebook Github Bot
parent
16e2e4f29f
commit
fc2d8c6889
@ -14,7 +14,7 @@ if (NOT BUILD_ATEN_MOBILE)
|
||||
# Generate the headers wrapped by our operator
|
||||
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/contrib/aten/aten_op.h
|
||||
COMMAND
|
||||
${PYCMD} ${CMAKE_CURRENT_SOURCE_DIR}/contrib/aten/gen_op.py
|
||||
"${PYTHON_EXECUTABLE}" ${CMAKE_CURRENT_SOURCE_DIR}/contrib/aten/gen_op.py
|
||||
--aten_root=${CMAKE_CURRENT_SOURCE_DIR}/../aten
|
||||
--template_dir=${CMAKE_CURRENT_SOURCE_DIR}/contrib/aten
|
||||
--yaml_dir=${CMAKE_CURRENT_BINARY_DIR}/../aten/src/ATen
|
||||
|
@ -34,13 +34,6 @@ endfunction()
|
||||
|
||||
################################################################################
|
||||
|
||||
if (DEFINED ENV{PYTORCH_PYTHON})
|
||||
message(STATUS "Using python found in $ENV{PYTORCH_PYTHON}")
|
||||
set(PYCMD "$ENV{PYTORCH_PYTHON}")
|
||||
else()
|
||||
SET(PYCMD "python")
|
||||
endif()
|
||||
|
||||
# ---[ Write the macros file
|
||||
configure_file(
|
||||
${CMAKE_CURRENT_LIST_DIR}/../caffe2/core/macros.h.in
|
||||
@ -152,7 +145,7 @@ if (NOT BUILD_ATEN_MOBILE)
|
||||
endif()
|
||||
|
||||
SET(GEN_COMMAND
|
||||
${PYCMD} ${CMAKE_CURRENT_LIST_DIR}/../aten/src/ATen/gen.py
|
||||
"${PYTHON_EXECUTABLE}" ${CMAKE_CURRENT_LIST_DIR}/../aten/src/ATen/gen.py
|
||||
--source-path ${CMAKE_CURRENT_LIST_DIR}/../aten/src/ATen
|
||||
--install_dir ${CMAKE_BINARY_DIR}/aten/src/ATen
|
||||
${GEN_ROCM_FLAG}
|
||||
|
@ -80,6 +80,7 @@ cmake .. ^
|
||||
-DUSE_OPENCV=OFF ^
|
||||
-DBUILD_SHARED_LIBS=OFF ^
|
||||
-DBUILD_PYTHON=OFF^
|
||||
-DPYTHON_EXECUTABLE=python^
|
||||
|| goto :label_error
|
||||
|
||||
:: Actually run the build
|
||||
|
@ -122,7 +122,6 @@ def run_cmake(version,
|
||||
# you should NEVER add something to this list. It is bad practice to
|
||||
# have cmake read the environment
|
||||
my_env = os.environ.copy()
|
||||
my_env['PYTORCH_PYTHON'] = escape_path(sys.executable)
|
||||
if USE_CUDNN:
|
||||
my_env['CUDNN_LIBRARY'] = escape_path(CUDNN_LIBRARY)
|
||||
my_env['CUDNN_INCLUDE_DIR'] = escape_path(CUDNN_INCLUDE_DIR)
|
||||
|
@ -29,14 +29,6 @@ endif()
|
||||
|
||||
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
|
||||
|
||||
# Get the correct Python executable
|
||||
if (DEFINED ENV{PYTORCH_PYTHON})
|
||||
message(STATUS "Using python found in $ENV{PYTORCH_PYTHON}")
|
||||
set(PYCMD "$ENV{PYTORCH_PYTHON}")
|
||||
else()
|
||||
SET(PYCMD "python")
|
||||
endif()
|
||||
|
||||
# Generate files
|
||||
set(TOOLS_PATH "${TORCH_ROOT}/tools")
|
||||
|
||||
@ -74,7 +66,7 @@ add_custom_command(
|
||||
"${TORCH_SRC_DIR}/csrc/jit/generated/register_aten_ops_1.cpp"
|
||||
"${TORCH_SRC_DIR}/csrc/jit/generated/register_aten_ops_2.cpp"
|
||||
COMMAND
|
||||
${PYCMD} tools/setup_helpers/generate_code.py
|
||||
"${PYTHON_EXECUTABLE}" tools/setup_helpers/generate_code.py
|
||||
--declarations-path "${CMAKE_BINARY_DIR}/aten/src/ATen/Declarations.yaml"
|
||||
--nn-path "aten/src/"
|
||||
DEPENDS
|
||||
@ -702,7 +694,7 @@ if (BUILD_PYTHON)
|
||||
OUTPUT
|
||||
"${TORCH_SRC_DIR}/__init__.pyi"
|
||||
COMMAND
|
||||
${PYCMD} -mtools.pyi.gen_pyi
|
||||
"${PYTHON_EXECUTABLE}" -mtools.pyi.gen_pyi
|
||||
--declarations-path "${CMAKE_BINARY_DIR}/aten/src/ATen/Declarations.yaml"
|
||||
DEPENDS
|
||||
"${CMAKE_BINARY_DIR}/aten/src/ATen/Declarations.yaml"
|
||||
|
Reference in New Issue
Block a user