Support linking onnxruntime statically for macOS (#403)
This commit is contained in:
17
.github/workflows/macos.yaml
vendored
17
.github/workflows/macos.yaml
vendored
@@ -39,11 +39,13 @@ concurrency:
|
|||||||
jobs:
|
jobs:
|
||||||
macos:
|
macos:
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
|
name: ${{ matrix.build_type }} ${{ matrix.lib_type }}
|
||||||
strategy:
|
strategy:
|
||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
os: [macos-latest]
|
os: [macos-latest]
|
||||||
build_type: [Release, Debug]
|
build_type: [Release, Debug]
|
||||||
|
lib_type: [static, shared]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
@@ -53,7 +55,7 @@ jobs:
|
|||||||
- name: ccache
|
- name: ccache
|
||||||
uses: hendrikmuhs/ccache-action@v1.2
|
uses: hendrikmuhs/ccache-action@v1.2
|
||||||
with:
|
with:
|
||||||
key: ${{ matrix.os }}-${{ matrix.build_type }}
|
key: ${{ matrix.os }}-${{ matrix.build_type }}-${{ matrix.lib_type }}
|
||||||
|
|
||||||
- name: Configure CMake
|
- name: Configure CMake
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -64,7 +66,14 @@ jobs:
|
|||||||
|
|
||||||
mkdir build
|
mkdir build
|
||||||
cd build
|
cd build
|
||||||
cmake -D CMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_OSX_ARCHITECTURES='arm64;x86_64' -DCMAKE_INSTALL_PREFIX=./install ..
|
lib_type=${{ matrix.lib_type }}
|
||||||
|
if [[ $lib_type == "static" ]]; then
|
||||||
|
BUILD_SHARED_LIBS=OFF
|
||||||
|
else
|
||||||
|
BUILD_SHARED_LIBS=ON
|
||||||
|
fi
|
||||||
|
|
||||||
|
cmake -D BUILD_SHARED_LIBS=$BUILD_SHARED_LIBS -D CMAKE_BUILD_TYPE=${{ matrix.build_type }} -DCMAKE_OSX_ARCHITECTURES='arm64;x86_64' -DCMAKE_INSTALL_PREFIX=./install ..
|
||||||
|
|
||||||
- name: Build sherpa-onnx for macos
|
- name: Build sherpa-onnx for macos
|
||||||
shell: bash
|
shell: bash
|
||||||
@@ -149,7 +158,7 @@ jobs:
|
|||||||
run: |
|
run: |
|
||||||
SHERPA_ONNX_VERSION=v$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
|
SHERPA_ONNX_VERSION=v$(grep "SHERPA_ONNX_VERSION" ./CMakeLists.txt | cut -d " " -f 2 | cut -d '"' -f 2)
|
||||||
|
|
||||||
dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-osx-universal2
|
dst=sherpa-onnx-${SHERPA_ONNX_VERSION}-osx-universal2-${{ matrix.lib_type }}
|
||||||
mkdir $dst
|
mkdir $dst
|
||||||
|
|
||||||
cp -a build/install/bin $dst/
|
cp -a build/install/bin $dst/
|
||||||
@@ -167,4 +176,4 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
file_glob: true
|
file_glob: true
|
||||||
overwrite: true
|
overwrite: true
|
||||||
file: sherpa-onnx-*osx-universal2.tar.bz2
|
file: sherpa-onnx-*osx-universal2*.tar.bz2
|
||||||
|
|||||||
61
cmake/onnxruntime-osx-arm64-static.cmake
Normal file
61
cmake/onnxruntime-osx-arm64-static.cmake
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
# Copyright (c) 2022-2023 Xiaomi Corporation
|
||||||
|
message(STATUS "CMAKE_SYSTEM_NAME: ${CMAKE_SYSTEM_NAME}")
|
||||||
|
message(STATUS "CMAKE_SYSTEM_PROCESSOR: ${CMAKE_SYSTEM_PROCESSOR}")
|
||||||
|
message(STATUS "CMAKE_OSX_ARCHITECTURES: ${CMAKE_OSX_ARCHITECTURES}")
|
||||||
|
message(STATUS "CMAKE_APPLE_SILICON_PROCESSOR : ${CMAKE_APPLE_SILICON_PROCESSOR}")
|
||||||
|
|
||||||
|
if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
|
||||||
|
message(FATAL_ERROR "This file is for macOS only. Given: ${CMAKE_SYSTEM_NAME}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(BUILD_SHARED_LIBS)
|
||||||
|
message(FATAL_ERROR "This file is for building static libraries. BUILD_SHARED_LIBS: ${BUILD_SHARED_LIBS}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(onnxruntime_URL "https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.16.0/onnxruntime-osx-arm64-static_lib-1.16.0.zip")
|
||||||
|
set(onnxruntime_URL2 "https://huggingface.co/csukuangfj/onnxruntime-libs/resolve/main/onnxruntime-osx-arm64-static_lib-1.16.0.zip")
|
||||||
|
set(onnxruntime_HASH "SHA256=5f99c9a51d91e751ac20fcbb73dfa31a379438381c5357fd3f37bda816934e3e")
|
||||||
|
|
||||||
|
# If you don't have access to the Internet,
|
||||||
|
# please download onnxruntime to one of the following locations.
|
||||||
|
# You can add more if you want.
|
||||||
|
set(possible_file_locations
|
||||||
|
$ENV{HOME}/Downloads/onnxruntime-osx-arm64-static_lib-1.16.0.zip
|
||||||
|
${PROJECT_SOURCE_DIR}/onnxruntime-osx-arm64-static_lib-1.16.0.zip
|
||||||
|
${PROJECT_BINARY_DIR}/onnxruntime-osx-arm64-static_lib-1.16.0.zip
|
||||||
|
/tmp/onnxruntime-osx-arm64-static_lib-1.16.0.zip
|
||||||
|
)
|
||||||
|
|
||||||
|
foreach(f IN LISTS possible_file_locations)
|
||||||
|
if(EXISTS ${f})
|
||||||
|
set(onnxruntime_URL "${f}")
|
||||||
|
file(TO_CMAKE_PATH "${onnxruntime_URL}" onnxruntime_URL)
|
||||||
|
message(STATUS "Found local downloaded onnxruntime: ${onnxruntime_URL}")
|
||||||
|
set(onnxruntime_URL2)
|
||||||
|
break()
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
FetchContent_Declare(onnxruntime
|
||||||
|
URL
|
||||||
|
${onnxruntime_URL}
|
||||||
|
${onnxruntime_URL2}
|
||||||
|
URL_HASH ${onnxruntime_HASH}
|
||||||
|
)
|
||||||
|
|
||||||
|
FetchContent_GetProperties(onnxruntime)
|
||||||
|
if(NOT onnxruntime_POPULATED)
|
||||||
|
message(STATUS "Downloading onnxruntime from ${onnxruntime_URL}")
|
||||||
|
FetchContent_Populate(onnxruntime)
|
||||||
|
endif()
|
||||||
|
message(STATUS "onnxruntime is downloaded to ${onnxruntime_SOURCE_DIR}")
|
||||||
|
|
||||||
|
# for static libraries, we use onnxruntime_lib_files directly below
|
||||||
|
include_directories(${onnxruntime_SOURCE_DIR}/include)
|
||||||
|
|
||||||
|
file(GLOB onnxruntime_lib_files "${onnxruntime_SOURCE_DIR}/lib/lib*.a")
|
||||||
|
|
||||||
|
set(onnxruntime_lib_files ${onnxruntime_lib_files} PARENT_SCOPE)
|
||||||
|
|
||||||
|
message(STATUS "onnxruntime lib files: ${onnxruntime_lib_files}")
|
||||||
|
install(FILES ${onnxruntime_lib_files} DESTINATION lib)
|
||||||
@@ -8,6 +8,10 @@ if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
|
|||||||
message(FATAL_ERROR "This file is for macOS only. Given: ${CMAKE_SYSTEM_NAME}")
|
message(FATAL_ERROR "This file is for macOS only. Given: ${CMAKE_SYSTEM_NAME}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(NOT BUILD_SHARED_LIBS)
|
||||||
|
message(FATAL_ERROR "This file is for building shared libraries. BUILD_SHARED_LIBS: ${BUILD_SHARED_LIBS}")
|
||||||
|
endif()
|
||||||
|
|
||||||
set(onnxruntime_URL "https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.16.0/onnxruntime-osx-arm64-1.16.0.tgz")
|
set(onnxruntime_URL "https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.16.0/onnxruntime-osx-arm64-1.16.0.tgz")
|
||||||
set(onnxruntime_URL2 "https://huggingface.co/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/onnxruntime-osx-arm64-1.16.0.tgz")
|
set(onnxruntime_URL2 "https://huggingface.co/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/onnxruntime-osx-arm64-1.16.0.tgz")
|
||||||
set(onnxruntime_HASH "SHA256=fec3b70ca4f642a5c6d5c3a6f3a4eddd4c1b9281893fe2c7ae03a3086e20c316")
|
set(onnxruntime_HASH "SHA256=fec3b70ca4f642a5c6d5c3a6f3a4eddd4c1b9281893fe2c7ae03a3086e20c316")
|
||||||
|
|||||||
62
cmake/onnxruntime-osx-universal-static.cmake
Normal file
62
cmake/onnxruntime-osx-universal-static.cmake
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
# Possible values for CMAKE_SYSTEM_NAME: Linux, Windows, Darwin
|
||||||
|
|
||||||
|
message(STATUS "CMAKE_SYSTEM_NAME: ${CMAKE_SYSTEM_NAME}")
|
||||||
|
message(STATUS "CMAKE_SYSTEM_PROCESSOR: ${CMAKE_SYSTEM_PROCESSOR}")
|
||||||
|
message(STATUS "CMAKE_OSX_ARCHITECTURES: ${CMAKE_OSX_ARCHITECTURES}")
|
||||||
|
message(STATUS "CMAKE_APPLE_SILICON_PROCESSOR : ${CMAKE_APPLE_SILICON_PROCESSOR}")
|
||||||
|
|
||||||
|
if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
|
||||||
|
message(FATAL_ERROR "This file is for macOS only. Given: ${CMAKE_SYSTEM_NAME}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(BUILD_SHARED_LIBS)
|
||||||
|
message(FATAL_ERROR "This file is for building static libraries. BUILD_SHARED_LIBS: ${BUILD_SHARED_LIBS}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(onnxruntime_URL "https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.16.0/onnxruntime-osx-universal2-static_lib-1.16.0.zip")
|
||||||
|
set(onnxruntime_URL2 "https://huggingface.co/csukuangfj/onnxruntime-libs/resolve/main/onnxruntime-osx-universal2-static_lib-1.16.0.zip")
|
||||||
|
set(onnxruntime_HASH "SHA256=6df205fb519d311ff57131d35ed43374f4fe483eb665baa38bfbc00034595b35")
|
||||||
|
|
||||||
|
# If you don't have access to the Internet,
|
||||||
|
# please download onnxruntime to one of the following locations.
|
||||||
|
# You can add more if you want.
|
||||||
|
set(possible_file_locations
|
||||||
|
$ENV{HOME}/Downloads/onnxruntime-osx-universal2-static_lib-1.16.0.zip
|
||||||
|
${PROJECT_SOURCE_DIR}/onnxruntime-osx-universal2-static_lib-1.16.0.zip
|
||||||
|
${PROJECT_BINARY_DIR}/onnxruntime-osx-universal2-static_lib-1.16.0.zip
|
||||||
|
/tmp/onnxruntime-osx-universal2-static_lib-1.16.0.zip
|
||||||
|
)
|
||||||
|
|
||||||
|
foreach(f IN LISTS possible_file_locations)
|
||||||
|
if(EXISTS ${f})
|
||||||
|
set(onnxruntime_URL "${f}")
|
||||||
|
file(TO_CMAKE_PATH "${onnxruntime_URL}" onnxruntime_URL)
|
||||||
|
message(STATUS "Found local downloaded onnxruntime: ${onnxruntime_URL}")
|
||||||
|
set(onnxruntime_URL2)
|
||||||
|
break()
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
FetchContent_Declare(onnxruntime
|
||||||
|
URL
|
||||||
|
${onnxruntime_URL}
|
||||||
|
${onnxruntime_URL2}
|
||||||
|
URL_HASH ${onnxruntime_HASH}
|
||||||
|
)
|
||||||
|
|
||||||
|
FetchContent_GetProperties(onnxruntime)
|
||||||
|
if(NOT onnxruntime_POPULATED)
|
||||||
|
message(STATUS "Downloading onnxruntime from ${onnxruntime_URL}")
|
||||||
|
FetchContent_Populate(onnxruntime)
|
||||||
|
endif()
|
||||||
|
message(STATUS "onnxruntime is downloaded to ${onnxruntime_SOURCE_DIR}")
|
||||||
|
|
||||||
|
# for static libraries, we use onnxruntime_lib_files directly below
|
||||||
|
include_directories(${onnxruntime_SOURCE_DIR}/include)
|
||||||
|
|
||||||
|
file(GLOB onnxruntime_lib_files "${onnxruntime_SOURCE_DIR}/lib/lib*.a")
|
||||||
|
|
||||||
|
set(onnxruntime_lib_files ${onnxruntime_lib_files} PARENT_SCOPE)
|
||||||
|
|
||||||
|
message(STATUS "onnxruntime lib files: ${onnxruntime_lib_files}")
|
||||||
|
install(FILES ${onnxruntime_lib_files} DESTINATION lib)
|
||||||
@@ -9,6 +9,10 @@ if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
|
|||||||
message(FATAL_ERROR "This file is for macOS only. Given: ${CMAKE_SYSTEM_NAME}")
|
message(FATAL_ERROR "This file is for macOS only. Given: ${CMAKE_SYSTEM_NAME}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(NOT BUILD_SHARED_LIBS)
|
||||||
|
message(FATAL_ERROR "This file is for building shared libraries. BUILD_SHARED_LIBS: ${BUILD_SHARED_LIBS}")
|
||||||
|
endif()
|
||||||
|
|
||||||
set(onnxruntime_URL "https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.16.0/onnxruntime-osx-universal2-1.16.0.tgz")
|
set(onnxruntime_URL "https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.16.0/onnxruntime-osx-universal2-1.16.0.tgz")
|
||||||
set(onnxruntime_URL2 "https://huggingface.co/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/onnxruntime-osx-universal2-1.16.0.tgz")
|
set(onnxruntime_URL2 "https://huggingface.co/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/onnxruntime-osx-universal2-1.16.0.tgz")
|
||||||
set(onnxruntime_HASH "SHA256=e5b69ece634cf1cd5cf4b45ab478417199a5e8ab5775f6f12560e09dc5ef7749")
|
set(onnxruntime_HASH "SHA256=e5b69ece634cf1cd5cf4b45ab478417199a5e8ab5775f6f12560e09dc5ef7749")
|
||||||
|
|||||||
61
cmake/onnxruntime-osx-x86_64-static.cmake
Normal file
61
cmake/onnxruntime-osx-x86_64-static.cmake
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
# Copyright (c) 2022-2023 Xiaomi Corporation
|
||||||
|
message(STATUS "CMAKE_SYSTEM_NAME: ${CMAKE_SYSTEM_NAME}")
|
||||||
|
message(STATUS "CMAKE_SYSTEM_PROCESSOR: ${CMAKE_SYSTEM_PROCESSOR}")
|
||||||
|
message(STATUS "CMAKE_OSX_ARCHITECTURES: ${CMAKE_OSX_ARCHITECTURES}")
|
||||||
|
message(STATUS "CMAKE_APPLE_SILICON_PROCESSOR : ${CMAKE_APPLE_SILICON_PROCESSOR}")
|
||||||
|
|
||||||
|
if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
|
||||||
|
message(FATAL_ERROR "This file is for macOS only. Given: ${CMAKE_SYSTEM_NAME}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(BUILD_SHARED_LIBS)
|
||||||
|
message(FATAL_ERROR "This file is for building static libraries. BUILD_SHARED_LIBS: ${BUILD_SHARED_LIBS}")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set(onnxruntime_URL "https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.16.0/onnxruntime-osx-x86_64-static_lib-1.16.0.zip")
|
||||||
|
set(onnxruntime_URL2 "https://huggingface.co/csukuangfj/onnxruntime-libs/resolve/main/onnxruntime-osx-x86_64-static_lib-1.16.0.zip")
|
||||||
|
set(onnxruntime_HASH "SHA256=1686a1b6778483371d29106d8c7300a8960e3db084ab84ac4f870b7685cf5259")
|
||||||
|
|
||||||
|
# If you don't have access to the Internet,
|
||||||
|
# please download onnxruntime to one of the following locations.
|
||||||
|
# You can add more if you want.
|
||||||
|
set(possible_file_locations
|
||||||
|
$ENV{HOME}/Downloads/onnxruntime-osx-x86_64-static_lib-1.16.0.zip
|
||||||
|
${PROJECT_SOURCE_DIR}/onnxruntime-osx-x86_64-static_lib-1.16.0.zip
|
||||||
|
${PROJECT_BINARY_DIR}/onnxruntime-osx-x86_64-static_lib-1.16.0.zip
|
||||||
|
/tmp/onnxruntime-osx-x86_64-static_lib-1.16.0.zip
|
||||||
|
)
|
||||||
|
|
||||||
|
foreach(f IN LISTS possible_file_locations)
|
||||||
|
if(EXISTS ${f})
|
||||||
|
set(onnxruntime_URL "${f}")
|
||||||
|
file(TO_CMAKE_PATH "${onnxruntime_URL}" onnxruntime_URL)
|
||||||
|
message(STATUS "Found local downloaded onnxruntime: ${onnxruntime_URL}")
|
||||||
|
set(onnxruntime_URL2)
|
||||||
|
break()
|
||||||
|
endif()
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
FetchContent_Declare(onnxruntime
|
||||||
|
URL
|
||||||
|
${onnxruntime_URL}
|
||||||
|
${onnxruntime_URL2}
|
||||||
|
URL_HASH ${onnxruntime_HASH}
|
||||||
|
)
|
||||||
|
|
||||||
|
FetchContent_GetProperties(onnxruntime)
|
||||||
|
if(NOT onnxruntime_POPULATED)
|
||||||
|
message(STATUS "Downloading onnxruntime from ${onnxruntime_URL}")
|
||||||
|
FetchContent_Populate(onnxruntime)
|
||||||
|
endif()
|
||||||
|
message(STATUS "onnxruntime is downloaded to ${onnxruntime_SOURCE_DIR}")
|
||||||
|
|
||||||
|
# for static libraries, we use onnxruntime_lib_files directly below
|
||||||
|
include_directories(${onnxruntime_SOURCE_DIR}/include)
|
||||||
|
|
||||||
|
file(GLOB onnxruntime_lib_files "${onnxruntime_SOURCE_DIR}/lib/lib*.a")
|
||||||
|
|
||||||
|
set(onnxruntime_lib_files ${onnxruntime_lib_files} PARENT_SCOPE)
|
||||||
|
|
||||||
|
message(STATUS "onnxruntime lib files: ${onnxruntime_lib_files}")
|
||||||
|
install(FILES ${onnxruntime_lib_files} DESTINATION lib)
|
||||||
@@ -8,6 +8,10 @@ if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
|
|||||||
message(FATAL_ERROR "This file is for macOS only. Given: ${CMAKE_SYSTEM_NAME}")
|
message(FATAL_ERROR "This file is for macOS only. Given: ${CMAKE_SYSTEM_NAME}")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(NOT BUILD_SHARED_LIBS)
|
||||||
|
message(FATAL_ERROR "This file is for building shared libraries. BUILD_SHARED_LIBS: ${BUILD_SHARED_LIBS}")
|
||||||
|
endif()
|
||||||
|
|
||||||
set(onnxruntime_URL "https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.16.0/onnxruntime-osx-x86_64-1.16.0.tgz")
|
set(onnxruntime_URL "https://github.com/csukuangfj/onnxruntime-libs/releases/download/v1.16.0/onnxruntime-osx-x86_64-1.16.0.tgz")
|
||||||
set(onnxruntime_URL2 "https://huggingface.co/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/onnxruntime-osx-x86_64-1.16.0.tgz")
|
set(onnxruntime_URL2 "https://huggingface.co/csukuangfj/sherpa-onnx-cmake-deps/resolve/main/onnxruntime-osx-x86_64-1.16.0.tgz")
|
||||||
set(onnxruntime_HASH "SHA256=3d639a269af4e97a455f23cff363a709ef3a5f3e086162e65e3395c339122285")
|
set(onnxruntime_HASH "SHA256=3d639a269af4e97a455f23cff363a709ef3a5f3e086162e65e3395c339122285")
|
||||||
|
|||||||
@@ -27,17 +27,37 @@ function(download_onnxruntime)
|
|||||||
endif()
|
endif()
|
||||||
elseif(CMAKE_SYSTEM_NAME STREQUAL Darwin)
|
elseif(CMAKE_SYSTEM_NAME STREQUAL Darwin)
|
||||||
if (arm64 IN_LIST CMAKE_OSX_ARCHITECTURES AND x86_64 IN_LIST CMAKE_OSX_ARCHITECTURES)
|
if (arm64 IN_LIST CMAKE_OSX_ARCHITECTURES AND x86_64 IN_LIST CMAKE_OSX_ARCHITECTURES)
|
||||||
|
if(BUILD_SHARED_LIBS)
|
||||||
include(onnxruntime-osx-universal)
|
include(onnxruntime-osx-universal)
|
||||||
|
else()
|
||||||
|
include(onnxruntime-osx-universal-static)
|
||||||
|
endif()
|
||||||
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64 AND CMAKE_OSX_ARCHITECTURES STREQUAL "arm64")
|
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64 AND CMAKE_OSX_ARCHITECTURES STREQUAL "arm64")
|
||||||
# cross compiling
|
# cross compiling
|
||||||
|
if(BUILD_SHARED_LIBS)
|
||||||
include(onnxruntime-osx-arm64)
|
include(onnxruntime-osx-arm64)
|
||||||
|
else()
|
||||||
|
include(onnxruntime-osx-arm64-static)
|
||||||
|
endif()
|
||||||
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL arm64 AND CMAKE_OSX_ARCHITECTURES STREQUAL "x86_64")
|
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL arm64 AND CMAKE_OSX_ARCHITECTURES STREQUAL "x86_64")
|
||||||
# cross compiling
|
# cross compiling
|
||||||
|
if(BUILD_SHARED_LIBS)
|
||||||
include(onnxruntime-osx-x86_64)
|
include(onnxruntime-osx-x86_64)
|
||||||
|
else()
|
||||||
|
include(onnxruntime-osx-x86_64-static)
|
||||||
|
endif()
|
||||||
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL arm64)
|
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL arm64)
|
||||||
|
if(BUILD_SHARED_LIBS)
|
||||||
include(onnxruntime-osx-arm64)
|
include(onnxruntime-osx-arm64)
|
||||||
|
else()
|
||||||
|
include(onnxruntime-osx-arm64-static)
|
||||||
|
endif()
|
||||||
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64)
|
elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL x86_64)
|
||||||
|
if(BUILD_SHARED_LIBS)
|
||||||
include(onnxruntime-osx-x86_64)
|
include(onnxruntime-osx-x86_64)
|
||||||
|
else()
|
||||||
|
include(onnxruntime-osx-x86_64-static)
|
||||||
|
endif()
|
||||||
else()
|
else()
|
||||||
message(FATAL_ERROR "Unsupport processor {CMAKE_SYSTEM_PROCESSOR} for Darwin")
|
message(FATAL_ERROR "Unsupport processor {CMAKE_SYSTEM_PROCESSOR} for Darwin")
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -113,12 +113,16 @@ target_link_libraries(sherpa-onnx-core kaldi-native-fbank-core)
|
|||||||
|
|
||||||
target_link_libraries(sherpa-onnx-core kaldi-decoder-core)
|
target_link_libraries(sherpa-onnx-core kaldi-decoder-core)
|
||||||
|
|
||||||
if(BUILD_SHARED_LIBS OR APPLE)
|
if(BUILD_SHARED_LIBS)
|
||||||
target_link_libraries(sherpa-onnx-core onnxruntime)
|
target_link_libraries(sherpa-onnx-core onnxruntime)
|
||||||
else()
|
else()
|
||||||
target_link_libraries(sherpa-onnx-core ${onnxruntime_lib_files})
|
target_link_libraries(sherpa-onnx-core ${onnxruntime_lib_files})
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if(NOT BUILD_SHARED_LIBS AND APPLE)
|
||||||
|
target_link_libraries(sherpa-onnx-core "-framework Foundation")
|
||||||
|
endif()
|
||||||
|
|
||||||
if(SHERPA_ONNX_ENABLE_GPU)
|
if(SHERPA_ONNX_ENABLE_GPU)
|
||||||
target_link_libraries(sherpa-onnx-core
|
target_link_libraries(sherpa-onnx-core
|
||||||
onnxruntime_providers_cuda
|
onnxruntime_providers_cuda
|
||||||
|
|||||||
Reference in New Issue
Block a user