diff --git a/.github/workflows/build-wheels-aarch64.yaml b/.github/workflows/build-wheels-aarch64.yaml index f4e714fc2..3246c8d7a 100644 --- a/.github/workflows/build-wheels-aarch64.yaml +++ b/.github/workflows/build-wheels-aarch64.yaml @@ -46,7 +46,7 @@ jobs: echo "PWD" ls -lh /project/alsa-lib/src/.libs - CIBW_ENVIRONMENT: CPLUS_INCLUDE_PATH=/project/alsa-lib/include:$CPLUS_INCLUDE_PATH SHERPA_ONNX_ALSA_LIB_DIR=/project/alsa-lib/src/.libs LD_LIBRARY_PATH=/project/build/bdist.linux-x86_64/wheel/sherpa_onnx/lib:$SHERPA_ONNX_ALSA_LIB_DIR SHERPA_ONNX_MAKE_ARGS="VERBOSE=1" + CIBW_ENVIRONMENT: CPLUS_INCLUDE_PATH=/project/alsa-lib/include:$CPLUS_INCLUDE_PATH SHERPA_ONNX_ALSA_LIB_DIR=/project/alsa-lib/src/.libs LD_LIBRARY_PATH=/project/build/bdist.linux-x86_64/wheel/sherpa_onnx/lib:$SHERPA_ONNX_ALSA_LIB_DIR SHERPA_ONNX_MAKE_ARGS="VERBOSE=1" SHERPA_ONNX_ENABLE_ALSA=1 CIBW_BUILD: "${{ matrix.python-version}}-* " CIBW_SKIP: "cp27-* cp35-* cp36-* *-win32 pp* *-musllinux* *-manylinux_i686" CIBW_BUILD_VERBOSITY: 3 diff --git a/.github/workflows/build-wheels-linux.yaml b/.github/workflows/build-wheels-linux.yaml index 17c490e14..3e09c2e3a 100644 --- a/.github/workflows/build-wheels-linux.yaml +++ b/.github/workflows/build-wheels-linux.yaml @@ -41,7 +41,7 @@ jobs: echo "PWD" ls -lh /project/alsa-lib/src/.libs - CIBW_ENVIRONMENT: CPLUS_INCLUDE_PATH=/project/alsa-lib/include:$CPLUS_INCLUDE_PATH SHERPA_ONNX_ALSA_LIB_DIR=/project/alsa-lib/src/.libs LD_LIBRARY_PATH=/project/build/bdist.linux-x86_64/wheel/sherpa_onnx/lib:$SHERPA_ONNX_ALSA_LIB_DIR SHERPA_ONNX_MAKE_ARGS="VERBOSE=1" + CIBW_ENVIRONMENT: CPLUS_INCLUDE_PATH=/project/alsa-lib/include:$CPLUS_INCLUDE_PATH SHERPA_ONNX_ALSA_LIB_DIR=/project/alsa-lib/src/.libs LD_LIBRARY_PATH=/project/build/bdist.linux-x86_64/wheel/sherpa_onnx/lib:$SHERPA_ONNX_ALSA_LIB_DIR SHERPA_ONNX_MAKE_ARGS="VERBOSE=1" SHERPA_ONNX_ENABLE_ALSA=1 CIBW_BUILD: "${{ matrix.python-version}}-* " CIBW_SKIP: "cp27-* cp35-* cp36-* *-win32 pp* *-musllinux* *-manylinux_i686" diff --git a/cmake/cmake_extension.py b/cmake/cmake_extension.py index 21e0f5686..c081cfe42 100644 --- a/cmake/cmake_extension.py +++ b/cmake/cmake_extension.py @@ -38,6 +38,11 @@ def is_x86(): return platform.machine() in ["i386", "i686", "x86_64"] +def enable_alsa(): + build_alsa = os.environ.get("SHERPA_ONNX_ENABLE_ALSA", None) + return build_alsa and is_linux() and (is_arm64() or is_x86()) + + try: from wheel.bdist_wheel import bdist_wheel as _bdist_wheel @@ -157,7 +162,7 @@ def build_extension(self, ext: setuptools.extension.Extension): binaries += ["sherpa-onnx-offline-tts"] binaries += ["sherpa-onnx-offline-tts-play"] - if is_linux() and (is_arm64() or is_x86()): + if enable_alsa(): binaries += ["sherpa-onnx-alsa"] binaries += ["sherpa-onnx-offline-tts-play-alsa"] diff --git a/setup.py b/setup.py index 2eaa59e26..3757c617d 100644 --- a/setup.py +++ b/setup.py @@ -11,10 +11,8 @@ BuildExtension, bdist_wheel, cmake_extension, + enable_alsa, is_windows, - is_linux, - is_arm64, - is_x86, ) @@ -64,7 +62,7 @@ def get_binaries_to_install(): binaries += ["sherpa-onnx-offline-tts"] binaries += ["sherpa-onnx-offline-tts-play"] - if is_linux() and (is_arm64() or is_x86()): + if enable_alsa(): binaries += ["sherpa-onnx-alsa"] binaries += ["sherpa-onnx-offline-tts-play-alsa"]