commit a98eb13225176520c149b948cd0bb56199e852e2
parent f436ec3839ebb5f2eabe6ccdbc42d70d50336885
Author: Jack Mordaunt <jackmordaunt.dev@gmail.com>
Date: Thu, 30 Oct 2025 22:32:27 -0300
script/generate: ensure brew libclang works on macOS
Homebrew installs of llvm need to be told where to find system headers,
while the system llvm does not. To handle both cases, we can explicitly
set SDKROOT when macOS is detected.
Diffstat:
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/script/generate.sh b/script/generate.sh
@@ -6,15 +6,15 @@ set -xeu
cmake -S blend2d -B .build -DCMAKE_BUILD_TYPE=Release -DBLEND2D_STATIC=ON -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
cmake --build .build --config Release --parallel 4
-
# Copy public headers (blend2d uses _p to indicate "private").
rm -r .headers || true
mkdir -p .headers
fd -e .h -E "*_p.h" . blend2d/src/blend2d | xargs -I {} cp {} .headers/
-# Export libclang for bindgen to link to.
-export LIBRARY_PATH=$(llvm-config --libdir)
-export CPATH=$(llvm-config --includedir)
+# On macOS, set SDKROOT so that brew versions of libclang can find system headers.
+if [[ "$(uname)" == "Darwin" ]]; then
+ export SDKROOT=$(xcrun --show-sdk-path)
+fi
# Generate bindings.
rm -r ./binding || true