mirror of
https://github.com/pytorch/pytorch.git
synced 2025-10-21 21:49:24 +08:00
python 2 support
This commit is contained in:
20
setup.py
20
setup.py
@ -1,5 +1,7 @@
|
||||
from setuptools import setup, Extension
|
||||
from os.path import expanduser
|
||||
from tools.cwrap import cwrap
|
||||
import platform
|
||||
|
||||
################################################################################
|
||||
# Generate __init__.py from templates
|
||||
@ -49,6 +51,16 @@ for src in cwrap_src:
|
||||
################################################################################
|
||||
# Declare the package
|
||||
################################################################################
|
||||
extra_link_args = []
|
||||
|
||||
# TODO: remove and properly submodule TH in the repo itself
|
||||
th_path = expanduser("~/torch/install/")
|
||||
th_header_path = th_path + "include"
|
||||
th_lib_path = th_path + "lib"
|
||||
if platform.system() == 'Darwin':
|
||||
extra_link_args.append('-L' + th_lib_path)
|
||||
extra_link_args.append('-Wl,-rpath,' + th_lib_path)
|
||||
|
||||
sources = [
|
||||
"torch/csrc/Module.cpp",
|
||||
"torch/csrc/Tensor.cpp",
|
||||
@ -59,9 +71,13 @@ C = Extension("torch.C",
|
||||
libraries=['TH'],
|
||||
sources=sources,
|
||||
language='c++',
|
||||
include_dirs=["torch/csrc"])
|
||||
include_dirs=(["torch/csrc", th_header_path]),
|
||||
extra_link_args = extra_link_args,
|
||||
)
|
||||
|
||||
|
||||
|
||||
setup(name="torch", version="0.1",
|
||||
ext_modules=[C],
|
||||
packages=['torch'])
|
||||
packages=['torch'],
|
||||
)
|
||||
|
Reference in New Issue
Block a user