Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add macOS ARM64 support #1879

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from
2 changes: 1 addition & 1 deletion .github/workflows/llvm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
- { os: ubuntu-22.04, platform: arm64, cxx: g++-11, cc: gcc-11 }
- { os: macos-11, platform: x64, cxx: clang++, cc: clang }
- { os: macos-12, platform: x64, cxx: clang++, cc: clang }
- { os: macos-12, platform: arm64, cxx: clang++, cc: clang }
- { os: macos-14, platform: arm64, cxx: clang++, cc: clang }

runs-on: ${{ matrix.config.os }}

Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ jobs:
config:
- { os: ubuntu-22.04, platform: x64, cxx: g++-11, cc: gcc-11 }
- { os: macos-12, platform: x64, cxx: clang++, cc: clang }
- { os: macos-14, platform: arm64, cxx: clang++, cc: clang }
- { os: windows-2022, platform: x64, vs: "Program Files/Microsoft Visual Studio/2022" }

runs-on: ${{ matrix.config.os }}
Expand All @@ -30,10 +31,10 @@ jobs:
fetch-depth: '0'

- name: Setup emsdk
uses: mymindstorm/setup-emsdk@v11
uses: mymindstorm/setup-emsdk@v14
with:
version: ${{ env.EMSCRIPTEN_VERSION }}
actions-cache-folder: emsdk-cache-${{ runner.os }}
actions-cache-folder: emsdk-cache-${{ runner.os }}-${{ matrix.config.platform }}

- name: Setup cmake
uses: jwlawson/actions-setup-cmake@v2
Expand Down
6 changes: 3 additions & 3 deletions build/Helpers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,11 @@ function AddPlatformSpecificFiles(folder, filename)
files { path.join(folder, "i686-pc-win32-msvc", filename) }
elseif os.istarget("macosx") then
filter { "architecture:arm64" }
files { path.join(folder, "arm64-apple-darwin12.4.0", filename) }
files { path.join(folder, "arm64-apple-darwin", filename) }
filter { "architecture:x86_64" }
files { path.join(folder, "x86_64-apple-darwin12.4.0", filename) }
files { path.join(folder, "x86_64-apple-darwin", filename) }
filter {"architecture:x86" }
files { path.join(folder, "i686-apple-darwin12.4.0", filename) }
files { path.join(folder, "i686-apple-darwin", filename) }
elseif os.istarget("linux") then
filter { "architecture:arm64" }
files { path.join(folder, "arm64-linux-gnu" .. (UseCxx11ABI() and "-cxx11abi" or ""), filename) }
Expand Down
32 changes: 28 additions & 4 deletions build/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,6 @@ oshost=""
os=""
test=

if [[ $(uname -m) != *"64"* ]]; then
platform=x86
fi

build()
{
if [ $ci = true ]; then
Expand Down Expand Up @@ -180,6 +176,33 @@ detect_os()
os=$oshost
}

detect_arch()
{
if [ "$oshost" = "linux" ] || [ "$oshost" = "macosx" ]; then
arch=$(uname -m)
if [ "$arch" = "x86_64" ]; then
platform="x64"
elif [ "$arch" = "arm64" ] || [ "$arch" = "aarch64" ]; then
platform="arm64"
elif [ "$arch" = "i686" ] || [ "$arch" = "i386" ]; then
platform="x86"
else
echo "Unknown architecture: $arch"
fi
elif [ "$oshost" = "windows" ]; then
arch=$(echo $PROCESSOR_ARCHITECTURE)
if [ "$arch" = "AMD64" ]; then
platform="x64"
elif [ "$arch" = "ARM64" ]; then
platform="arm64"
elif [ "$arch" = "x86" ]; then
platform="x86"
else
echo "Unknown architecture: $arch"
fi
fi
}

find_msbuild()
{
if [ -x "$(command -v MSBuild.exe)" ]; then
Expand All @@ -191,6 +214,7 @@ find_msbuild()

cmd=$(tr '[:upper:]' '[:lower:]' <<< $1)
detect_os
detect_arch
download_premake

while [[ $# > 0 ]]; do
Expand Down
Loading
Loading