Skip to content

Commit 29653a0

Browse files
committed
Auto-detect architecture in build.sh.
1 parent 166e45e commit 29653a0

File tree

1 file changed

+28
-4
lines changed

1 file changed

+28
-4
lines changed

build/build.sh

+28-4
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ oshost=""
1818
os=""
1919
test=
2020

21-
if [[ $(uname -m) != *"64"* ]]; then
22-
platform=x86
23-
fi
24-
2521
build()
2622
{
2723
if [ $ci = true ]; then
@@ -180,6 +176,33 @@ detect_os()
180176
os=$oshost
181177
}
182178

179+
detect_arch()
180+
{
181+
if [ "$oshost" = "linux" ] || [ "$oshost" = "macosx" ]; then
182+
arch=$(uname -m)
183+
if [ "$arch" = "x86_64" ]; then
184+
platform="x64"
185+
elif [ "$arch" = "arm64" ] || [ "$arch" = "aarch64" ]; then
186+
platform="arm64"
187+
elif [ "$arch" = "i686" ] || [ "$arch" = "i386" ]; then
188+
platform="x86"
189+
else
190+
echo "Unknown architecture: $arch"
191+
fi
192+
elif [ "$oshost" = "windows" ]; then
193+
arch=$(echo $PROCESSOR_ARCHITECTURE)
194+
if [ "$arch" = "AMD64" ]; then
195+
platform="x64"
196+
elif [ "$arch" = "ARM64" ]; then
197+
platform="arm64"
198+
elif [ "$arch" = "x86" ]; then
199+
platform="x86"
200+
else
201+
echo "Unknown architecture: $arch"
202+
fi
203+
fi
204+
}
205+
183206
find_msbuild()
184207
{
185208
if [ -x "$(command -v MSBuild.exe)" ]; then
@@ -191,6 +214,7 @@ find_msbuild()
191214

192215
cmd=$(tr '[:upper:]' '[:lower:]' <<< $1)
193216
detect_os
217+
detect_arch
194218
download_premake
195219

196220
while [[ $# > 0 ]]; do

0 commit comments

Comments
 (0)