Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/samples-integration-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ jobs:
clean: true

- name: Setup Node.js
uses: actions/setup-node@v7
uses: actions/setup-node@v6
with:
node-version: '20.x'

Expand All @@ -109,7 +109,7 @@ jobs:
python-version: '3.x'

- name: Setup .NET SDK for NuGet authentication
uses: actions/setup-dotnet@v6
uses: actions/setup-dotnet@v5
with:
dotnet-version: '10.0.x'

Expand Down Expand Up @@ -185,7 +185,7 @@ jobs:
clean: true

- name: Setup .NET SDK
uses: actions/setup-dotnet@v6
uses: actions/setup-dotnet@v5
with:
dotnet-version: |
8.0.x
Expand Down
8 changes: 8 additions & 0 deletions .pipelines/v2/templates/steps-build-js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,14 @@ steps:
throw "WinML runtime DLL not found in native artifact: $winmlDll"
}

$directMlDll = Join-Path "${{ parameters.nativeArtifactDir }}" 'DirectML.dll'
if (Test-Path $directMlDll) {
Copy-Item $directMlDll -Destination $dst -Force
Write-Host " staged DirectML.dll"
} else {
throw "DirectML.dll not found in native artifact: $directMlDll"
}

Get-ChildItem $dst | ForEach-Object { Write-Host " $($_.Name) $($_.Length) bytes" }
displayName: 'Stage prebuild directory'

Expand Down
47 changes: 32 additions & 15 deletions .pipelines/v2/templates/steps-build-linux.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,27 +75,44 @@ steps:
displayName: 'Dump vcpkg error logs'
condition: failed()

# Stage the redistributable native artifact. Vcpkg uses static linkage on
# Linux (see sdk_v2/cpp/triplets/x64-linux.cmake), so libfoundry_local.so
# carries its transitive deps (azure-*, spdlog, fmt, libcurl, libssl/libcrypto,
# zlib, brotli*) inside itself — the only file we need to forward downstream
# is libfoundry_local.so. ORT/GenAI .so files are also present in bin/ but are
# supplied to consumers separately (pip on the Python side, NuGet on the C#
# side); test/example binaries are not part of the redistributable surface.
# Stage the redistributable native artifacts for standalone C++ consumers.
- bash: |
set -euo pipefail
src='$(Build.SourcesDirectory)/sdk_v2/cpp/build/Linux/${{ parameters.buildConfig }}/bin'
dst='$(Build.ArtifactStagingDirectory)/native'
mkdir -p "$dst"

primary="$src/libfoundry_local.so"
if [ ! -f "$primary" ]; then
echo "ERROR: libfoundry_local.so not found at $primary" >&2
exit 1
fi
cp -P "$primary" "$dst/"
echo " staged libfoundry_local.so"

required=(
"$src/libfoundry_local.so"
"$src/libonnxruntime-genai.so"
"$src/libonnxruntime.so"
)
for f in "${required[@]}"; do
if [ ! -e "$f" ]; then
echo "ERROR: required native artifact not found: $f" >&2
exit 1
fi
cp -P "$f" "$dst/"
echo " staged $(basename "$f")"
done
for f in "$src"/libonnxruntime.so.*; do
if [ -e "$f" ]; then
cp -P "$f" "$dst/"
echo " staged $(basename "$f")"
fi
done
for f in "$src"/libonnxruntime-genai*.so; do
if [ -e "$f" ] && [ "$(basename "$f")" != "libonnxruntime-genai.so" ]; then
cp -P "$f" "$dst/"
echo " staged $(basename "$f")"
fi
done
for f in "$src"/libonnxruntime_providers_*.so; do
if [ -e "$f" ]; then
cp -P "$f" "$dst/"
echo " staged $(basename "$f")"
fi
done
displayName: 'Stage native artifacts'

# Stage debug symbols into a separate artifact so they can be published
Expand Down
40 changes: 26 additions & 14 deletions .pipelines/v2/templates/steps-build-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,26 +81,38 @@ steps:
displayName: 'Dump vcpkg error logs'
condition: failed()

# Stage the redistributable native artifact. macOS has no triplet overlay so
# vcpkg uses its default arm64-osx triplet, which is static — libfoundry_local.dylib
# carries its transitive deps (azure-*, spdlog, fmt, libcurl, libssl/libcrypto,
# zlib, brotli*) inside itself. ORT/GenAI .dylib files are supplied to consumers
# separately (pip on the Python side, NuGet on the C# side); test/example binaries
# are not part of the redistributable surface.
# Stage the redistributable native artifacts for standalone C++ consumers.
- bash: |
set -euo pipefail
src='$(Build.SourcesDirectory)/sdk_v2/cpp/build/macOS/${{ parameters.buildConfig }}/bin'
dst='$(Build.ArtifactStagingDirectory)/native'
mkdir -p "$dst"

primary="$src/libfoundry_local.dylib"
if [ ! -f "$primary" ]; then
echo "ERROR: libfoundry_local.dylib not found at $primary" >&2
exit 1
fi
cp -P "$primary" "$dst/"
echo " staged libfoundry_local.dylib"

required=(
"$src/libfoundry_local.dylib"
"$src/libonnxruntime-genai.dylib"
"$src/libonnxruntime.dylib"
)
for f in "${required[@]}"; do
if [ ! -e "$f" ]; then
echo "ERROR: required native artifact not found: $f" >&2
exit 1
fi
cp -P "$f" "$dst/"
echo " staged $(basename "$f")"
done
for f in "$src"/libonnxruntime.*.dylib; do
if [ -e "$f" ]; then
cp -P "$f" "$dst/"
echo " staged $(basename "$f")"
fi
done
for f in "$src"/libonnxruntime_providers_*.dylib; do
if [ -e "$f" ]; then
cp -P "$f" "$dst/"
echo " staged $(basename "$f")"
fi
done
displayName: 'Stage native artifacts'

# Stage debug symbols into a separate artifact so they can be published
Expand Down
24 changes: 23 additions & 1 deletion .pipelines/v2/templates/steps-build-python.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,10 +106,32 @@ steps:
# deps (onnxruntime-{core,gpu} / onnxruntime-genai-{core,cuda}). Test
# and example binaries are also filtered out upstream. We just copy
# the curated artifact contents straight in.
$files = Get-ChildItem -Path "${{ parameters.nativeArtifactDir }}" -Recurse -File
$rid = '${{ parameters.rid }}'
if ($rid -like 'win-*') {
$allowed = @('foundry_local.dll', 'foundry_local.lib', 'Microsoft.Windows.AI.MachineLearning.dll', 'DirectML.dll')
} elseif ($rid -like 'linux-*') {
$allowed = @('libfoundry_local.so')
} elseif ($rid -like 'osx-*') {
$allowed = @('libfoundry_local.dylib')
} else {
throw "Unsupported Python wheel RID: $rid"
}
$files = foreach ($name in $allowed) {
Get-ChildItem -Path "${{ parameters.nativeArtifactDir }}" -Filter $name -File -ErrorAction SilentlyContinue
}
if ($files.Count -eq 0) {
throw "No native artifacts found under ${{ parameters.nativeArtifactDir }}"
}
if ($rid -like 'win-*') {
$found = @{}
foreach ($f in $files) {
$found[$f.Name] = $true
}
$missing = @($allowed | Where-Object { -not $found.ContainsKey($_) })
if ($missing.Count -gt 0) {
throw "Missing required Windows native artifact(s): $($missing -join ', ') under ${{ parameters.nativeArtifactDir }}"
}
}
foreach ($f in $files) {
Copy-Item $f.FullName -Destination $dest -Force
}
Expand Down
14 changes: 13 additions & 1 deletion .pipelines/v2/templates/steps-build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,13 @@ steps:
(Join-Path $binDir 'foundry_local.dll'),
(Join-Path $binDir 'foundry_local.pdb'),
(Join-Path $linkDir 'foundry_local.lib'),
(Join-Path $binDir 'Microsoft.Windows.AI.MachineLearning.dll')
(Join-Path $binDir 'Microsoft.Windows.AI.MachineLearning.dll'),
(Join-Path $binDir 'DirectML.dll'),
(Join-Path $binDir 'onnxruntime.dll'),
(Join-Path $binDir 'onnxruntime-genai.dll')
)
$optionalPatterns = @(
'onnxruntime_providers_*.dll'
)

foreach ($s in $sources) {
Expand All @@ -149,6 +155,12 @@ steps:
Copy-Item -Path $s -Destination $dst -Force
Write-Host " staged $(Split-Path -Leaf $s)"
}
foreach ($pattern in $optionalPatterns) {
Get-ChildItem -Path $binDir -Filter $pattern -File -ErrorAction SilentlyContinue | ForEach-Object {
Copy-Item -Path $_.FullName -Destination $dst -Force
Write-Host " staged $($_.Name)"
}
}

- ${{ if eq(parameters.stageHeaders, true) }}:
- task: CopyFiles@2
Expand Down
44 changes: 32 additions & 12 deletions .pipelines/v2/templates/steps-pack-cpp-sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,8 @@ steps:

Copy-Item -Path (Join-Path $includeSrc '*') -Destination $includeDst -Recurse -Force

# The SDK tgz should include only public wrapper headers.
# The SDK tgz should include public wrapper headers and their header-only dependencies.
$pathsToPrune = @(
(Join-Path $includeDst 'gsl'),
(Join-Path $includeDst '_manifest')
)
foreach ($pathToPrune in $pathsToPrune) {
Expand All @@ -72,13 +71,17 @@ steps:
}
}

foreach ($f in $Files) {
$src = Join-Path $nativeSrc $f
if (-not (Test-Path $src)) {
throw "Required native file not found: $src"
foreach ($entry in $Files) {
$optional = $entry.StartsWith('?')
$pattern = if ($optional) { $entry.Substring(1) } else { $entry }
$matches = @(Get-ChildItem -Path $nativeSrc -Filter $pattern -File -ErrorAction SilentlyContinue)
if ($matches.Count -eq 0 -and -not $optional) {
throw "Required native file not found: $(Join-Path $nativeSrc $pattern)"
}
foreach ($match in $matches) {
$dst = Join-Path $libDst $match.Name
Copy-Item -Path $match.FullName -Destination $dst -Force
}
$dst = Join-Path $libDst (Split-Path -Leaf $src)
Copy-Item -Path $src -Destination $dst -Force
}

if ($SymbolsArtifact) {
Expand Down Expand Up @@ -115,23 +118,40 @@ steps:
New-SdkArchive -Rid 'win-x64' -NativeArtifact 'cpp-native-win-x64' -Files @(
'foundry_local.dll',
'foundry_local.pdb',
'foundry_local.lib'
'foundry_local.lib',
'Microsoft.Windows.AI.MachineLearning.dll',
'DirectML.dll',
'onnxruntime.dll',
'onnxruntime-genai.dll',
'?onnxruntime_providers_*.dll'
)

New-SdkArchive -Rid 'win-arm64' -NativeArtifact 'cpp-native-win-arm64' -Files @(
'foundry_local.dll',
'foundry_local.pdb',
'foundry_local.lib'
'foundry_local.lib',
'Microsoft.Windows.AI.MachineLearning.dll',
'DirectML.dll',
'onnxruntime.dll',
'onnxruntime-genai.dll',
'?onnxruntime_providers_*.dll'
)

New-SdkArchive -Rid 'linux-x64' -NativeArtifact 'cpp-native-linux-x64' -Files @(
'libfoundry_local.so'
'libfoundry_local.so',
'libonnxruntime-genai.so',
'?libonnxruntime-genai*.so',
'?libonnxruntime_providers_*.so',
'libonnxruntime.so*'
) -SymbolsArtifact 'cpp-native-symbols-linux-x64' -SymbolItems @(
'libfoundry_local.so.dbg'
)

New-SdkArchive -Rid 'osx-arm64' -NativeArtifact 'cpp-native-osx-arm64' -Files @(
'libfoundry_local.dylib'
'libfoundry_local.dylib',
'libonnxruntime-genai.dylib',
'libonnxruntime*.dylib',
'?libonnxruntime_providers_*.dylib'
) -SymbolsArtifact 'cpp-native-symbols-osx-arm64' -SymbolItems @(
'libfoundry_local.dylib.dSYM'
)
Expand Down
1 change: 1 addition & 0 deletions .pipelines/v2/templates/steps-pack-js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ steps:
$dst = '${{ parameters.outputDir }}'
New-Item -ItemType Directory -Force -Path $dst | Out-Null
Set-Location "$(Build.SourcesDirectory)/sdk_v2/js"
Copy-Item "$(Build.SourcesDirectory)/sdk_v2/deps_versions.json" -Destination "deps_versions.json" -Force
npm pack --pack-destination $dst
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
Get-ChildItem $dst | ForEach-Object { Write-Host " $($_.Name) $($_.Length) bytes" }
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Foundry Local is an **end-to-end local AI solution** for building applications t

User data never leaves the device, responses start immediately with zero network latency, and your app works offline. No per-token costs, no API keys, no backend infrastructure to maintain, and no Azure subscription required.

Foundry Local may collect usage data and send it to Microsoft to help improve our products and services. See the [privacy statement](sdk_v2/cpp/docs/Privacy.md) for more details.
This project may collect usage data and send it to Microsoft to help improve our products and services. See the [privacy statement](sdk_v2/cpp/docs/Privacy.md) for more details.

### Key Features

Expand Down
Loading
Loading