Skip to content

Build Windows

Build Windows #24

Workflow file for this run

name: Build Windows
on:
workflow_dispatch:
inputs:
version:
description: 'Release version (e.g., v1.0.0)'
required: true
default: 'v1.0.0'
type: string
jobs:
build-windows:
runs-on: windows-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: recursive
- name: Setup Qt5
uses: jurplel/install-qt-action@v3
with:
version: '5.15.2'
host: 'windows'
target: 'desktop'
arch: 'win64_msvc2019_64'
# Note: qtmultimedia and qtnetwork are included in base Qt5 installation
# modules: 'qtmultimedia qtnetwork' # These aren't separate modules in 5.15.2
setup-python: 'false'
- name: Setup MSVC
uses: microsoft/[email protected]
- name: Setup MSYS2 with autotools
uses: msys2/setup-msys2@v2
with:
msystem: MSYS
install: >-
base-devel
autoconf
automake
libtool
make
pkgconf
autoconf-archive
mingw-w64-x86_64-gcc
mingw-w64-x86_64-binutils
mingw-w64-x86_64-pkg-config
update: true
- name: Install NSIS
run: |
# Install NSIS for installer creation
choco install nsis -y
# Add NSIS to PATH
echo "C:\Program Files (x86)\NSIS" >> $GITHUB_PATH
- name: Verify MSYS2 setup
shell: msys2 {0}
run: |
# Add MinGW paths to ensure gcc is accessible
export PATH="/mingw64/bin:$PATH"
# Verify MSYS2 tools are available
echo "=== Checking MSYS2 Tools ==="
echo "Current PATH: $PATH"
which gcc && gcc --version | head -1 || echo "gcc not found in PATH"
which make && make --version | head -1 || echo "make not found in PATH"
which autoconf && autoconf --version | head -1 || echo "autoconf not found in PATH"
which aclocal && aclocal --version | head -1 || echo "aclocal not found in PATH"
which automake && automake --version | head -1 || echo "automake not found in PATH"
# List available compilers
echo "=== Available GCC compilers ==="
ls -la /mingw64/bin/gcc* 2>/dev/null || echo "No MinGW64 GCC found"
ls -la /usr/bin/gcc* 2>/dev/null || echo "No MSYS GCC found"
echo "=== MSYS2 Setup Complete ==="
- name: Create build directory
run: mkdir build-release
- name: Configure CMake
run: |
cd build-release
# Use proper path format for Windows
$QtPath = "${{ env.Qt5_Dir }}".Replace('\', '/')
cmake -G "Visual Studio 17 2022" -A x64 `
-DCMAKE_BUILD_TYPE=Release `
-DCMAKE_PREFIX_PATH="$QtPath" `
-DFUJISAN_VERSION="${{ github.event.inputs.version || 'dev' }}" `
..
- name: Build Fujisan
run: |
cd build-release
echo "=== Building with enhanced MSBuild diagnostics ==="
echo "MSBuild version:"
msbuild -version
echo "=== Starting build with detailed logging ==="
# Try build with detailed diagnostics - use simpler approach
echo "Starting CMake build..."
$buildResult = $?
cmake --build . --config Release --parallel 4 --verbose -- /verbosity:detailed
$buildResult = $?
if (-not $buildResult) {
echo "=== BUILD FAILED - Checking atari800 status ==="
echo "=== Build failed, checking atari800 status ==="
# Check if libatari800 was actually built despite the error
if (Test-Path "atari800-src\src\libatari800.a") {
echo "SUCCESS: libatari800.a exists despite build error!"
Get-ChildItem "atari800-src\src\libatari800.a" | Format-List
echo "=== Attempting to continue with Fujisan build only ==="
cmake --build . --config Release --target Fujisan --parallel 4 --verbose
} else {
echo "ERROR: libatari800.a was not created"
echo "Contents of atari800-src/src/:"
if (Test-Path "atari800-src\src") { Get-ChildItem "atari800-src\src" | Format-Table Name, Length }
throw "Build failed - libatari800.a not found"
}
}
- name: Deploy Qt5 libraries
run: |
cd build-release
& "${{ env.Qt5_Dir }}\bin\windeployqt.exe" --release --no-translations --no-system-d3d-compiler Release\Fujisan.exe
- name: Verify libatari800 integration
run: |
cd build-release
if (Test-Path "atari800-src\src\libatari800.a") {
echo "✓ libatari800.a found and integrated"
$size = (Get-Item "atari800-src\src\libatari800.a").Length
echo "Library size: $size bytes"
} else {
echo "❌ libatari800.a not found"
exit 1
}
- name: Create Windows installer structure
run: |
mkdir installer
mkdir installer\bin
Copy-Item "build-release\Release\Fujisan.exe" "installer\bin\"
Copy-Item "build-release\Release\*.dll" "installer\bin\" -ErrorAction SilentlyContinue
# Copy Qt5 DLLs deployed by windeployqt
if (Test-Path "build-release\Release\platforms") {
Copy-Item "build-release\Release\platforms" "installer\bin\platforms" -Recurse
}
if (Test-Path "build-release\Release\*.dll") {
Copy-Item "build-release\Release\*.dll" "installer\bin\" -Force
}
# Copy additional files
if (Test-Path "README.md") { Copy-Item "README.md" "installer\" }
if (Test-Path "LICENSE") { Copy-Item "LICENSE" "installer\" }
- name: Create NSIS installer script
run: |
$version = "${{ github.event.inputs.version || 'dev' }}"
$versionClean = $version -replace '^v', ''
@"
!define PRODUCT_NAME "Fujisan"
!define PRODUCT_VERSION "$versionClean"
!define PRODUCT_PUBLISHER "8bitrelics.com"
!define PRODUCT_WEB_SITE "https://github.com/8bitrelics/fujisan"
!define PRODUCT_UNINST_KEY "Software\Microsoft\Windows\CurrentVersion\Uninstall\Fujisan"
!define PRODUCT_UNINST_ROOT_KEY "HKLM"
SetCompressor lzma
Name "`${PRODUCT_NAME} `${PRODUCT_VERSION}"
OutFile "Fujisan-`${PRODUCT_VERSION}-Windows-x64.msi"
InstallDir "`$PROGRAMFILES64\Fujisan"
InstallDirRegKey HKLM "`${PRODUCT_UNINST_KEY}" "InstallLocation"
ShowInstDetails show
ShowUnInstDetails show
Page directory
Page instfiles
UninstPage uninstConfirm
UninstPage instfiles
Section "MainSection" SEC01
SetOutPath "`$INSTDIR\bin"
SetOverwrite ifnewer
File /r "installer\bin\*.*"
SetOutPath "`$INSTDIR"
File /nonfatal "installer\README.md"
File /nonfatal "installer\LICENSE"
CreateDirectory "`$SMPROGRAMS\Fujisan"
CreateShortCut "`$SMPROGRAMS\Fujisan\Fujisan.lnk" "`$INSTDIR\bin\Fujisan.exe"
CreateShortCut "`$DESKTOP\Fujisan.lnk" "`$INSTDIR\bin\Fujisan.exe"
SectionEnd
Section -AdditionalIcons
CreateShortCut "`$SMPROGRAMS\Fujisan\Uninstall.lnk" "`$INSTDIR\uninst.exe"
SectionEnd
Section -Post
WriteUninstaller "`$INSTDIR\uninst.exe"
WriteRegStr HKLM "`${PRODUCT_UNINST_KEY}" "DisplayName" "`$(^Name)"
WriteRegStr HKLM "`${PRODUCT_UNINST_KEY}" "UninstallString" "`$INSTDIR\uninst.exe"
WriteRegStr HKLM "`${PRODUCT_UNINST_KEY}" "DisplayVersion" "`${PRODUCT_VERSION}"
WriteRegStr HKLM "`${PRODUCT_UNINST_KEY}" "URLInfoAbout" "`${PRODUCT_WEB_SITE}"
WriteRegStr HKLM "`${PRODUCT_UNINST_KEY}" "Publisher" "`${PRODUCT_PUBLISHER}"
SectionEnd
Function un.onUninstSuccess
HideWindow
MessageBox MB_ICONINFORMATION|MB_OK "Fujisan was successfully removed from your computer."
FunctionEnd
Section Uninstall
Delete "`$INSTDIR\uninst.exe"
Delete "`$INSTDIR\bin\*.*"
Delete "`$INSTDIR\*.*"
Delete "`$SMPROGRAMS\Fujisan\*.*"
Delete "`$DESKTOP\Fujisan.lnk"
RMDir "`$SMPROGRAMS\Fujisan"
RMDir "`$INSTDIR\bin\platforms"
RMDir "`$INSTDIR\bin"
RMDir "`$INSTDIR"
DeleteRegKey `${PRODUCT_UNINST_ROOT_KEY} "`${PRODUCT_UNINST_KEY}"
SetAutoClose true
SectionEnd
"@ | Out-File -FilePath "installer.nsi" -Encoding UTF8
- name: Build MSI installer
run: |
makensis installer.nsi
$version = "${{ github.event.inputs.version || 'dev' }}"
$versionClean = $version -replace '^v', ''
if (Test-Path "Fujisan-$versionClean-Windows-x64.msi") {
echo "✓ MSI installer created successfully"
$size = (Get-Item "Fujisan-$versionClean-Windows-x64.msi").Length
echo "Installer size: $([math]::Round($size/1MB, 2)) MB"
} else {
echo "❌ MSI installer creation failed"
exit 1
}
- name: Generate checksums
run: |
$version = "${{ github.event.inputs.version || 'dev' }}"
$versionClean = $version -replace '^v', ''
$msiFile = "Fujisan-$versionClean-Windows-x64.msi"
if (Test-Path $msiFile) {
$hash = Get-FileHash $msiFile -Algorithm SHA256
"$($hash.Hash.ToLower()) $msiFile" | Out-File -FilePath "$msiFile.sha256" -Encoding ASCII
echo "SHA256: $($hash.Hash.ToLower())"
}
- name: Upload Windows artifacts
uses: actions/upload-artifact@v4
with:
name: fujisan-windows-x64
path: |
Fujisan-*.msi
Fujisan-*.msi.sha256
retention-days: 30
- name: Display build summary
run: |
echo "=== Windows Build Summary ==="
echo "Version: ${{ github.event.inputs.version || 'dev' }}"
echo "Qt5 Version: 5.15.2"
echo "Architecture: x64 (Windows 10/11)"
echo "Package: MSI installer with embedded Qt5 and libatari800"
echo "Build completed successfully!"