Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
OpenDAS
Torchaudio
Commits
4daf2fb7
"git@developer.sourcefind.cn:renzhc/diffusers_dcu.git" did not exist on "fb02316db8a05d049905f4f309e528f4dcf7395b"
Unverified
Commit
4daf2fb7
authored
Jun 26, 2020
by
moto
Committed by
GitHub
Jun 26, 2020
Browse files
Add vorbis to binary build (#750)
parent
66f4cdf9
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
120 additions
and
7 deletions
+120
-7
.circleci/unittest/linux/scripts/install.sh
.circleci/unittest/linux/scripts/install.sh
+1
-1
.circleci/unittest/linux/scripts/run_test.sh
.circleci/unittest/linux/scripts/run_test.sh
+1
-0
.circleci/unittest/linux/scripts/setup_env.sh
.circleci/unittest/linux/scripts/setup_env.sh
+1
-1
build_tools/setup_helpers/build_third_party.sh
build_tools/setup_helpers/build_third_party.sh
+14
-0
build_tools/setup_helpers/build_third_party_helper.sh
build_tools/setup_helpers/build_third_party_helper.sh
+91
-3
build_tools/setup_helpers/extension.py
build_tools/setup_helpers/extension.py
+12
-2
No files found.
.circleci/unittest/linux/scripts/install.sh
View file @
4daf2fb7
...
@@ -20,4 +20,4 @@ printf "Installing PyTorch with %s\n" "${cudatoolkit}"
...
@@ -20,4 +20,4 @@ printf "Installing PyTorch with %s\n" "${cudatoolkit}"
conda
install
-y
-c
pytorch-nightly pytorch
"
${
cudatoolkit
}
"
conda
install
-y
-c
pytorch-nightly pytorch
"
${
cudatoolkit
}
"
printf
"* Installing torchaudio
\n
"
printf
"* Installing torchaudio
\n
"
python setup.py develop
BUILD_SOX
=
1
python setup.py develop
.circleci/unittest/linux/scripts/run_test.sh
View file @
4daf2fb7
...
@@ -6,4 +6,5 @@ eval "$(./conda/bin/conda shell.bash hook)"
...
@@ -6,4 +6,5 @@ eval "$(./conda/bin/conda shell.bash hook)"
conda activate ./env
conda activate ./env
python
-m
torch.utils.collect_env
python
-m
torch.utils.collect_env
export
PATH
=
"
${
PWD
}
/third_party/build/bin/:
${
PATH
}
"
pytest
--cov
=
torchaudio
--junitxml
=
test-results/junit.xml
-v
--durations
20
test
pytest
--cov
=
torchaudio
--junitxml
=
test-results/junit.xml
-v
--durations
20
test
.circleci/unittest/linux/scripts/setup_env.sh
View file @
4daf2fb7
...
@@ -34,4 +34,4 @@ printf "* Installing dependencies (except PyTorch)\n"
...
@@ -34,4 +34,4 @@ printf "* Installing dependencies (except PyTorch)\n"
conda
env
update
--file
"
${
this_dir
}
/environment.yml"
--prune
conda
env
update
--file
"
${
this_dir
}
/environment.yml"
--prune
# 4. Build codecs
# 4. Build codecs
#
build_tools/setup_helpers/build_third_party.sh
build_tools/setup_helpers/build_third_party.sh
build_tools/setup_helpers/build_third_party.sh
View file @
4daf2fb7
...
@@ -21,6 +21,20 @@ mkdir -p "${tmp_dir}" "${build_dir}"
...
@@ -21,6 +21,20 @@ mkdir -p "${tmp_dir}" "${build_dir}"
.
"
${
this_dir
}
/build_third_party_helper.sh"
.
"
${
this_dir
}
/build_third_party_helper.sh"
if
!
found_ogg
"
${
build_dir
}
"
;
then
get_ogg
"
${
tmp_dir
}
"
if
[
"
${
download_only
}
"
=
"false"
]
;
then
build_ogg
"
${
tmp_dir
}
"
"
${
build_dir
}
"
fi
fi
if
!
found_vorbis
"
${
build_dir
}
"
;
then
get_vorbis
"
${
tmp_dir
}
"
if
[
"
${
download_only
}
"
=
"false"
]
;
then
build_vorbis
"
${
tmp_dir
}
"
"
${
build_dir
}
"
fi
fi
if
!
found_lame
"
${
build_dir
}
"
;
then
if
!
found_lame
"
${
build_dir
}
"
;
then
get_lame
"
${
tmp_dir
}
"
get_lame
"
${
tmp_dir
}
"
if
[
"
${
download_only
}
"
=
"false"
]
;
then
if
[
"
${
download_only
}
"
=
"false"
]
;
then
...
...
build_tools/setup_helpers/build_third_party_helper.sh
View file @
4daf2fb7
...
@@ -24,6 +24,18 @@ all_found() {
...
@@ -24,6 +24,18 @@ all_found() {
done
done
}
}
found_ogg
()
{
all_found
"
$1
"
'include/ogg/ogg.h'
'lib/libogg.a'
}
found_vorbis
()
{
all_found
"
$1
"
\
'include/vorbis/vorbisenc.h'
\
'include/vorbis/vorbisfile.h'
\
'lib/libvorbis.a'
\
'lib/libvorbisenc.a'
\
'lib/libvorbisfile.a'
}
found_lame
()
{
found_lame
()
{
all_found
"
$1
"
'include/lame/lame.h'
'lib/libmp3lame.a'
all_found
"
$1
"
'include/lame/lame.h'
'lib/libmp3lame.a'
...
@@ -57,6 +69,82 @@ found_sox() {
...
@@ -57,6 +69,82 @@ found_sox() {
all_found
"
$1
"
'include/sox.h'
'lib/libsox.a'
all_found
"
$1
"
'include/sox.h'
'lib/libsox.a'
}
}
# libogg 1.3.4 has bug on mac OS.
# https://trac.macports.org/ticket/58924
OGG
=
"libogg-1.3.3"
OGG_ARCHIVE
=
"
${
OGG
}
.tar.gz"
get_ogg
()
{
work_dir
=
"
$1
"
url
=
"https://ftp.osuosl.org/pub/xiph/releases/ogg/
${
OGG_ARCHIVE
}
"
(
cd
"
${
work_dir
}
"
if
[
!
-d
"
${
OGG
}
"
]
;
then
if
[
!
-f
"
${
OGG_ARCHIVE
}
"
]
;
then
printf
"Fetching libogg from %s
\n
"
"
${
url
}
"
curl
$CURL_OPTS
-O
"
${
url
}
"
fi
fi
)
}
build_ogg
()
{
work_dir
=
"
$1
"
install_dir
=
"
$2
"
(
cd
"
${
work_dir
}
"
if
[
!
-d
"
${
OGG
}
"
]
;
then
tar
xfp
"
${
OGG_ARCHIVE
}
"
fi
cd
"
${
OGG
}
"
printf
"Building libogg
\n
"
if
[
!
-f
Makefile
]
;
then
./configure
${
CONFIG_OPTS
}
\
--disable-shared
--enable-static
--prefix
=
"
${
install_dir
}
"
CFLAGS
=
-fPIC
CXXFLAGS
=
-fPIC
\
--with-pic
--disable-dependency-tracking
fi
make
${
MAKE_OPTS
}
>
make.log 2>&1
make
install
)
}
VORBIS
=
"libvorbis-1.3.6"
VORBIS_ARCHIVE
=
"
${
VORBIS
}
.tar.gz"
get_vorbis
()
{
work_dir
=
"
$1
"
url
=
"https://ftp.osuosl.org/pub/xiph/releases/vorbis/
${
VORBIS_ARCHIVE
}
"
(
cd
"
${
work_dir
}
"
if
[
!
-d
"
${
VORBIS
}
"
]
;
then
if
[
!
-f
"
${
VORBIS_ARCHIVE
}
"
]
;
then
printf
"Fetching libvorbis from %s
\n
"
"
${
url
}
"
curl
$CURL_OPTS
-O
"
${
url
}
"
fi
fi
)
}
build_vorbis
()
{
work_dir
=
"
$1
"
install_dir
=
"
$2
"
(
cd
"
${
work_dir
}
"
if
[
!
-d
"
${
VORBIS
}
"
]
;
then
tar
xfp
"
${
VORBIS_ARCHIVE
}
"
fi
cd
"
${
VORBIS
}
"
printf
"Building libvorbis
\n
"
if
[
!
-f
Makefile
]
;
then
./configure
${
CONFIG_OPTS
}
\
--disable-shared
--enable-static
--prefix
=
"
${
install_dir
}
"
CFLAGS
=
-fPIC
CXXFLAGS
=
-fPIC
\
--with-pic
--disable-dependency-tracking
fi
make
${
MAKE_OPTS
}
>
make.log 2>&1
make
install
)
}
LAME
=
"lame-3.99.5"
LAME
=
"lame-3.99.5"
LAME_ARCHIVE
=
"
${
LAME
}
.tar.gz"
LAME_ARCHIVE
=
"
${
LAME
}
.tar.gz"
...
@@ -126,7 +214,7 @@ build_flac() {
...
@@ -126,7 +214,7 @@ build_flac() {
if
[
!
-f
Makefile
]
;
then
if
[
!
-f
Makefile
]
;
then
./configure
${
CONFIG_OPTS
}
\
./configure
${
CONFIG_OPTS
}
\
--disable-shared
--enable-static
--prefix
=
"
${
install_dir
}
"
CFLAGS
=
-fPIC
CXXFLAGS
=
-fPIC
\
--disable-shared
--enable-static
--prefix
=
"
${
install_dir
}
"
CFLAGS
=
-fPIC
CXXFLAGS
=
-fPIC
\
--with-pic
--disable-debug
--disable-dependency-tracking
--with-pic
--with-ogg
=
"
${
install_dir
}
"
--disable-debug
--disable-dependency-tracking
fi
fi
make
${
MAKE_OPTS
}
>
make.log 2>&1
make
${
MAKE_OPTS
}
>
make.log 2>&1
make
${
MAKE_OPTS
}
install
make
${
MAKE_OPTS
}
install
...
@@ -207,8 +295,8 @@ build_sox() {
...
@@ -207,8 +295,8 @@ build_sox() {
# it statically if we do.
# it statically if we do.
./configure
${
CONFIG_OPTS
}
--disable-shared
--enable-static
--prefix
=
"
${
install_dir
}
"
\
./configure
${
CONFIG_OPTS
}
--disable-shared
--enable-static
--prefix
=
"
${
install_dir
}
"
\
LDFLAGS
=
"-L
${
install_dir
}
/lib"
CPPFLAGS
=
"-I
${
install_dir
}
/include"
\
LDFLAGS
=
"-L
${
install_dir
}
/lib"
CPPFLAGS
=
"-I
${
install_dir
}
/include"
\
--with-lame
--with-flac
--with-mad
--without-alsa
--without-coreaudio
\
--with-lame
--with-flac
--with-mad
--with-oggvorbis
--without-alsa
--without-coreaudio
\
--without-png
--without-oggvorbis
--without-oss
--without-sndfile
\
--without-png
--without-oss
--without-sndfile
\
CFLAGS
=
-fPIC
CXXFLAGS
=
-fPIC
--with-pic
--disable-debug
--disable-dependency-tracking
CFLAGS
=
-fPIC
CXXFLAGS
=
-fPIC
--with-pic
--disable-debug
--disable-dependency-tracking
fi
fi
make
${
MAKE_OPTS
}
>
make.log 2>&1
make
${
MAKE_OPTS
}
>
make.log 2>&1
...
...
build_tools/setup_helpers/extension.py
View file @
4daf2fb7
...
@@ -76,8 +76,18 @@ def _get_extra_objects():
...
@@ -76,8 +76,18 @@ def _get_extra_objects():
# NOTE: The order of the library listed bellow matters.
# NOTE: The order of the library listed bellow matters.
#
#
# (the most important thing is that dependencies come after a library
# (the most important thing is that dependencies come after a library
# e.g., sox comes first)
# e.g., sox comes first, flac/vorbis comes before ogg, and
libs
=
[
'libsox.a'
,
'libmad.a'
,
'libFLAC.a'
,
'libmp3lame.a'
]
# vorbisenc/vorbisfile comes before vorbis
libs
=
[
'libsox.a'
,
'libmad.a'
,
'libFLAC.a'
,
'libmp3lame.a'
,
'libvorbisenc.a'
,
'libvorbisfile.a'
,
'libvorbis.a'
,
'libogg.a'
,
]
for
lib
in
libs
:
for
lib
in
libs
:
objs
.
append
(
str
(
_TP_INSTALL_DIR
/
'lib'
/
lib
))
objs
.
append
(
str
(
_TP_INSTALL_DIR
/
'lib'
/
lib
))
return
objs
return
objs
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment