Skip to content

Commit

Permalink
Add Windows ARM64 support (#1350)
Browse files Browse the repository at this point in the history
  • Loading branch information
matt200-ok authored Jan 16, 2025
1 parent 840ac76 commit 0272de7
Show file tree
Hide file tree
Showing 42 changed files with 188 additions and 81 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ body:
- Web (WASM)
- Linux (x86_64)
- macOS (x86_64, arm64)
- Windows (x86_64)
- Windows (x86_64, arm64)
- Raspberry Pi
- ARM Cortex-M
validations:
Expand Down
13 changes: 11 additions & 2 deletions .github/workflows/c-demos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,18 @@ jobs:
strategy:
matrix:
machine: [rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64]
make_file: ["Unix Makefiles"]
include:
- machine: pv-windows-arm64
make_file: "MinGW Makefiles"

steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Create build directory
run: cmake -B ./build
run: cmake -G "${{ matrix.make_file }}" -B ./build

- name: Build micdemo
run: cmake --build ./build --target porcupine_demo_mic
Expand Down Expand Up @@ -124,6 +128,7 @@ jobs:
strategy:
matrix:
machine: [rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64]
make_file: ["Unix Makefiles"]
include:
- machine: rpi3-32
platform: raspberry-pi
Expand All @@ -140,14 +145,18 @@ jobs:
- machine: rpi5-64
platform: raspberry-pi
arch: cortex-a76-aarch64
- machine: pv-windows-arm64
platform: windows
arch: arm64
make_file: "MinGW Makefiles"

steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Create build directory
run: cmake -B ./build
run: cmake -G "${{ matrix.make_file }}" -B ./build

- name: Build filedemo
run: cmake --build ./build --target porcupine_demo_file
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dotnet-demos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:

strategy:
matrix:
machine: [rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64]
machine: [rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64, pv-windows-arm64]

steps:
- uses: actions/checkout@v3
Expand Down
16 changes: 15 additions & 1 deletion .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,14 @@ jobs:
binding-framework: net8.0
test-framework: net8.0
exclude:
- os: ubuntu-latest
dotnet-version: 2.1.x
- os: ubuntu-latest
dotnet-version: 3.0.x
- os: ubuntu-latest
dotnet-version: 3.1.x
- os: ubuntu-latest
dotnet-version: 5.0.x
- os: macos-latest
dotnet-version: 2.1.x
- os: macos-latest
Expand All @@ -92,6 +100,12 @@ jobs:
with:
dotnet-version: ${{ matrix.dotnet-version }}

- name: Set up .NET (8)
if: ${{ matrix.os == 'ubuntu-latest' && matrix.dotnet-version == '6.0.x' }}
uses: actions/setup-dotnet@v3
with:
dotnet-version: 8.0.x

- name: Build binding
run: dotnet build Porcupine/Porcupine.csproj --framework ${{ matrix.binding-framework }}

Expand All @@ -105,7 +119,7 @@ jobs:

strategy:
matrix:
machine: [rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-32, rpi5-64]
machine: [rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-32, rpi5-64, pv-windows-arm64]

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/java-demos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ jobs:

strategy:
matrix:
machine: [rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64]
machine: [rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64, pv-windows-arm64]

steps:
- uses: actions/checkout@v3
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/java-perf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,24 @@ jobs:
- name: Machine state after
working-directory: resources/scripts
run: bash machine-state.sh

perf-windows-arm64:
runs-on: ${{ matrix.machine }}

strategy:
fail-fast: false
matrix:
machine: [pv-windows-arm64]
include:
- machine: pv-windows-arm64
num_test_iterations: 50
performance_threshold_sec: 0.5

steps:
- uses: actions/checkout@v3

- name: Build
run: ./gradlew assemble

- name: Test
run: ./gradlew test --info --tests PorcupinePerformanceTest -DpvTestingAccessKey="${{secrets.PV_VALID_ACCESS_KEY}}" -DnumTestIterations="${{matrix.num_test_iterations}}" -DperformanceThresholdSec="${{matrix.performance_threshold_sec}}"
2 changes: 1 addition & 1 deletion .github/workflows/java.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:

strategy:
matrix:
machine: [rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64]
machine: [rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64, pv-windows-arm64]

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/nodejs-demos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:

strategy:
matrix:
machine: [rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64]
machine: [rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64, pv-windows-arm64]

steps:
- uses: actions/checkout@v3
Expand Down
24 changes: 24 additions & 0 deletions .github/workflows/nodejs-perf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,27 @@ jobs:
- name: Machine state after
working-directory: resources/scripts
run: bash machine-state.sh

performance-windows-arm64:
runs-on: ${{ matrix.machine }}

strategy:
fail-fast: false
matrix:
machine: [pv-windows-arm64]
include:
- machine: pv-windows-arm64
num_test_iterations: 50
performance_threshold_sec: 0.5

steps:
- uses: actions/checkout@v3

- name: Pre-build dependencies
run: npm install --global yarn

- name: Install dependencies
run: yarn install

- name: Test
run: yarn test test/perf.test.ts --access_key=${{secrets.PV_VALID_ACCESS_KEY}} --num_test_iterations=${{matrix.num_test_iterations}} --performance_threshold_sec=${{matrix.performance_threshold_sec}}
2 changes: 1 addition & 1 deletion .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ jobs:

strategy:
matrix:
machine: [rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64]
machine: [rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64, pv-windows-arm64]

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/python-demos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ jobs:

strategy:
matrix:
machine: [rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64]
machine: [rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64, pv-windows-arm64]

steps:
- uses: actions/checkout@v3
Expand Down
18 changes: 18 additions & 0 deletions .github/workflows/python-perf.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,3 +100,21 @@ jobs:
- name: Machine state after
working-directory: resources/scripts
run: bash machine-state.sh

perf-windows-arm64:
runs-on: ${{ matrix.machine }}

strategy:
fail-fast: false
matrix:
machine: [pv-windows-arm64]
include:
- machine: pv-windows-arm64
num_test_iterations: 50
performance_threshold_sec: 0.5

steps:
- uses: actions/checkout@v3

- name: Test
run: python3 test_porcupine_perf.py ${{secrets.PV_VALID_ACCESS_KEY}} ${{matrix.num_test_iterations}} ${{matrix.performance_threshold_sec}}
2 changes: 1 addition & 1 deletion .github/workflows/python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:

strategy:
matrix:
machine: [rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64]
machine: [rpi3-32, rpi3-64, rpi4-32, rpi4-64, rpi5-64, pv-windows-arm64]

steps:
- uses: actions/checkout@v3
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ applications. It is
- Raspberry Pi (Zero, 3, 4, 5)
- Android and iOS
- Chrome, Safari, Firefox, and Edge
- Linux (x86_64), macOS (x86_64, arm64), and Windows (x86_64)
- Linux (x86_64), macOS (x86_64, arm64), and Windows (x86_64, arm64)
- scalable. It can detect multiple always-listening voice commands with no added runtime footprint.
- self-service. Developers can train custom wake word models using [Picovoice Console](https://console.picovoice.ai/).

Expand Down
55 changes: 29 additions & 26 deletions binding/dotnet/Porcupine/Porcupine.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<PropertyGroup>
<TargetFrameworks>net8.0;net6.0;netcoreapp3.0;netstandard2.0</TargetFrameworks>
<Version>3.0.4</Version>
<Version>3.0.5</Version>
<Authors>Picovoice</Authors>
<Company />
<Product>Porcupine Wake Word Engine</Product>
Expand Down Expand Up @@ -58,17 +58,6 @@
<Link>lib\windows\amd64\libpv_porcupine.dll</Link>
<Visible>false</Visible>
</Content>
<Content Include="..\..\..\lib\linux\x86_64\libpv_porcupine.so">
<PackagePath>
build/netstandard2.0/libpv_porcupine.so;
build/netcoreapp3.0/lib/linux/x86_64/libpv_porcupine.so;
build/net6.0/lib/linux/x86_64/libpv_porcupine.so;
build/net8.0/lib/linux/x86_64/libpv_porcupine.so;
</PackagePath>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Link>lib\linux\x86_64\libpv_porcupine.so</Link>
<Visible>false</Visible>
</Content>
<Content Include="..\..\..\lib\mac\x86_64\libpv_porcupine.dylib">
<PackagePath>
build/netstandard2.0/libpv_porcupine.dylib;
Expand All @@ -82,20 +71,6 @@
</Content>
</ItemGroup>

<!--.NET Core 3.0+ libs-->
<ItemGroup>
<Content Include="..\..\..\lib\raspberry-pi\**\*" Exclude="..\..\..\lib\raspberry-pi\arm11\*">
<PackagePath>
build/netcoreapp3.0/lib/raspberry-pi;
build/net6.0/lib/raspberry-pi;
build/net8.0/lib/raspberry-pi;
</PackagePath>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Link>lib\raspberry-pi\%(RecursiveDir)%(Filename)%(Extension)</Link>
<Visible>false</Visible>
</Content>
</ItemGroup>

<!--.NET 6.0+ libs-->
<ItemGroup>
<Content Include="..\..\..\lib\mac\arm64\libpv_porcupine.dylib">
Expand All @@ -107,8 +82,36 @@
<Link>lib\mac\arm64\libpv_porcupine.dylib</Link>
<Visible>false</Visible>
</Content>
<Content Include="..\..\..\lib\windows\arm64\libpv_porcupine.dll">
<PackagePath>
build/net6.0/lib/windows/arm64/libpv_porcupine.dll;
build/net8.0/lib/windows/arm64/libpv_porcupine.dll;
</PackagePath>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Link>lib\windows\arm64\libpv_porcupine.dll</Link>
<Visible>false</Visible>
</Content>
<Content Include="..\..\..\lib\linux\x86_64\libpv_porcupine.so">
<PackagePath>
build/net6.0/lib/linux/x86_64/libpv_porcupine.so;
build/net8.0/lib/linux/x86_64/libpv_porcupine.so;
</PackagePath>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Link>lib\linux\x86_64\libpv_porcupine.so</Link>
<Visible>false</Visible>
</Content>
<Content Include="..\..\..\lib\raspberry-pi\**\*" Exclude="..\..\..\lib\raspberry-pi\arm11\*">
<PackagePath>
build/net6.0/lib/raspberry-pi;
build/net8.0/lib/raspberry-pi;
</PackagePath>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Link>lib\raspberry-pi\%(RecursiveDir)%(Filename)%(Extension)</Link>
<Visible>false</Visible>
</Content>
</ItemGroup>


<!--Resources-->
<ItemGroup>
<Content Include="..\..\..\resources\keyword_files\windows\alexa_windows.ppn;
Expand Down
4 changes: 4 additions & 0 deletions binding/dotnet/Porcupine/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,10 @@ public static string PvLibraryPath(string libName)
{
return Path.Combine(AppContext.BaseDirectory, $"lib/{_env}/amd64/{libName}.dll");
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) && _arch == Architecture.Arm64)
{
return Path.Combine(AppContext.BaseDirectory, $"lib/{_env}/arm64/{libName}.dll");
}
if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX) && _arch == Architecture.X64)
{
return Path.Combine(AppContext.BaseDirectory, $"lib/{_env}/x86_64/{libName}.dylib");
Expand Down
7 changes: 3 additions & 4 deletions binding/dotnet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,20 +26,19 @@ Platform compatible with .NET Framework 4.6.1+:

Platforms compatible with .NET Core 2.0+:

- Linux (x86_64)
- macOS (x86_64)
- Windows (x86_64)

Platforms compatible with .NET Core 3.0+:
Platform compatible with .NET 6.0+:

- Raspberry Pi:
- 3 (32 and 64 bit)
- 4 (32 and 64 bit)
- 5 (32 and 64 bit)

Platform compatible with .NET 6.0+:

- Linux (x86_64)
- macOS (arm64)
- Windows (arm64)

## Installation

Expand Down
2 changes: 1 addition & 1 deletion binding/java/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ To learn more about Porcupine, see the [product](https://picovoice.ai/products/p

- Linux (x86_64)
- macOS (x86_64, arm64)
- Windows (x86_64)
- Windows (x86_64, arm64)
- Raspberry Pi 3 (32 and 64 bit), Raspberry Pi 4 (32 and 64 bit), Raspberry Pi 5 (32 and 64 bit)

## Installation
Expand Down
7 changes: 5 additions & 2 deletions binding/java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {

ext {
PUBLISH_GROUP_ID = 'ai.picovoice'
PUBLISH_VERSION = '3.0.3'
PUBLISH_VERSION = '3.0.4'
PUBLISH_ARTIFACT_ID = 'porcupine-java'
}

Expand Down Expand Up @@ -124,7 +124,10 @@ task copyMacLib(type: Copy) {
into "${outputDir}/porcupine/lib/java/mac/"
}
task copyWindowsLib(type: Copy) {
from('../../lib/java/windows/amd64/pv_porcupine_jni.dll') into "${outputDir}/porcupine/lib/java/windows/amd64/"
from('../../lib/java/windows/')
include('amd64/pv_porcupine_jni.dll',
'arm64/pv_porcupine_jni.dll')
into "${outputDir}/porcupine/lib/java/windows/"
}
task copyRPiLib(type: Copy) {
from('../../lib/java/raspberry-pi/')
Expand Down
2 changes: 1 addition & 1 deletion binding/java/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading

0 comments on commit 0272de7

Please sign in to comment.