You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

147 lines
5.1 KiB

10 months ago
10 months ago
  1. name: Windows
  2. on:
  3. workflow_dispatch:
  4. push:
  5. paths:
  6. - 'src/**'
  7. - 'examples/**'
  8. - '.github/workflows/windows.yml'
  9. pull_request:
  10. paths:
  11. - 'src/**'
  12. - 'examples/**'
  13. - '.github/workflows/windows.yml'
  14. release:
  15. types: [published]
  16. permissions:
  17. contents: read
  18. jobs:
  19. build:
  20. permissions:
  21. contents: write # for actions/upload-release-asset to upload release asset
  22. runs-on: windows-latest
  23. strategy:
  24. fail-fast: false
  25. max-parallel: 1
  26. matrix:
  27. compiler: [mingw-w64, msvc16]
  28. bits: [32, 64]
  29. include:
  30. - compiler: mingw-w64
  31. bits: 32
  32. ARCH: "i686"
  33. WINDRES_ARCH: pe-i386
  34. - compiler: mingw-w64
  35. bits: 64
  36. ARCH: "x86_64"
  37. WINDRES_ARCH: pe-x86-64
  38. - compiler: msvc16
  39. bits: 32
  40. ARCH: "x86"
  41. VSARCHPATH: "Win32"
  42. - compiler: msvc16
  43. bits: 64
  44. ARCH: "x64"
  45. VSARCHPATH: "x64"
  46. env:
  47. RELEASE_NAME: raylib-dev_win${{ matrix.bits }}_${{ matrix.compiler }}
  48. GNUTARGET: default
  49. steps:
  50. - name: Checkout
  51. uses: actions/checkout@master
  52. - name: Setup Release Version
  53. run: |
  54. echo "RELEASE_NAME=raylib-${{ github.event.release.tag_name }}_win${{ matrix.bits }}_${{ matrix.compiler }}" >> $GITHUB_ENV
  55. shell: bash
  56. if: github.event_name == 'release' && github.event.action == 'published'
  57. - name: Setup Environment
  58. run: |
  59. dir
  60. mkdir build
  61. cd build
  62. mkdir ${{ env.RELEASE_NAME }}
  63. cd ${{ env.RELEASE_NAME }}
  64. mkdir include
  65. mkdir lib
  66. cd ../../../raylib
  67. # Setup MSBuild.exe path if required
  68. - name: Setup MSBuild
  69. uses: microsoft/setup-msbuild@v2
  70. if: matrix.compiler == 'msvc16'
  71. - name: Build Library (MinGW-w64 32bit)
  72. run: |
  73. cd src
  74. x86_64-w64-mingw32-gcc.exe --version
  75. windres.exe --version
  76. dir C:\msys64\mingw64\bin
  77. make PLATFORM=PLATFORM_DESKTOP CC=x86_64-w64-mingw32-gcc.exe RAYLIB_LIBTYPE=STATIC RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" CUSTOM_CFLAGS=-m32
  78. //windres.exe -i raylib.dll.rc -o raylib.dll.rc.data -O coff --target=${{ matrix.WINDRES_ARCH }}
  79. //make PLATFORM=PLATFORM_DESKTOP CC=${{ matrix.ARCH }}-w64-mingw32-gcc.exe RAYLIB_LIBTYPE=SHARED RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" -B
  80. cd ..
  81. shell: cmd
  82. if: |
  83. matrix.compiler == 'mingw-w64' &&
  84. matrix.bits == 32
  85. - name: Build Library (MinGW-w64 64bit)
  86. run: |
  87. cd src
  88. ${{ matrix.ARCH }}-w64-mingw32-gcc.exe --version
  89. windres.exe --version
  90. dir C:\msys64\mingw64\bin
  91. make PLATFORM=PLATFORM_DESKTOP CC=${{ matrix.ARCH }}-w64-mingw32-gcc.exe RAYLIB_LIBTYPE=STATIC RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib"
  92. windres.exe -i raylib.dll.rc -o raylib.dll.rc.data -O coff --target=${{ matrix.WINDRES_ARCH }}
  93. make PLATFORM=PLATFORM_DESKTOP CC=${{ matrix.ARCH }}-w64-mingw32-gcc.exe RAYLIB_LIBTYPE=SHARED RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" -B
  94. cd ..
  95. shell: cmd
  96. if: |
  97. matrix.compiler == 'mingw-w64' &&
  98. matrix.bits == 64
  99. - name: Build Library (MSVC16)
  100. run: |
  101. cd projects/VS2022
  102. msbuild.exe raylib.sln /target:raylib /property:Configuration=Release /property:Platform=${{ matrix.ARCH }}
  103. copy /Y .\build\raylib\bin\${{ matrix.VSARCHPATH }}\Release\raylib.lib .\..\..\build\${{ env.RELEASE_NAME }}\lib\raylib.lib
  104. msbuild.exe raylib.sln /target:raylib /property:Configuration=Release.DLL /property:Platform=${{ matrix.ARCH }}
  105. copy /Y .\build\raylib\bin\${{ matrix.VSARCHPATH }}\Release.DLL\raylib.dll .\..\..\build\${{ env.RELEASE_NAME }}\lib\raylib.dll
  106. copy /Y .\build\raylib\bin\${{ matrix.VSARCHPATH }}\Release.DLL\raylib.lib .\..\..\build\${{ env.RELEASE_NAME }}\lib\raylibdll.lib
  107. cd ../..
  108. shell: cmd
  109. if: matrix.compiler == 'msvc16'
  110. - name: Generate Artifacts
  111. run: |
  112. copy /Y .\src\raylib.h .\build\${{ env.RELEASE_NAME }}\include\raylib.h
  113. copy /Y .\src\raymath.h .\build\${{ env.RELEASE_NAME }}\include\raymath.h
  114. copy /Y .\src\rlgl.h .\build\${{ env.RELEASE_NAME }}\include\rlgl.h
  115. copy /Y .\CHANGELOG .\build\${{ env.RELEASE_NAME }}\CHANGELOG
  116. copy /Y .\README.md .\build\${{ env.RELEASE_NAME }}\README.md
  117. copy /Y .\LICENSE .\build\${{ env.RELEASE_NAME }}\LICENSE
  118. cd build
  119. 7z a ./${{ env.RELEASE_NAME }}.zip ./${{ env.RELEASE_NAME }}
  120. dir
  121. shell: cmd
  122. - name: Upload Artifacts
  123. uses: actions/upload-artifact@v4
  124. with:
  125. name: ${{ env.RELEASE_NAME }}.zip
  126. path: ./build/${{ env.RELEASE_NAME }}.zip
  127. - name: Upload Artifact to Release
  128. uses: softprops/action-gh-release@v1
  129. with:
  130. files: ./build/${{ env.RELEASE_NAME }}.zip
  131. env:
  132. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  133. if: github.event_name == 'release' && github.event.action == 'published'