Do clang checks on Mac

This commit is contained in:
Ben Visness 2023-09-23 17:04:13 -05:00 committed by MartinFouilleul
parent 75c4f6f94d
commit 1cc8778982
11 changed files with 54 additions and 41 deletions

View File

@ -1,7 +1,7 @@
@echo off
setlocal enabledelayedexpansion
:: The following code simply checks that you have a compatible version of Clang.
:: The following code checks if you have the necessary programs to compile the samples.
:: This code exists to improve the experience of first-time Orca users and can
:: be safely deleted in your own projects if you wish.
if exist "..\..\scripts\sample_build_check.py" (

View File

@ -2,13 +2,14 @@
set -euo pipefail
if [[ -x /usr/local/opt/llvm/bin/clang ]]; then
CLANG=/usr/local/opt/llvm/bin/clang
elif [[ -x /opt/homebrew/opt/llvm/bin/clang ]]; then
CLANG=/opt/homebrew/opt/llvm/bin/clang
# The following code checks if you have the necessary programs to compile the samples.
# This code exists to improve the experience of first-time Orca users and can
# be safely deleted in your own projects if you wish.
if [ -f ../../scripts/sample_build_check.py ]; then
python3 ../../scripts/sample_build_check.py
else
echo "Could not find Homebrew clang; this script will probably not work."
CLANG=clang
echo "Could not check if you have the necessary tools to build the Orca samples."
echo "If you have copied this script to your own project, you can delete this code."
fi
ORCA_DIR=../..
@ -25,6 +26,6 @@ wasmFlags="--target=wasm32 \
-I $ORCA_DIR/src \
-I $ORCA_DIR/src/ext"
$CLANG $wasmFlags -o ./module.wasm $ORCA_DIR/src/orca.c $STDLIB_DIR/src/*.c src/main.c
clang $wasmFlags -o ./module.wasm $ORCA_DIR/src/orca.c $STDLIB_DIR/src/*.c src/main.c
orca bundle --orca-dir $ORCA_DIR --name Breakout --icon icon.png --resource-dir data module.wasm

View File

@ -1,7 +1,7 @@
@echo off
setlocal enabledelayedexpansion
:: The following code simply checks that you have a compatible version of Clang.
:: The following code checks if you have the necessary programs to compile the samples.
:: This code exists to improve the experience of first-time Orca users and can
:: be safely deleted in your own projects if you wish.
if exist "..\..\scripts\sample_build_check.py" (

View File

@ -2,13 +2,14 @@
set -euo pipefail
if [[ -x /usr/local/opt/llvm/bin/clang ]]; then
CLANG=/usr/local/opt/llvm/bin/clang
elif [[ -x /opt/homebrew/opt/llvm/bin/clang ]]; then
CLANG=/opt/homebrew/opt/llvm/bin/clang
# The following code checks if you have the necessary programs to compile the samples.
# This code exists to improve the experience of first-time Orca users and can
# be safely deleted in your own projects if you wish.
if [ -f ../../scripts/sample_build_check.py ]; then
python3 ../../scripts/sample_build_check.py
else
echo "Could not find Homebrew clang; this script will probably not work."
CLANG=clang
echo "Could not check if you have the necessary tools to build the Orca samples."
echo "If you have copied this script to your own project, you can delete this code."
fi
ORCA_DIR=../..
@ -25,6 +26,6 @@ wasmFlags="--target=wasm32 \
-I $ORCA_DIR/src \
-I $ORCA_DIR/src/ext"
$CLANG $wasmFlags -o ./module.wasm $ORCA_DIR/src/orca.c $STDLIB_DIR/src/*.c src/main.c
clang $wasmFlags -o ./module.wasm $ORCA_DIR/src/orca.c $STDLIB_DIR/src/*.c src/main.c
orca bundle --orca-dir $ORCA_DIR --name Clock --icon icon.png --resource-dir data module.wasm

View File

@ -1,7 +1,7 @@
@echo off
setlocal enabledelayedexpansion
:: The following code simply checks that you have a compatible version of Clang.
:: The following code checks if you have the necessary programs to compile the samples.
:: This code exists to improve the experience of first-time Orca users and can
:: be safely deleted in your own projects if you wish.
if exist "..\..\scripts\sample_build_check.py" (

View File

@ -2,13 +2,14 @@
set -euo pipefail
if [[ -x /usr/local/opt/llvm/bin/clang ]]; then
CLANG=/usr/local/opt/llvm/bin/clang
elif [[ -x /opt/homebrew/opt/llvm/bin/clang ]]; then
CLANG=/opt/homebrew/opt/llvm/bin/clang
# The following code checks if you have the necessary programs to compile the samples.
# This code exists to improve the experience of first-time Orca users and can
# be safely deleted in your own projects if you wish.
if [ -f ../../scripts/sample_build_check.py ]; then
python3 ../../scripts/sample_build_check.py
else
echo "Could not find Homebrew clang; this script will probably not work."
CLANG=clang
echo "Could not check if you have the necessary tools to build the Orca samples."
echo "If you have copied this script to your own project, you can delete this code."
fi
ORCA_DIR=../..
@ -27,6 +28,6 @@ wasmFlags="--target=wasm32 \
-I $ORCA_DIR/src \
-I $ORCA_DIR/src/ext"
$CLANG $wasmFlags -o ./module.wasm $ORCA_DIR/src/orca.c $STDLIB_DIR/src/*.c src/main.c
clang $wasmFlags -o ./module.wasm $ORCA_DIR/src/orca.c $STDLIB_DIR/src/*.c src/main.c
orca bundle --orca-dir $ORCA_DIR --name Fluid --icon icon.png module.wasm

View File

@ -1,7 +1,7 @@
@echo off
setlocal enabledelayedexpansion
:: The following code simply checks that you have a compatible version of Clang.
:: The following code checks if you have the necessary programs to compile the samples.
:: This code exists to improve the experience of first-time Orca users and can
:: be safely deleted in your own projects if you wish.
if exist "..\..\scripts\sample_build_check.py" (

View File

@ -2,13 +2,14 @@
set -euo pipefail
if [[ -x /usr/local/opt/llvm/bin/clang ]]; then
CLANG=/usr/local/opt/llvm/bin/clang
elif [[ -x /opt/homebrew/opt/llvm/bin/clang ]]; then
CLANG=/opt/homebrew/opt/llvm/bin/clang
# The following code checks if you have the necessary programs to compile the samples.
# This code exists to improve the experience of first-time Orca users and can
# be safely deleted in your own projects if you wish.
if [ -f ../../scripts/sample_build_check.py ]; then
python3 ../../scripts/sample_build_check.py
else
echo "Could not find Homebrew clang; this script will probably not work."
CLANG=clang
echo "Could not check if you have the necessary tools to build the Orca samples."
echo "If you have copied this script to your own project, you can delete this code."
fi
ORCA_DIR=../..
@ -25,6 +26,6 @@ wasmFlags="--target=wasm32 \
-I $ORCA_DIR/src \
-I $ORCA_DIR/src/ext"
$CLANG $wasmFlags -o ./module.wasm $ORCA_DIR/src/orca.c $STDLIB_DIR/src/*.c src/main.c
clang $wasmFlags -o ./module.wasm $ORCA_DIR/src/orca.c $STDLIB_DIR/src/*.c src/main.c
orca bundle --orca-dir $ORCA_DIR --name Triangle module.wasm

View File

@ -1,7 +1,7 @@
@echo off
setlocal enabledelayedexpansion
:: The following code simply checks that you have a compatible version of Clang.
:: The following code checks if you have the necessary programs to compile the samples.
:: This code exists to improve the experience of first-time Orca users and can
:: be safely deleted in your own projects if you wish.
if exist "..\..\scripts\sample_build_check.py" (

View File

@ -2,13 +2,14 @@
set -euo pipefail
if [[ -x /usr/local/opt/llvm/bin/clang ]]; then
CLANG=/usr/local/opt/llvm/bin/clang
elif [[ -x /opt/homebrew/opt/llvm/bin/clang ]]; then
CLANG=/opt/homebrew/opt/llvm/bin/clang
# The following code checks if you have the necessary programs to compile the samples.
# This code exists to improve the experience of first-time Orca users and can
# be safely deleted in your own projects if you wish.
if [ -f ../../scripts/sample_build_check.py ]; then
python3 ../../scripts/sample_build_check.py
else
echo "Could not find Homebrew clang; this script will probably not work."
CLANG=clang
echo "Could not check if you have the necessary tools to build the Orca samples."
echo "If you have copied this script to your own project, you can delete this code."
fi
ORCA_DIR=../..
@ -25,6 +26,6 @@ wasmFlags="--target=wasm32 \
-I $ORCA_DIR/src \
-I $ORCA_DIR/src/ext"
$CLANG $wasmFlags -o ./module.wasm $ORCA_DIR/src/orca.c $STDLIB_DIR/src/*.c src/main.c
clang $wasmFlags -o ./module.wasm $ORCA_DIR/src/orca.c $STDLIB_DIR/src/*.c src/main.c
orca bundle --orca-dir $ORCA_DIR --name UI --resource-dir data module.wasm

View File

@ -13,7 +13,7 @@ def print_clang_install_info(upgrade):
if platform.system() == "Windows":
printw(f"Please install Clang {CLANG_MAJOR}.{CLANG_MINOR} or newer. We recommend installing Clang via the Visual Studio installer. In the installer, search for \"C++ Clang Compiler\".")
elif platform.system() == "Darwin":
printw(f"Please install Clang {CLANG_MAJOR}.{CLANG_MINOR} or newer. We recommend installing Clang via Homebrew:")
printw(f"Please install Clang {CLANG_MAJOR}.{CLANG_MINOR} or newer. We recommend installing Clang via Homebrew (https://brew.sh/):")
printw()
if upgrade:
printw(" brew upgrade llvm")
@ -43,6 +43,14 @@ except FileNotFoundError:
except subprocess.CalledProcessError:
printw("WARNING: Could not check Clang version. You may encounter build errors.")
try:
subprocess.run(["wasm-ld", "--version"], capture_output=True, check=True)
except FileNotFoundError:
printw("ERROR: wasm-ld was not found on your system. This is a component of Clang that is required in order to produce WebAssembly modules. This likely means that an old or otherwise incompatible version of Clang is being used, such as Apple's version of Clang.")
printw()
print_clang_install_info(False)
exit(1)
try:
subprocess.run(["orca", "version"], capture_output=True, shell=True, check=True)
except subprocess.CalledProcessError: