Skip to content

Commit

Permalink
Auto-detect architecture in build.sh.
Browse files Browse the repository at this point in the history
  • Loading branch information
tritao committed Oct 27, 2024
1 parent 166e45e commit 29653a0
Showing 1 changed file with 28 additions and 4 deletions.
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

0 comments on commit 29653a0

Please sign in to comment.