Skip to content

Instantly share code, notes, and snippets.

@SARDONYX-sard
Last active June 18, 2024 19:38
Show Gist options
  • Save SARDONYX-sard/5c6b18d9d6584cac1e8cba27213bb99b to your computer and use it in GitHub Desktop.
Save SARDONYX-sard/5c6b18d9d6584cac1e8cba27213bb99b to your computer and use it in GitHub Desktop.
cmake-bzip2, zlib(get error)
name: Build
on:
push:
branches: ["main"]
pull_request:
branches: "*"
workflow_dispatch:
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [windows-latest]
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install latest CMake & Ninja
uses: lukka/get-cmake@latest
- name: Setup anew (or from cache) vcpkg (and does not build any package)
uses: lukka/run-vcpkg@v11
with:
vcpkgDirectory: ${{ github.workspace }}/vcpkg
vcpkgGitCommitId: "b7dba7f9aad09a56900f21cd78cfda1258e54e38"
vcpkgGitUrl: "https://github.com/microsoft/vcpkg.git"
- name: Set up extern build cache
uses: actions/cache@v4
with:
path: ./build-ng
key: cmake-build-${{ runner.os }}-${{ hashFiles('./CMakeLists.txt') }}
restore-keys: cmake-build.${{ runner.os }}.
- name: Run CMake consuming CMakePreset.json and run vcpkg to build packages
uses: lukka/run-cmake@v10
with:
configurePreset: "vs2022-windows-vcpkg-ng"
buildPreset: "Release - NG"
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: SKSE Plugin
path: ${{ github.workspace }}/build-ng/Release
function Get-BuildDeps([string]$dist, [string]$url) {
Invoke-WebRequest $url -OutFile "$dist.zip"
Expand-Archive "$dist.zip" -DestinationPath $dist
# Remove-Item "$dist.zip"
}
$local:bzip_dist = Join-Path -Path $(Get-Location) -ChildPath "build/bzip2-dev-1.0.8.0-win-x86"
if (!$(Test-Path $bzip_dist)) {
$bzip2_url = 'https://github.com/philr/bzip2-windows/releases/download/v1.0.8.0/bzip2-dev-1.0.8.0-win-x86.zip'
Get-BuildDeps $bzip_dist $bzip2_url
}
$local:zlib_dist = Join-Path -Path $(Get-Location) -ChildPath "build/zlib-1.2.3-lib"
if (!$(Test-Path $zlib_dist)) {
$zlib_url = 'https://gnuwin32.sourceforge.net/downlinks/zlib-lib-zip.php'
Get-BuildDeps $zlib_dist $zlib_url
}
cmake -S . -B ./build -A Win32 -D CMAKE_BUILD_TYPE=Release`
-DBZIP2_LIBRARIES:STRING="$bzip_dist" `
-DBZIP2_INCLUDE_DIR:STRING="$bzip_dist" `
-DZLIB_LIBRARY:STRING="$zlib_dist" `
-DZLIB_INCLUDE_DIR:STRING="$zlib_dist"
cmake --build ./build -j $Env:NUMBER_OF_PROCESSORS --config Release
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment