diff --git a/.github/workflows/build-packages.yml b/.github/workflows/build-packages.yml new file mode 100644 index 000000000..bce9e3865 --- /dev/null +++ b/.github/workflows/build-packages.yml @@ -0,0 +1,111 @@ +name: Build Packages + +on: + workflow_dispatch: + push: + branches: + - master + paths: [ + '.github/workflows/build-packages.yml', + '**/CMakeLists.txt', + '**/.cmake', + '**/*.h', + '**/*.hpp', + '**/*.c', + '**/*.cpp', + '**/*.cu', + '**/*.cuh' + ] + pull_request: + types: [opened, synchronize, reopened] + paths: [ + '.github/workflows/build-packages.yml', + '**/CMakeLists.txt', + '**/.cmake', + '**/*.h', + '**/*.hpp', + '**/*.c', + '**/*.cpp', + '**/*.cu', + '**/*.cuh' + ] + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }} + cancel-in-progress: true + +env: + VULKAN_VERSION: 1.4.313.2 + +jobs: + windows-msvc-vulkan: + runs-on: windows-2025 + name: Windows x64 MSVC Vulkan + + steps: + - name: Clone + id: checkout + uses: actions/checkout@v6 + + - name: ccache + uses: ggml-org/ccache-action@v1.2.21 + with: + key: windows-x64-msvc-vulkan + variant: ccache + evict-old-files: 1d + save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/master' }} + + - name: Install Vulkan SDK + id: get_vulkan + run: | + curl.exe -o $env:RUNNER_TEMP/VulkanSDK-Installer.exe -L "https://sdk.lunarg.com/sdk/download/${env:VULKAN_VERSION}/windows/vulkansdk-windows-X64-${env:VULKAN_VERSION}.exe" + & "$env:RUNNER_TEMP\VulkanSDK-Installer.exe" --accept-licenses --default-answer --confirm-command install + Add-Content $env:GITHUB_ENV "VULKAN_SDK=C:\VulkanSDK\${env:VULKAN_VERSION}" + Add-Content $env:GITHUB_PATH "C:\VulkanSDK\${env:VULKAN_VERSION}\bin" + + - name: Install Ninja + id: install_ninja + run: | + choco install ninja + + - name: Setup MSVC + id: setup_msvc + uses: ilammy/msvc-dev-cmd@v1 + + - name: Build (x64 MSVC Vulkan) + id: cmake_build + run: | + cmake -B build ` + -G "Ninja Multi-Config" ` + -DCMAKE_BUILD_TYPE=Release ` + -DGGML_NATIVE=OFF ` + -DLLAMA_BUILD_SERVER=ON ` + -DLLAMA_BUILD_WEBUI=OFF ` + -DLLAMA_USE_PREBUILT_WEBUI=OFF ` + -DLLAMA_OPENSSL=OFF ` + -DGGML_RPC=ON ` + -DGGML_BACKEND_DL=ON ` + -DGGML_CPU_ALL_VARIANTS=ON ` + -DGGML_VULKAN=ON + cmake --build build --config Release + + - name: Test + id: cmake_test + run: | + cd build + ctest -L main -C Release --verbose --timeout 900 + + - name: Create artifact archive + run: | + cd build + mkdir -p artifacts + copy bin\Release\*.exe artifacts\ 2>nul || true + copy bin\Release\*.dll artifacts\ 2>nul || true + 7z a llama-windows-msvc-vulkan.7z artifacts\ + + - name: Upload artifacts + uses: actions/upload-artifact@v6 + with: + name: llama-windows-x64-msvc-vulkan + path: build/llama-windows-msvc-vulkan.7z + retention-days: 7 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7b1fcfca0..4a5c03078 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -55,6 +55,7 @@ target_link_libraries(llama PUBLIC ggml) if (BUILD_SHARED_LIBS) set_target_properties(llama PROPERTIES POSITION_INDEPENDENT_CODE ON) + set_target_properties(llama PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON) target_compile_definitions(llama PRIVATE LLAMA_BUILD) target_compile_definitions(llama PUBLIC LLAMA_SHARED) endif()