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.

113 lines
4.2 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
4 years ago
3 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
10 months 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. - name: Build Library
  45. run: |
  46. cd src
  47. clang --version
  48. # Extract version numbers from Makefile
  49. brew install grep
  50. RAYLIB_API_VERSION=`ggrep -Po 'RAYLIB_API_VERSION\s*=\s\K(.*)' Makefile`
  51. RAYLIB_VERSION=`ggrep -Po 'RAYLIB_VERSION\s*=\s\K(.*)' Makefile`
  52. # Build raylib x86_64 static
  53. make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=STATIC CUSTOM_CFLAGS="-target x86_64-apple-macos10.12 -DGL_SILENCE_DEPRECATION"
  54. mv libraylib.a /tmp/libraylib_x86_64.a
  55. make clean
  56. # Build raylib arm64 static
  57. make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=STATIC CUSTOM_CFLAGS="-target arm64-apple-macos11 -DGL_SILENCE_DEPRECATION" -B
  58. mv libraylib.a /tmp/libraylib_arm64.a
  59. make clean
  60. # Join x86_64 and arm64 static
  61. lipo -create -output ../build/${{ env.RELEASE_NAME }}/lib/libraylib.a /tmp/libraylib_x86_64.a /tmp/libraylib_arm64.a
  62. # Build raylib x86_64 dynamic
  63. make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=SHARED CUSTOM_CFLAGS="-target x86_64-apple-macos10.12 -DGL_SILENCE_DEPRECATION" CUSTOM_LDFLAGS="-target x86_64-apple-macos10.12" -B
  64. mv libraylib.${RAYLIB_VERSION}.dylib /tmp/libraylib_x86_64.${RAYLIB_VERSION}.dylib
  65. make clean
  66. # Build raylib arm64 dynamic
  67. make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=SHARED CUSTOM_CFLAGS="-target arm64-apple-macos11 -DGL_SILENCE_DEPRECATION" CUSTOM_LDFLAGS="-target arm64-apple-macos11" -B
  68. mv libraylib.${RAYLIB_VERSION}.dylib /tmp/libraylib_arm64.${RAYLIB_VERSION}.dylib
  69. # Join x86_64 and arm64 dynamic
  70. lipo -create -output ../build/${{ env.RELEASE_NAME }}/lib/libraylib.${RAYLIB_VERSION}.dylib /tmp/libraylib_x86_64.${RAYLIB_VERSION}.dylib /tmp/libraylib_arm64.${RAYLIB_VERSION}.dylib
  71. ln -sv libraylib.${RAYLIB_VERSION}.dylib ../build/${{ env.RELEASE_NAME }}/lib/libraylib.dylib
  72. ln -sv libraylib.${RAYLIB_VERSION}.dylib ../build/${{ env.RELEASE_NAME }}/lib/libraylib.${RAYLIB_API_VERSION}.dylib
  73. cd ..
  74. - name: Generate Artifacts
  75. run: |
  76. cp -v ./src/raylib.h ./build/${{ env.RELEASE_NAME }}/include
  77. cp -v ./src/raymath.h ./build/${{ env.RELEASE_NAME }}/include
  78. cp -v ./src/rlgl.h ./build/${{ env.RELEASE_NAME }}/include
  79. cp -v ./CHANGELOG ./build/${{ env.RELEASE_NAME }}/CHANGELOG
  80. cp -v ./README.md ./build/${{ env.RELEASE_NAME }}/README.md
  81. cp -v ./LICENSE ./build/${{ env.RELEASE_NAME }}/LICENSE
  82. cd build
  83. tar -czvf ${{ env.RELEASE_NAME }}.tar.gz ${{ env.RELEASE_NAME }}
  84. - name: Upload Artifacts
  85. uses: actions/upload-artifact@v4
  86. with:
  87. name: ${{ env.RELEASE_NAME }}.tar.gz
  88. path: ./build/${{ env.RELEASE_NAME }}.tar.gz
  89. - name: Upload Artifact to Release
  90. uses: softprops/action-gh-release@v1
  91. with:
  92. files: ./build/${{ env.RELEASE_NAME }}.tar.gz
  93. env:
  94. GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  95. if: github.event_name == 'release' && github.event.action == 'published'