Toggle navigation
Toggle navigation
此项目
正在载入...
Sign in
xuning
/
sherpaonnx
转到一个项目
Toggle navigation
项目
群组
代码片段
帮助
Toggle navigation pinning
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Fangjun Kuang
2024-07-08 16:13:51 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Committed by
GitHub
2024-07-08 16:13:51 +0800
Commit
5d2ceb3513bc5904231e95889523b6c077fa9bcd
5d2ceb35
1 parent
02eab549
Support linux-arm64 for .Net (#1092)
隐藏空白字符变更
内嵌
并排对比
正在显示
3 个修改的文件
包含
45 行增加
和
17 行删除
scripts/dotnet/generate.py
scripts/dotnet/run.sh
scripts/dotnet/sherpa-onnx.csproj.in
scripts/dotnet/generate.py
查看文件 @
5d2ceb3
...
...
@@ -34,23 +34,23 @@ def get_dict():
}
def
process_linux
(
s
):
def
process_linux
(
s
,
rid
):
libs
=
[
"libonnxruntime.so.1.17.1"
,
"libsherpa-onnx-c-api.so"
,
]
prefix
=
f
"{src_dir}/linux/"
prefix
=
f
"{src_dir}/linux
-{rid}
/"
libs
=
[
prefix
+
lib
for
lib
in
libs
]
libs
=
"
\n
;"
.
join
(
libs
)
d
=
get_dict
()
d
[
"dotnet_rid"
]
=
"linux-x64
"
d
[
"dotnet_rid"
]
=
f
"linux-{rid}
"
d
[
"libs"
]
=
libs
environment
=
jinja2
.
Environment
()
template
=
environment
.
from_string
(
s
)
s
=
template
.
render
(
**
d
)
with
open
(
"./linux
/sherpa-onnx.runtime.csproj"
,
"w"
)
as
f
:
with
open
(
f
"./linux-{rid}
/sherpa-onnx.runtime.csproj"
,
"w"
)
as
f
:
f
.
write
(
s
)
...
...
@@ -101,7 +101,8 @@ def main():
s
=
read_proj_file
(
"./sherpa-onnx.csproj.runtime.in"
)
process_macos
(
s
,
"x64"
)
process_macos
(
s
,
"arm64"
)
process_linux
(
s
)
process_linux
(
s
,
"x64"
)
process_linux
(
s
,
"arm64"
)
process_windows
(
s
,
"x64"
)
process_windows
(
s
,
"x86"
)
process_windows
(
s
,
"arm64"
)
...
...
scripts/dotnet/run.sh
查看文件 @
5d2ceb3
...
...
@@ -24,10 +24,13 @@ export src_dir
mkdir -p
$src_dir
pushd
$src_dir
mkdir -p linux macos-x64 macos-arm64 windows-x64 windows-x86 windows-arm64
mkdir -p linux
-x64 linux-arm64
macos-x64 macos-arm64 windows-x64 windows-x86 windows-arm64
linux_wheel_filename
=
sherpa_onnx-
${
SHERPA_ONNX_VERSION
}
-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
linux_wheel
=
$src_dir
/
$linux_wheel_filename
linux_x64_wheel_filename
=
sherpa_onnx-
${
SHERPA_ONNX_VERSION
}
-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
linux_x64_wheel
=
$src_dir
/
$linux_x64_wheel_filename
linux_arm64_wheel_filename
=
sherpa_onnx-
${
SHERPA_ONNX_VERSION
}
-cp38-cp38-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
linux_arm64_wheel
=
$src_dir
/
$linux_arm64_wheel_filename
macos_x64_wheel_filename
=
sherpa_onnx-
${
SHERPA_ONNX_VERSION
}
-cp39-cp39-macosx_11_0_x86_64.whl
macos_x64_wheel
=
$src_dir
/
$macos_x64_wheel_filename
...
...
@@ -44,17 +47,35 @@ windows_x86_wheel=$src_dir/$windows_x86_wheel_filename
windows_arm64_wheel_filename
=
sherpa-onnx-
${
SHERPA_ONNX_VERSION
}
-win-arm64.tar.bz2
windows_arm64_wheel
=
$src_dir
/
$windows_arm64_wheel_filename
if
[
! -f
$src_dir
/linux/libsherpa-onnx-c-api.so
]
;
then
if
[
! -f
$src_dir
/linux
-x64
/libsherpa-onnx-c-api.so
]
;
then
echo
"---linux x86_64---"
cd
linux
cd
linux-x64
mkdir -p wheel
cd
wheel
if
[
-f
$linux_x64_wheel
]
;
then
cp -v
$linux_x64_wheel
.
else
curl -OL https://
$HF_MIRROR
/csukuangfj/sherpa-onnx-wheels/resolve/main/
$linux_x64_wheel_filename
fi
unzip
$linux_x64_wheel_filename
cp -v sherpa_onnx/lib/
*
.so
*
../
cd
..
rm -rf wheel
ls -lh
cd
..
fi
if
[
! -f
$src_dir
/linux-arm64/libsherpa-onnx-c-api.so
]
;
then
echo
"---linux arm64---"
cd
linux-arm64
mkdir -p wheel
cd
wheel
if
[
-f
$linux_wheel
]
;
then
cp -v
$linux_wheel
.
if
[
-f
$linux_arm64_wheel
]
;
then
cp -v
$linux_arm64_wheel
.
else
curl -OL https://
$HF_MIRROR
/csukuangfj/sherpa-onnx-wheels/resolve/main/
$linux_wheel_filename
curl -OL https://
$HF_MIRROR
/csukuangfj/sherpa-onnx-wheels/resolve/main/
$linux_
arm64_
wheel_filename
fi
unzip
$linux_wheel_filename
unzip
$linux_
arm64_
wheel_filename
cp -v sherpa_onnx/lib/
*
.so
*
../
cd
..
rm -rf wheel
...
...
@@ -161,13 +182,18 @@ fi
popd
mkdir -p macos-x64 macos-arm64 linux windows-x64 windows-x86 windows-arm64 all
mkdir -p macos-x64 macos-arm64 linux
-x64 linux-arm64
windows-x64 windows-x86 windows-arm64 all
cp ./
*
.cs all
./generate.py
pushd
linux
pushd
linux-x64
dotnet build -c Release
dotnet pack -c Release -o ../packages
popd
pushd
linux-arm64
dotnet build -c Release
dotnet pack -c Release -o ../packages
popd
...
...
scripts/dotnet/sherpa-onnx.csproj.in
查看文件 @
5d2ceb3
...
...
@@ -5,7 +5,7 @@
<OutputType>Library</OutputType>
<LangVersion>10.0</LangVersion>
<TargetFrameworks>net6.0;net45;net40;net35;net20;netstandard2.0</TargetFrameworks>
<RuntimeIdentifiers>linux-x64;osx-x64;osx-arm64;win-x64;win-x86;win-arm64</RuntimeIdentifiers>
<RuntimeIdentifiers>linux-x64;
linux-arm64;
osx-x64;osx-arm64;win-x64;win-x86;win-arm64</RuntimeIdentifiers>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<AssemblyName>sherpa-onnx</AssemblyName>
<Version>{{ version }}</Version>
...
...
@@ -49,6 +49,7 @@
<ItemGroup>
<PackageReference Include="org.k2fsa.sherpa.onnx.runtime.linux-x64" Version="{{ version }}" />
<PackageReference Include="org.k2fsa.sherpa.onnx.runtime.linux-arm64" Version="{{ version }}" />
<PackageReference Include="org.k2fsa.sherpa.onnx.runtime.osx-x64" Version="{{ version }}" />
<PackageReference Include="org.k2fsa.sherpa.onnx.runtime.osx-arm64" Version="{{ version }}" />
<PackageReference Include="org.k2fsa.sherpa.onnx.runtime.win-x64" Version="{{ version }}" />
...
...
请
注册
或
登录
后发表评论