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.

96 lines
4.0 KiB

4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
3 years ago
4 years ago
4 years ago
3 years ago
4 years ago
4 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
  1. name: macOS
  2. on:
  3. workflow_dispatch:
  4. push:
  5. paths:
  6. - 'src/**'
  7. - 'examples/**'
  8. - '.github/workflows/macos.yml'
  9. pull_request:
  10. paths:
  11. - 'src/**'
  12. - 'examples/**'
  13. - '.github/workflows/macos.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: macos-latest
  23. env:
  24. RELEASE_NAME: raylib-dev_macos
  25. steps:
  26. - name: Checkout
  27. uses: actions/checkout@master
  28. - name: Setup Release Version
  29. run: |
  30. echo "RELEASE_NAME=raylib-${{ github.event.release.tag_name }}_macos" >> $GITHUB_ENV
  31. shell: bash
  32. if: github.event_name == 'release' && github.event.action == 'published'
  33. - name: Setup Environment
  34. run: |
  35. mkdir build
  36. cd build
  37. mkdir ${{ env.RELEASE_NAME }}
  38. cd ${{ env.RELEASE_NAME }}
  39. mkdir include
  40. mkdir lib
  41. cd ../..
  42. # Generating static + shared library, note that i386 architecture is deprecated
  43. # Defining GL_SILENCE_DEPRECATION because OpenGL is deprecated on macOS
  44. # TODO: Support Universal ARCH libraries (build arm64 + x86_64 and merge)
  45. - name: Build Library
  46. run: |
  47. cd src
  48. clang --version
  49. make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=STATIC RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" CUSTOM_CFLAGS="-target x86_64-apple-macos10.12 -DGL_SILENCE_DEPRECATION" -B
  50. # make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=STATIC RAYLIB_LIB_NAME=raylib_x86_64 CUSTOM_CFLAGS="-target x86_64-apple-macos10.12 -DGL_SILENCE_DEPRECATION"
  51. # make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=STATIC RAYLIB_LIB_NAME=raylib_arm64 CUSTOM_CFLAGS="-target arm64-apple-macos11 -DGL_SILENCE_DEPRECATION" -B
  52. # lipo -create -output ../build/${{ env.RELEASE_NAME }}/lib/libraylib.a libraylib_x86_64.a libraylib_arm64.a
  53. make clean
  54. make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=SHARED RAYLIB_RELEASE_PATH="../build/${{ env.RELEASE_NAME }}/lib" CUSTOM_CFLAGS="-target x86_64-apple-macos10.12 -DGL_SILENCE_DEPRECATION" -B
  55. # make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=SHARED RAYLIB_LIB_NAME=raylib_x86_64 CUSTOM_CFLAGS="-target x86_64-apple-macos10.12 -DGL_SILENCE_DEPRECATION" -B
  56. # make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=SHARED RAYLIB_LIB_NAME=raylib_arm64 CUSTOM_CFLAGS="-target i686-apple-macos -DGL_SILENCE_DEPRECATION" -B
  57. # lipo -create -output ../build/${{ env.RELEASE_NAME }}/lib/libraylib.3.1.0.dylib libraylib_x86_64.3.1.0.dylib libraylib_arm64.3.1.0.dylib
  58. # cp -v ./libraylib_arm64.dylib ../build/${{ env.RELEASE_NAME }}/lib/libraylib.dylib
  59. # cp -v ./libraylib_arm64.310.dylib ../build/${{ env.RELEASE_NAME }}/lib/libraylib.310.dylib
  60. cd ..
  61. - name: Generate Artifacts
  62. run: |
  63. cp -v ./src/raylib.h ./build/${{ env.RELEASE_NAME }}/include
  64. cp -v ./src/raymath.h ./build/${{ env.RELEASE_NAME }}/include
  65. cp -v ./src/rlgl.h ./build/${{ env.RELEASE_NAME }}/include
  66. cp -v ./CHANGELOG ./build/${{ env.RELEASE_NAME }}/CHANGELOG
  67. cp -v ./README.md ./build/${{ env.RELEASE_NAME }}/README.md
  68. cp -v ./LICENSE ./build/${{ env.RELEASE_NAME }}/LICENSE
  69. cd build
  70. tar -czvf ${{ env.RELEASE_NAME }}.tar.gz ${{ env.RELEASE_NAME }}
  71. - name: Upload Artifacts
  72. uses: actions/upload-artifact@v2
  73. with:
  74. name: ${{ env.RELEASE_NAME }}.tar.gz
  75. path: ./build/${{ env.RELEASE_NAME }}.tar.gz
  76. - name: Upload Artifact to Release
  77. uses: actions/upload-release-asset@v1.0.1
  78. env:
  79. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  80. with:
  81. upload_url: ${{ github.event.release.upload_url }}
  82. asset_path: ./build/${{ env.RELEASE_NAME }}.tar.gz
  83. asset_name: ${{ env.RELEASE_NAME }}.tar.gz
  84. asset_content_type: application/gzip
  85. if: github.event_name == 'release' && github.event.action == 'published'