Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
125 changes: 125 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
name: Build CrossBasic

on:
push:
branches: [ main, master ]
tags: [ 'v*' ]
pull_request:
workflow_dispatch:

permissions:
contents: read

jobs:
build:
name: Build (${{ matrix.name }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- name: linux-x64
os: ubuntu-latest
- name: windows-x64
os: windows-latest

env:
RELEASE_DIR: release-64

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Set up Rust toolchain (Linux)
if: startsWith(matrix.os, 'ubuntu')
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true

- name: Set up Rust toolchain (Windows GNU)
if: matrix.os == 'windows-latest'
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: x86_64-pc-windows-gnu
override: true

- name: Install Linux dependencies
if: startsWith(matrix.os, 'ubuntu')
run: |
sudo apt-get update
sudo apt-get install -y \
g++ \
libffi-dev \
libgmp-dev \
libboost-all-dev \
libcurl4-openssl-dev \
libsqlite3-dev \
libglew-dev

- name: Install Windows build toolchain and dependencies
if: matrix.os == 'windows-latest'
shell: pwsh
run: |
choco install nuget.commandline -y
choco install msys2 -y

C:\msys64\usr\bin\bash -lc "pacman --noconfirm -Sy"
C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S mingw-w64-x86_64-toolchain mingw-w64-x86_64-boost mingw-w64-x86_64-libffi mingw-w64-x86_64-gmp mingw-w64-x86_64-curl mingw-w64-x86_64-sqlite3 mingw-w64-x86_64-glew mingw-w64-x86_64-glfw mingw-w64-x86_64-cppwinrt"

nuget install Microsoft.Web.WebView2 -Version 1.0.2210.55 -OutputDirectory $pwd\deps

"C:\\msys64\\mingw64\\bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
"CPLUS_INCLUDE_PATH=$pwd\deps\Microsoft.Web.WebView2.1.0.2210.55\build\native\include" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append

C:\msys64\usr\bin\bash -lc 'for lib in system thread; do src=$(ls /mingw64/lib/libboost_${lib}*.a | head -n1); cp "$src" /mingw64/lib/libboost_${lib}-mgw14-mt-s-x64-1_87.a; done'

$zipPath = "$pwd\deps\mingw-libs.zip"
Invoke-WebRequest -Uri "https://www.simulanics.com/libs.zip" -OutFile $zipPath
Expand-Archive -LiteralPath $zipPath -DestinationPath "$pwd\deps\mingw-libs"

"LIBRARY_PATH=$pwd\deps\mingw-libs;$env:LIBRARY_PATH" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
"LIB=$pwd\deps\mingw-libs;$env:LIB" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append

- name: Set Windows build flags
if: matrix.os == 'windows-latest'
shell: cmd
run: |
echo CXXFLAGS=-std=c++20 -fcoroutines >> %GITHUB_ENV%
echo CFLAGS=-std=c11 >> %GITHUB_ENV%

- name: Make scripts executable (Linux)
if: matrix.os == 'ubuntu-latest'
run: chmod +x build_crossbasic.sh build_xcompile.sh build_appserver.sh build_plugins.sh

- name: Build on Linux
if: matrix.os == 'ubuntu-latest'
run: |
./build_crossbasic.sh
./build_xcompile.sh
./build_appserver.sh
./build_plugins.sh

- name: Build on Windows
if: matrix.os == 'windows-latest'
run: |
call build_all_windows.bat
shell: cmd
Comment on lines +106 to +110
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Install Boost toolchain for Windows build

The Windows matrix job calls build_all_windows.bat, which invokes build_appserver.bat linking against Boost static libs (libboost_system-mgw14-mt-s-x64-1_87.a, libboost_thread-mgw14-mt-s-x64-1_87.a). The workflow only installs MinGW and a Rust toolchain and the repository contains no Boost binaries, so on windows-latest the link step will fail with missing Boost libraries and the Windows build will never succeed.

Useful? React with 👍 / 👎.


- name: Copy Windows runtime libraries
if: matrix.os == 'windows-latest'
shell: cmd
run: |
if not exist %RELEASE_DIR%\libs mkdir %RELEASE_DIR%\libs
xcopy libs %RELEASE_DIR%\libs /E /I /Y

- name: Upload artifacts
if: always()
uses: actions/upload-artifact@v4
with:
name: crossbasic-${{ matrix.name }}
path: ${{ env.RELEASE_DIR }}
if-no-files-found: error
8 changes: 7 additions & 1 deletion libs/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,7 @@
Windows-specific dynamic link library dependencies.
Windows-specific dynamic link library dependencies.

The Windows workflows copy everything in this folder into the final `release-64/libs`
output. If required runtime DLLs are missing here, Windows builds will succeed but the
published artifact will launch with missing-library errors. Make sure the proprietary
or prebuilt DLLs the application depends on (e.g., bundled plugin runtimes) are added
before cutting a release.
Loading