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.

135 lines
4.6 KiB

  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. COMPILER_PATH: "C:\\msys64\\mingw32\\bin"
  34. WINDRES_ARCH: pe-i386
  35. - compiler: mingw-w64
  36. bits: 64
  37. ARCH: "x86_64"
  38. COMPILER_PATH: "C:\\msys64\\mingw64\\bin"
  39. WINDRES_ARCH: pe-x86-64
  40. - compiler: msvc16
  41. bits: 32
  42. ARCH: "x86"
  43. VSARCHPATH: "Win32"
  44. - compiler: msvc16
  45. bits: 64
  46. ARCH: "x64"
  47. VSARCHPATH: "x64"
  48. env:
  49. RELEASE_NAME: raylib-dev_win${{ matrix.bits }}_${{ matrix.compiler }}
  50. GNUTARGET: default
  51. steps:
  52. - name: Checkout
  53. uses: actions/checkout@master
  54. - name: Setup Release Version
  55. run: |
  56. echo "RELEASE_NAME=raylib-${{ github.event.release.tag_name }}_win${{ matrix.bits }}_${{ matrix.compiler }}" >> $GITHUB_ENV
  57. shell: bash
  58. if: github.event_name == 'release' && github.event.action == 'published'
  59. - name: Setup Environment
  60. run: |
  61. dir
  62. mkdir build
  63. cd build
  64. mkdir ${{ env.RELEASE_NAME }}
  65. cd ${{ env.RELEASE_NAME }}
  66. mkdir include
  67. mkdir lib
  68. cd ../../../raylib
  69. # Setup MSBuild.exe path if required
  70. - name: Setup MSBuild
  71. uses: microsoft/setup-msbuild@v1.0.2
  72. if: matrix.compiler == 'msvc16'
  73. - name: Build Library (MinGW-w64)
  74. run: |
  75. cd src
  76. set PATH=%PATH%;${{ matrix.COMPILER_PATH }}
  77. ${{ matrix.ARCH }}-w64-mingw32-gcc.exe --version
  78. ${{ matrix.COMPILER_PATH }}/windres.exe --version
  79. make PLATFORM=PLATFORM_DESKTOP CC=${{ matrix.ARCH }}-w64-mingw32-gcc.exe RAYLIB_LIBTYPE=STATIC RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib"
  80. ${{ matrix.COMPILER_PATH }}/windres.exe -i raylib.dll.rc -o raylib.dll.rc.data -O coff --target=${{ matrix.WINDRES_ARCH }}
  81. make PLATFORM=PLATFORM_DESKTOP CC=${{ matrix.ARCH }}-w64-mingw32-gcc.exe RAYLIB_LIBTYPE=SHARED RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" -B
  82. cd ..
  83. shell: cmd
  84. if: matrix.compiler == 'mingw-w64'
  85. - name: Build Library (MSVC16)
  86. run: |
  87. cd projects/VS2019
  88. msbuild.exe raylib.sln /target:raylib /property:Configuration=Release /property:Platform=${{ matrix.ARCH }}
  89. copy /Y .\build\raylib\bin\${{ matrix.VSARCHPATH }}\Release\raylib.lib .\..\..\build\${{ env.RELEASE_NAME }}\lib\raylib.lib
  90. msbuild.exe raylib.sln /target:raylib /property:Configuration=Release.DLL /property:Platform=${{ matrix.ARCH }}
  91. copy /Y .\build\raylib\bin\${{ matrix.VSARCHPATH }}\Release.DLL\raylib.dll .\..\..\build\${{ env.RELEASE_NAME }}\lib\raylib.dll
  92. copy /Y .\build\raylib\bin\${{ matrix.VSARCHPATH }}\Release.DLL\raylib.lib .\..\..\build\${{ env.RELEASE_NAME }}\lib\raylibdll.lib
  93. cd ../..
  94. shell: cmd
  95. if: matrix.compiler == 'msvc16'
  96. - name: Generate Artifacts
  97. run: |
  98. copy /Y .\src\raylib.h .\build\${{ env.RELEASE_NAME }}\include\raylib.h
  99. copy /Y .\src\raymath.h .\build\${{ env.RELEASE_NAME }}\include\raymath.h
  100. copy /Y .\src\rlgl.h .\build\${{ env.RELEASE_NAME }}\include\rlgl.h
  101. copy /Y .\CHANGELOG .\build\${{ env.RELEASE_NAME }}\CHANGELOG
  102. copy /Y .\README.md .\build\${{ env.RELEASE_NAME }}\README.md
  103. copy /Y .\LICENSE .\build\${{ env.RELEASE_NAME }}\LICENSE
  104. cd build
  105. 7z a ./${{ env.RELEASE_NAME }}.zip ./${{ env.RELEASE_NAME }}
  106. dir
  107. shell: cmd
  108. - name: Upload Artifacts
  109. uses: actions/upload-artifact@v2
  110. with:
  111. name: ${{ env.RELEASE_NAME }}.zip
  112. path: ./build/${{ env.RELEASE_NAME }}.zip
  113. - name: Upload Artifact to Release
  114. uses: actions/upload-release-asset@v1.0.1
  115. env:
  116. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  117. with:
  118. upload_url: ${{ github.event.release.upload_url }}
  119. asset_path: ./build/${{ env.RELEASE_NAME }}.zip
  120. asset_name: ${{ env.RELEASE_NAME }}.zip
  121. asset_content_type: application/zip
  122. if: github.event_name == 'release' && github.event.action == 'published'