Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,8 @@ python setup.py install
MACOSX_DEPLOYMENT_TARGET=10.9 CC=clang CXX=clang++ python setup.py install
```

Alternatively, the build process can build SoX (and codecs such as libmad, lame and flac) statically and torchaudio can link them, by setting environment variable `BUILD_SOX=1`.
The build process will fetch and build SoX, liblame, libmad, flac before building extension.
Alternatively, the build process can build libsox and some optional codecs statically and torchaudio can link them, by setting environment variable `BUILD_SOX=1`.
The build process will fetch and build libmad, lame, flac, vorbis, opus, and libsox before building extension. This process requires `cmake` and `pkg-config`.

```bash
# Linux
Expand Down
50 changes: 0 additions & 50 deletions build_tools/setup_helpers/build_third_party.sh

This file was deleted.

217 changes: 0 additions & 217 deletions build_tools/setup_helpers/build_third_party_helper.sh

This file was deleted.

36 changes: 26 additions & 10 deletions build_tools/setup_helpers/extension.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
_ROOT_DIR = _THIS_DIR.parent.parent.resolve()
_CSRC_DIR = _ROOT_DIR / 'torchaudio' / 'csrc'
_TP_BASE_DIR = _ROOT_DIR / 'third_party'
_TP_INSTALL_DIR = _TP_BASE_DIR / 'build'
_TP_INSTALL_DIR = _TP_BASE_DIR / 'install'


def _get_build_sox():
Expand Down Expand Up @@ -76,8 +76,20 @@ def _get_extra_objects():
# NOTE: The order of the library listed bellow matters.
#
# (the most important thing is that dependencies come after a library
# e.g., sox comes first)
libs = ['libsox.a', 'libmad.a', 'libFLAC.a', 'libmp3lame.a']
# e.g., sox comes first, flac/vorbis comes before ogg, and
# vorbisenc/vorbisfile comes before vorbis
libs = [
'libsox.a',
'libmad.a',
'libFLAC.a',
'libmp3lame.a',
'libopusfile.a',
'libopus.a',
'libvorbisenc.a',
'libvorbisfile.a',
'libvorbis.a',
'libogg.a',
]
for lib in libs:
objs.append(str(_TP_INSTALL_DIR / 'lib' / lib))
return objs
Expand All @@ -87,15 +99,19 @@ def _get_libraries():
return [] if _BUILD_SOX else ['sox']


def _build_codecs():
def _build_third_party():
build_dir = str(_TP_BASE_DIR / 'build')
os.makedirs(build_dir, exist_ok=True)
subprocess.run(
args=[str(_THIS_DIR / 'build_third_party.sh')],
args=['cmake', '..'],
cwd=build_dir,
check=True,
)
subprocess.run(
args=['cmake', '--build', '.'],
cwd=build_dir,
check=True,
)


def _configure_third_party():
_build_codecs()


_EXT_NAME = 'torchaudio._torchaudio'
Expand All @@ -120,5 +136,5 @@ def get_ext_modules(debug=False):
class BuildExtension(TorchBuildExtension):
def build_extension(self, ext):
if ext.name == _EXT_NAME and _BUILD_SOX:
_configure_third_party()
_build_third_party()
super().build_extension(ext)
2 changes: 1 addition & 1 deletion packaging/build_conda.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

export BUILD_TYPE="conda"
export NO_CUDA_PACKAGE=1
setup_env 0.6.0
setup_env 0.7.0
export SOURCE_ROOT_DIR="$PWD"
setup_conda_pytorch_constraint
conda build $CONDA_CHANNEL_FLAGS --no-anaconda-upload --python "$PYTHON_VERSION" packaging/torchaudio
2 changes: 1 addition & 1 deletion packaging/build_wheel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"

export BUILD_TYPE="wheel"
export NO_CUDA_PACKAGE=1
setup_env 0.6.0
setup_env 0.7.0
setup_wheel_python
pip_install numpy future
setup_pip_pytorch_version
Expand Down
3 changes: 2 additions & 1 deletion packaging/pkg_helpers.bash
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ setup_pip_pytorch_version() {
else
pip_install "torch==$PYTORCH_VERSION$PYTORCH_VERSION_SUFFIX" \
-f https://download.pytorch.org/whl/torch_stable.html \
-f https://download.pytorch.org/whl/test/torch_test.html \
-f https://download.pytorch.org/whl/nightly/torch_nightly.html
fi
}
Expand All @@ -184,7 +185,7 @@ setup_conda_pytorch_constraint() {
export CONDA_CHANNEL_FLAGS="-c pytorch-nightly"
export PYTORCH_VERSION="$(conda search --json 'pytorch[channel=pytorch-nightly]' | python -c "import sys, json, re; print(re.sub(r'\\+.*$', '', json.load(sys.stdin)['pytorch'][-1]['version']))")"
else
export CONDA_CHANNEL_FLAGS="-c pytorch -c pytorch-nightly"
export CONDA_CHANNEL_FLAGS="-c pytorch -c pytorch-test -c pytorch-nightly"
fi
if [[ "$CU_VERSION" == cpu ]]; then
export CONDA_PYTORCH_BUILD_CONSTRAINT="- pytorch==$PYTORCH_VERSION${PYTORCH_VERSION_SUFFIX}"
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@


# Creating the version file
version = '0.6.0a0'
version = '0.7.0a0'
sha = 'Unknown'

try:
Expand Down
Loading