Skip to content

Commit

Permalink
ci: fix windows arm64 build
Browse files Browse the repository at this point in the history
Signed-off-by: thxCode <thxcode0824@gmail.com>
  • Loading branch information
thxCode committed Dec 22, 2024
1 parent a38d7d0 commit 93be137
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
13 changes: 11 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -977,22 +977,31 @@ jobs:
key: cache-windows-${{ matrix.arch }}-${{ matrix.instruction }}
path: |
${{ github.workspace }}\build
${{ github.workspace }}\.cache
- name: Deps
run: |
$ErrorActionPreference = "Stop"
$ProgressPreference = 'SilentlyContinue'
choco install ccache ninja curl -y
- name: Build
env:
CCACHE_DIR: "${{ github.workspace }}\\.cache\\ccache"
run: |
$ErrorActionPreference = "Stop"
$ProgressPreference = 'SilentlyContinue'
Write-Host "===== BUILD ====="
New-Item -Force -ItemType Directory -Path "${{ github.workspace }}\.cache" -ErrorAction Ignore | Out-Null
cmake -S ${{ github.workspace }} -B ${{ github.workspace }}\build -DCMAKE_BUILD_TYPE=Release `
cmake ${{ matrix.arch == 'arm64' && '-G "Ninja"'|| '' }} -S ${{ github.workspace }} -B ${{ github.workspace }}\build -DCMAKE_BUILD_TYPE=Release `
${{ matrix.arch == 'arm64' && format('-DCMAKE_TOOLCHAIN_FILE={0}\llama-box\scripts\build-windows-arm64.cmake', github.workspace) || '' }} `
-DGGML_NATIVE=off `
${{ matrix.instruction == 'avx2' && '-DGGML_AVX=on -DGGML_AVX2=on' || '' }} `
${{ matrix.instruction == 'avx512' && '-DGGML_AVX512=on -DGGML_AVX512_VBMI=on -DGGML_AVX512_VNNI=on -DGGML_AVX512_BF16=on' || '' }} `
-DGGML_STATIC=on `
-DGGML_OPENMP=off `
-DGGML_RPC=on
cmake --build ${{ github.workspace }}\build --target llama-box --config Release -- /m:${env:NUMBER_OF_PROCESSORS}
cmake --build ${{ github.workspace }}\build --target llama-box --config Release -- -j ${env:NUMBER_OF_PROCESSORS}
Write-Host "===== RESULT ====="
Get-ChildItem -Path "${{ github.workspace }}\build\bin\Release\" -File -ErrorAction Ignore
if (Test-Path -Path "${{ github.workspace }}\build\bin\Release\llama-box.exe") {
Expand Down
19 changes: 8 additions & 11 deletions llama-box/scripts/build-windows-arm64.cmake
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
set(CMAKE_CROSSCOMPILING TRUE)

set(CMAKE_SYSTEM_NAME Windows)
set(CMAKE_SYSTEM_PROCESSOR arm64)
set(CMAKE_GENERATOR_PLATFORM arm64 CACHE INTERNAL "")

set(target arm64-pc-windows-msvc)
set( CMAKE_C_COMPILER clang )
set( CMAKE_CXX_COMPILER clang++ )
set( CMAKE_C_COMPILER_TARGET ${target} )
set( CMAKE_CXX_COMPILER_TARGET ${target} )
set(CMAKE_C_COMPILER clang)
set(CMAKE_CXX_COMPILER clang++)
set(CMAKE_C_COMPILER_TARGET ${target})
set(CMAKE_CXX_COMPILER_TARGET ${target})

set( arch_c_flags "-march=armv8.7-a -fvectorize -ffp-model=fast -fno-finite-math-only" )
set( warn_c_flags "-Wno-format -Wno-unused-variable -Wno-unused-function -Wno-gnu-zero-variadic-macro-arguments" )
set( CMAKE_C_FLAGS_INIT "${arch_c_flags} ${warn_c_flags}" )
set( CMAKE_CXX_FLAGS_INIT "${arch_c_flags} ${warn_c_flags}" )
set(arch_c_flags "-march=armv8.7-a -fvectorize -ffp-model=fast -fno-finite-math-only")
set(warn_c_flags "-Wno-format -Wno-unused-variable -Wno-unused-function -Wno-gnu-zero-variadic-macro-arguments")
set(CMAKE_C_FLAGS_INIT "${arch_c_flags} ${warn_c_flags}")
set(CMAKE_CXX_FLAGS_INIT "${arch_c_flags} ${warn_c_flags}")

0 comments on commit 93be137

Please sign in to comment.