diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..52acec6 --- /dev/null +++ b/.github/workflows/build.yml @@ -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 + + - 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 diff --git a/libs/README.md b/libs/README.md index f9087f0..3dacf6f 100644 --- a/libs/README.md +++ b/libs/README.md @@ -1 +1,7 @@ -Windows-specific dynamic link library dependencies. \ No newline at end of file +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.