diff options
| author | Harold Brenes <harold@hbrenes.com> | 2024-05-16 17:53:41 -0400 |
|---|---|---|
| committer | Harold Brenes <harold@hbrenes.com> | 2024-05-16 17:53:41 -0400 |
| commit | f1b291ed62a8eab35b1d7870f3f49a18319d1cc0 (patch) | |
| tree | 6f70dc3892fbaeacee4b0a8af16d305dbfa61c15 /build_odin.sh | |
| parent | ab8e3db7e9db742061858ac907dcb19d212b1646 (diff) | |
Attempt to automatically resolve the sysroot on build_odin.sh on macOS
Diffstat (limited to 'build_odin.sh')
| -rwxr-xr-x | build_odin.sh | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/build_odin.sh b/build_odin.sh index 7e0d0e585..c27ad119d 100755 --- a/build_odin.sh +++ b/build_odin.sh @@ -64,7 +64,16 @@ Darwin) fi fi - CXXFLAGS="$CXXFLAGS $($LLVM_CONFIG --cxxflags --ldflags)" + darwin_sysroot= + if [ $(which xcode-select) ]; then + darwin_sysroot="--sysroot $(xcode-select -p)/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk" + elif [[ -e "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" ]]; then + darwin_sysroot="--sysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" + else + echo "Warning: MacOSX.sdk not found." + fi + + CXXFLAGS="$CXXFLAGS $($LLVM_CONFIG --cxxflags --ldflags) ${darwin_sysroot}" LDFLAGS="$LDFLAGS -liconv -ldl -framework System -lLLVM" ;; FreeBSD) |