Add support for Windows builds in the ci

This commit is contained in:
pancake committed 2026-08-08 12:51:04 +02:00
1 parent 6afe8d65d2
commit 80701514cd
3 files changed
+96 -5

No files matched your search

+72 -1
View File
@@ -110,6 +110,69 @@ jobs:
if-no-files-found: error
archive: false
windows:
name: Build Windows package
runs-on: windows-latest
steps:
- name: Checkout
uses: actions/checkout@v6
- name: Setup Python
uses: actions/setup-python@v6
with:
python-version: 3.12.x
- name: Setup MSVC
uses: TheMrMilchmann/setup-msvc-dev@v4
with:
arch: x64
- name: Install build dependencies
run: python -m pip install meson ninja
- name: Install radare2
id: r2
uses: radareorg/github-actions@v3
- name: Configure
run: meson setup build-windows --buildtype=release -Dplugins=enabled
- name: Build
run: meson compile -C build-windows
- name: Test
run: meson test -C build-windows --print-errorlogs
- name: Package Windows build
id: package
shell: pwsh
run: |
$project = meson introspect build-windows --projectinfo | ConvertFrom-Json
$package = "r2unity-$($project.version)-w64"
$files = @(
"build-windows\r2unity.exe",
"build-windows\core_r2unity.dll",
"build-windows\bin_r2unity.dll"
)
New-Item -ItemType Directory -Path $package | Out-Null
foreach ($file in $files) {
if (-not (Test-Path $file)) {
throw "Missing Windows build output: $file"
}
Copy-Item $file -Destination $package
}
$archive = "$package.zip"
Compress-Archive -Path "$package\*" -DestinationPath $archive -Force
"archive=$archive" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
- name: Upload Windows package artifact
uses: actions/upload-artifact@v7
with:
name: windows-package
path: ${{ steps.package.outputs.archive }}
if-no-files-found: error
release:
name: Publish release
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}
@@ -117,6 +180,7 @@ jobs:
- build
- meson
- debian
- windows
runs-on: ubuntu-latest
permissions:
contents: write
@@ -126,13 +190,19 @@ jobs:
with:
fetch-depth: 0
- name: Download artifacts
- name: Download Debian package artifact
uses: actions/download-artifact@v8
with:
pattern: '*.deb'
path: dist/artifacts
merge-multiple: true
- name: Download Windows package artifact
uses: actions/download-artifact@v8
with:
name: windows-package
path: dist/artifacts
- name: Generate release notes
run: ./release.sh notes > release-notes.md
@@ -147,3 +217,4 @@ jobs:
fail_on_unmatched_files: true
files: |
dist/artifacts/*.deb
dist/artifacts/*.zip
+24 -3
View File
@@ -17,8 +17,26 @@ add_project_arguments(
language: 'c',
)
r_util_dep = dependency('r_util')
r_bin_dep = dependency('r_bin')
r2 = find_program('r2', required: true)
r2_cflags = run_command(r2, '-H', 'R2_CFLAGS', check: true).stdout().strip().split()
r2_ldflags = run_command(r2, '-H', 'R2_LDFLAGS', check: true).stdout().strip().split()
r2_libs = run_command(r2, '-H', 'R2_LIBS', check: true).stdout().strip().split()
r2_fallback_dep = declare_dependency(
compile_args: r2_cflags,
link_args: r2_ldflags + r2_libs,
)
# Windows release ZIPs are relocatable and are not registered with pkg-config.
# Fall back to the paths reported by r2 when pkg-config cannot find its SDK.
r_util_dep = dependency('r_util', required: false)
if not r_util_dep.found()
r_util_dep = r2_fallback_dep
endif
r_bin_dep = dependency('r_bin', required: false)
if not r_bin_dep.found()
r_bin_dep = r2_fallback_dep
endif
conf = configuration_data()
conf.set_quoted('R2UNITY_VERSION', meson.project_version())
@@ -48,7 +66,10 @@ test('r2unity-help', r2unity, args: ['-h'])
test('r2unity-version', r2unity, args: ['-v'])
plugins_opt = get_option('plugins')
r_core_dep = dependency('r_core', required: plugins_opt)
r_core_dep = dependency('r_core', required: false)
if not r_core_dep.found() and not plugins_opt.disabled()
r_core_dep = r2_fallback_dep
endif
build_plugins = plugins_opt.enabled() or (
plugins_opt.auto() and r_core_dep.found() and r_bin_dep.found()
)
-1
View File
@@ -5,7 +5,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <r2unity_config.h>
#include "lib/lib.h"