Skip to content

Commit

Permalink
try to make RSGL building more advanced (windows)
Browse files Browse the repository at this point in the history
  • Loading branch information
ColleagueRiley committed May 10, 2024
1 parent 33eb4a8 commit b068afd
Showing 1 changed file with 130 additions and 7 deletions.
137 changes: 130 additions & 7 deletions .github/workflows/windows.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,140 @@
name: windows
name: Windows

on:
workflow_dispatch:
push:
branches: [ "main" ]
paths:
- '**'
- 'examples/**'
- '.github/workflows/windows.yml'
pull_request:
branches: [ "main" ]
paths:
- '**'
- 'examples/**'
- '.github/workflows/windows.yml'
release:
types: [published]

permissions:
contents: read

jobs:
build:

permissions:
contents: write # for actions/upload-release-asset to upload release asset
runs-on: windows-latest
strategy:
fail-fast: false
max-parallel: 1
matrix:
compiler: [mingw-w64, msvc16]
bits: [32, 64]
include:
- compiler: mingw-w64
bits: 32
ARCH: "i686"
WINDRES_ARCH: pe-i386
- compiler: mingw-w64
bits: 64
ARCH: "x86_64"
WINDRES_ARCH: pe-x86-64
- compiler: msvc16
bits: 32
ARCH: "x86"
VSARCHPATH: "Win32"
- compiler: msvc16
bits: 64
ARCH: "x64"
VSARCHPATH: "x64"

env:
RELEASE_NAME: RSGL-dev_win${{ matrix.bits }}_${{ matrix.compiler }}
GNUTARGET: default

steps:
- uses: actions/checkout@v3
- name: make
run: make
- name: Checkout
uses: actions/checkout@master

- name: Setup Release Version
run: |
echo "RELEASE_NAME=RSGL-${{ github.event.release.tag_name }}_win${{ matrix.bits }}_${{ matrix.compiler }}" >> $GITHUB_ENV
shell: bash
if: github.event_name == 'release' && github.event.action == 'published'

- name: Setup Environment
run: |
dir
mkdir build
cd build
mkdir ${{ env.RELEASE_NAME }}
cd ${{ env.RELEASE_NAME }}
mkdir include
mkdir lib
cd ../../../RSGL
# Setup MSBuild.exe path if required
- name: Setup MSBuild
uses: microsoft/setup-msbuild@v2
if: matrix.compiler == 'msvc16'

- name: Build Library (MinGW-w64 32bit)
run: |
x86_64-w64-mingw32-gcc.exe --version
windres.exe --version
dir C:\msys64\mingw64\bin
make
shell: cmd
if: |
matrix.compiler == 'mingw-w64' &&
matrix.bits == 32
- name: Build Library (MinGW-w64 64bit)
run: |
${{ matrix.ARCH }}-w64-mingw32-gcc.exe --version
windres.exe --version
dir C:\msys64\mingw64\bin
make
shell: cmd
if: |
matrix.compiler == 'mingw-w64' &&
matrix.bits == 64
# - name: Build Library (MSVC16)
# run: |
# cd projects/VS2022
# msbuild.exe RSGL.sln /target:RSGL /property:Configuration=Release /property:Platform=${{ matrix.ARCH }}
# copy /Y .\build\RSGL\bin\${{ matrix.VSARCHPATH }}\Release\RSGL.lib .\..\..\build\${{ env.RELEASE_NAME }}\lib\RSGL.lib
# msbuild.exe RSGL.sln /target:RSGL /property:Configuration=Release.DLL /property:Platform=${{ matrix.ARCH }}
# copy /Y .\build\RSGL\bin\${{ matrix.VSARCHPATH }}\Release.DLL\RSGL.dll .\..\..\build\${{ env.RELEASE_NAME }}\lib\RSGL.dll
# copy /Y .\build\RSGL\bin\${{ matrix.VSARCHPATH }}\Release.DLL\RSGL.lib .\..\..\build\${{ env.RELEASE_NAME }}\lib\RSGLdll.lib
#cd ../..
#shell: cmd
#if: matrix.compiler == 'msvc16'

- name: Generate Artifacts
run: |
copy /Y .\RSGL.h .\build\${{ env.RELEASE_NAME }}\include
xcopy .\deps .\build\${{ env.RELEASE_NAME }}\include /E /I /Y
copy /Y .\libRSGL.a .\build\${{ env.RELEASE_NAME }}\lib
copy /Y .\src\rlgl.h .\build\${{ env.RELEASE_NAME }}\include\rlgl.h
copy /Y .\CHANGELOG .\build\${{ env.RELEASE_NAME }}\CHANGELOG
copy /Y .\README.md .\build\${{ env.RELEASE_NAME }}\README.md
copy /Y .\LICENSE .\build\${{ env.RELEASE_NAME }}\LICENSE
cd build
7z a ./${{ env.RELEASE_NAME }}.zip ./${{ env.RELEASE_NAME }}
dir
shell: cmd

- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: ${{ env.RELEASE_NAME }}.zip
path: ./build/${{ env.RELEASE_NAME }}.zip

- name: Upload Artifact to Release
uses: softprops/action-gh-release@v1
with:
files: ./build/${{ env.RELEASE_NAME }}.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
if: github.event_name == 'release' && github.event.action == 'published'

0 comments on commit b068afd

Please sign in to comment.