2020-08-17 22:04:20 +03:00
|
|
|
name: macOS
|
2020-08-17 21:54:10 +03:00
|
|
|
|
2021-10-24 18:33:21 +03:00
|
|
|
on:
|
|
|
|
workflow_dispatch:
|
2020-08-19 18:20:44 +03:00
|
|
|
push:
|
2021-10-24 18:33:21 +03:00
|
|
|
paths:
|
|
|
|
- 'src/**'
|
|
|
|
- 'examples/**'
|
|
|
|
- '.github/workflows/macos.yml'
|
2020-08-19 18:20:44 +03:00
|
|
|
pull_request:
|
2021-10-24 18:33:21 +03:00
|
|
|
paths:
|
|
|
|
- 'src/**'
|
|
|
|
- 'examples/**'
|
|
|
|
- '.github/workflows/macos.yml'
|
2020-08-19 18:20:44 +03:00
|
|
|
release:
|
|
|
|
types: [published]
|
2020-08-17 21:54:10 +03:00
|
|
|
|
2022-06-01 00:23:12 +03:00
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
|
2020-08-17 21:54:10 +03:00
|
|
|
jobs:
|
|
|
|
build:
|
2022-06-01 00:23:12 +03:00
|
|
|
permissions:
|
|
|
|
contents: write # for actions/upload-release-asset to upload release asset
|
2020-08-17 21:54:10 +03:00
|
|
|
runs-on: macos-latest
|
2020-08-18 15:12:55 +03:00
|
|
|
|
|
|
|
env:
|
2020-08-21 14:16:40 +03:00
|
|
|
RELEASE_NAME: raylib-dev_macos
|
2020-08-18 15:12:55 +03:00
|
|
|
|
2020-08-17 21:54:10 +03:00
|
|
|
steps:
|
|
|
|
- name: Checkout
|
|
|
|
uses: actions/checkout@master
|
2020-08-21 14:16:40 +03:00
|
|
|
|
|
|
|
- name: Setup Release Version
|
|
|
|
run: |
|
2020-12-25 04:06:50 +03:00
|
|
|
echo "RELEASE_NAME=raylib-${{ github.event.release.tag_name }}_macos" >> $GITHUB_ENV
|
2020-08-21 14:16:40 +03:00
|
|
|
shell: bash
|
|
|
|
if: github.event_name == 'release' && github.event.action == 'published'
|
2020-08-17 21:54:10 +03:00
|
|
|
|
|
|
|
- name: Setup Environment
|
|
|
|
run: |
|
|
|
|
mkdir build
|
|
|
|
cd build
|
2020-08-18 15:12:55 +03:00
|
|
|
mkdir ${{ env.RELEASE_NAME }}
|
|
|
|
cd ${{ env.RELEASE_NAME }}
|
2020-08-17 21:54:10 +03:00
|
|
|
mkdir include
|
|
|
|
mkdir lib
|
2020-08-18 15:12:55 +03:00
|
|
|
cd ../..
|
2020-08-17 21:54:10 +03:00
|
|
|
|
2020-08-19 11:43:48 +03:00
|
|
|
# Generating static + shared library, note that i386 architecture is deprecated
|
|
|
|
# Defining GL_SILENCE_DEPRECATION because OpenGL is deprecated on macOS
|
2020-08-17 21:54:10 +03:00
|
|
|
- name: Build Library
|
|
|
|
run: |
|
|
|
|
cd src
|
2020-08-19 20:12:17 +03:00
|
|
|
clang --version
|
2022-07-08 08:57:10 +03:00
|
|
|
|
|
|
|
# Extract version numbers from Makefile
|
|
|
|
brew install grep
|
|
|
|
RAYLIB_API_VERSION=`ggrep -Po 'RAYLIB_API_VERSION\s*=\s\K(.*)' Makefile`
|
|
|
|
RAYLIB_VERSION=`ggrep -Po 'RAYLIB_VERSION\s*=\s\K(.*)' Makefile`
|
|
|
|
|
|
|
|
# Build raylib x86_64 static
|
|
|
|
make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=STATIC CUSTOM_CFLAGS="-target x86_64-apple-macos10.12 -DGL_SILENCE_DEPRECATION"
|
|
|
|
mv libraylib.a /tmp/libraylib_x86_64.a
|
2020-08-18 15:12:55 +03:00
|
|
|
make clean
|
2022-07-08 08:57:10 +03:00
|
|
|
|
|
|
|
# Build raylib arm64 static
|
|
|
|
make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=STATIC CUSTOM_CFLAGS="-target arm64-apple-macos11 -DGL_SILENCE_DEPRECATION" -B
|
|
|
|
mv libraylib.a /tmp/libraylib_arm64.a
|
|
|
|
make clean
|
|
|
|
|
|
|
|
# Join x86_64 and arm64 static
|
|
|
|
lipo -create -output ../build/${{ env.RELEASE_NAME }}/lib/libraylib.a /tmp/libraylib_x86_64.a /tmp/libraylib_arm64.a
|
|
|
|
|
|
|
|
# Build raylib x86_64 dynamic
|
|
|
|
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
|
|
|
|
mv libraylib.${RAYLIB_VERSION}.dylib /tmp/libraylib_x86_64.${RAYLIB_VERSION}.dylib
|
|
|
|
make clean
|
|
|
|
|
|
|
|
# Build raylib arm64 dynamic
|
|
|
|
make PLATFORM=PLATFORM_DESKTOP RAYLIB_LIBTYPE=SHARED CUSTOM_CFLAGS="-target arm64-apple-macos11 -DGL_SILENCE_DEPRECATION" CUSTOM_LDFLAGS="-target arm64-apple-macos11" -B
|
|
|
|
mv libraylib.${RAYLIB_VERSION}.dylib /tmp/libraylib_arm64.${RAYLIB_VERSION}.dylib
|
|
|
|
|
|
|
|
# Join x86_64 and arm64 dynamic
|
|
|
|
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
|
|
|
|
ln -sv libraylib.${RAYLIB_VERSION}.dylib ../build/${{ env.RELEASE_NAME }}/lib/libraylib.dylib
|
|
|
|
ln -sv libraylib.${RAYLIB_VERSION}.dylib ../build/${{ env.RELEASE_NAME }}/lib/libraylib.${RAYLIB_API_VERSION}.dylib
|
2020-08-17 21:54:10 +03:00
|
|
|
cd ..
|
|
|
|
|
|
|
|
- name: Generate Artifacts
|
|
|
|
run: |
|
2020-08-18 15:12:55 +03:00
|
|
|
cp -v ./src/raylib.h ./build/${{ env.RELEASE_NAME }}/include
|
2021-11-04 22:07:32 +03:00
|
|
|
cp -v ./src/raymath.h ./build/${{ env.RELEASE_NAME }}/include
|
|
|
|
cp -v ./src/rlgl.h ./build/${{ env.RELEASE_NAME }}/include
|
2022-06-06 12:11:39 +03:00
|
|
|
cp -v ./CHANGELOG ./build/${{ env.RELEASE_NAME }}/CHANGELOG
|
2021-02-09 17:53:30 +03:00
|
|
|
cp -v ./README.md ./build/${{ env.RELEASE_NAME }}/README.md
|
|
|
|
cp -v ./LICENSE ./build/${{ env.RELEASE_NAME }}/LICENSE
|
2020-08-18 15:12:55 +03:00
|
|
|
cd build
|
2020-08-19 11:39:57 +03:00
|
|
|
tar -czvf ${{ env.RELEASE_NAME }}.tar.gz ${{ env.RELEASE_NAME }}
|
2020-08-17 21:54:10 +03:00
|
|
|
|
2020-08-17 22:04:58 +03:00
|
|
|
- name: Upload Artifacts
|
2024-02-13 18:15:18 +03:00
|
|
|
uses: actions/upload-artifact@v4
|
2020-08-17 21:54:10 +03:00
|
|
|
with:
|
2020-08-18 15:12:55 +03:00
|
|
|
name: ${{ env.RELEASE_NAME }}.tar.gz
|
|
|
|
path: ./build/${{ env.RELEASE_NAME }}.tar.gz
|
2020-08-19 18:20:44 +03:00
|
|
|
|
|
|
|
- name: Upload Artifact to Release
|
2024-02-18 14:06:16 +03:00
|
|
|
uses: softprops/action-gh-release@v1
|
|
|
|
with:
|
|
|
|
files: ./build/${{ env.RELEASE_NAME }}.tar.gz
|
2020-08-19 18:20:44 +03:00
|
|
|
env:
|
|
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
if: github.event_name == 'release' && github.event.action == 'published'
|