Skip to content

Commit aadf3af

Browse files
committed
Add premake support for ARM-based macOS
This upgrades to premake 5.0.0-beta8, which is the first version that provides ARM64-based binaries for macOS.
1 parent 42ccd59 commit aadf3af

1 file changed

Lines changed: 18 additions & 8 deletions

File tree

build/build.sh

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
#!/usr/bin/env bash
22
set -e
33
builddir=$(cd "$(dirname "$0")"; pwd)
4-
platform=x64
54
vs=vs2022
65
configuration=DebugOpt
76
build_only=false
@@ -18,8 +17,17 @@ oshost=""
1817
os=""
1918
test=
2019

21-
if [[ $(uname -m) != *"64"* ]]; then
20+
_machine=$(uname -m)
21+
22+
if [[ $_machine == "arm64" ]]; then
23+
platform="arm64"
24+
elif [[ $_machine == "x86_64" ]]; then
25+
platform="x64"
26+
elif [[ $_machine == "i686" ]]; then
2227
platform=x86
28+
else
29+
echo "Unsupported machine type: ${_machine}"
30+
exit 1
2331
fi
2432

2533
build()
@@ -103,7 +111,7 @@ test()
103111
}
104112

105113
clean()
106-
{
114+
{
107115
rm -rf "$objdir"
108116
rm -rf "$gendir"
109117
rm -rf "$bindir"
@@ -125,7 +133,7 @@ download_premake()
125133

126134
if ! [ -f "$premake_path" ]; then
127135
echo "Downloading and unpacking Premake..."
128-
premake_version=5.0.0-beta2
136+
premake_version=5.0.0-beta8
129137
premake_archive=premake-$premake_version-$oshost.$premake_archive_ext
130138
premake_url=https://github.com/premake/premake-core/releases/download/v$premake_version/$premake_archive
131139
curl -L -O $premake_url
@@ -161,7 +169,9 @@ package_llvm()
161169

162170
detect_os()
163171
{
164-
case "$(uname -s)" in
172+
local _system=$(uname -s)
173+
174+
case "${_system}" in
165175
Darwin)
166176
oshost=macosx
167177
;;
@@ -172,7 +182,7 @@ detect_os()
172182
oshost=windows
173183
;;
174184
*)
175-
echo "Unsupported platform"
185+
echo "Unsupported platform: ${_system}"
176186
exit 1
177187
;;
178188
esac
@@ -202,7 +212,7 @@ while [[ $# > 0 ]]; do
202212
-configuration)
203213
configuration=$2
204214
shift
205-
;;
215+
;;
206216
-platform)
207217
platform=$2
208218
shift
@@ -240,7 +250,7 @@ case "$cmd" in
240250
;;
241251
generate_config)
242252
generate_config
243-
;;
253+
;;
244254
prepack)
245255
prepack
246256
;;

0 commit comments

Comments
 (0)