Skip to content

Commit

Permalink
support osx-arm64
Browse files Browse the repository at this point in the history
  • Loading branch information
csukuangfj committed Jun 13, 2024
1 parent 625e931 commit 966723d
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 8 deletions.
3 changes: 2 additions & 1 deletion PortAudioSharp/PortAudioSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFrameworks>netstandard2.0;netcoreapp3.1;net6.0;net7.0</TargetFrameworks>
<RuntimeIdentifiers>linux-x64;osx-x64;win-x64</RuntimeIdentifiers>
<RuntimeIdentifiers>linux-x64;osx-x64;osx-arm64;win-x64</RuntimeIdentifiers>

<PackageReadmeFile>README.md</PackageReadmeFile>
<!-- NuGet Packaging info -->
Expand Down Expand Up @@ -31,6 +31,7 @@
<ItemGroup>
<PackageReference Include="org.k2fsa.portaudio.runtime.linux-x64" Version="1.0.2" />
<PackageReference Include="org.k2fsa.portaudio.runtime.osx-x64" Version="1.0.2" />
<PackageReference Include="org.k2fsa.portaudio.runtime.osx-arm64" Version="1.0.2" />
<PackageReference Include="org.k2fsa.portaudio.runtime.win-x64" Version="1.0.2" />
</ItemGroup>
</Project>
9 changes: 5 additions & 4 deletions scripts/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,17 @@ def process_linux(s):
f.write(s)


def process_macos(s):
def process_macos(s, arch):
libs = "libportaudio.dylib"

d = get_dict()
d["dotnet_rid"] = "osx-x64"
d["dotnet_rid"] = f"osx-{arch}"
d["libs"] = libs

environment = jinja2.Environment()
template = environment.from_string(s)
s = template.render(**d)
with open("./macos/portaudio.runtime.csproj", "w") as f:
with open(f"./macos-{arch}/portaudio.runtime.csproj", "w") as f:
f.write(s)


Expand All @@ -68,7 +68,8 @@ def process_windows(s):

def main():
s = read_proj_file("./portaudio.csproj.runtime.in")
process_macos(s)
process_macos(s, "x64")
process_macos(s, "arm64")
process_linux(s)
process_windows(s)

Expand Down
12 changes: 9 additions & 3 deletions scripts/run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@

set -ex

mkdir -p macos linux windows all
mkdir -p macos-x64 macos-arm64 linux windows all
rm -rf packages

cp -v ./libportaudio.dylib ./macos
cp -v ./libportaudio.dylib ./macos-x64
cp -v ./libportaudio.dylib ./macos-arm64
cp -v ./libportaudio.so ./linux
cp -v ./portaudio.dll ./windows

Expand All @@ -17,7 +18,12 @@ dotnet build -c Release
dotnet pack -c Release -o ../../PortAudioSharp/packages
popd

pushd macos
pushd macos-x64
dotnet build -c Release
dotnet pack -c Release -o ../../PortAudioSharp/packages
popd

pushd macos-arm64
dotnet build -c Release
dotnet pack -c Release -o ../../PortAudioSharp/packages
popd
Expand Down

0 comments on commit 966723d

Please sign in to comment.