chore: move HarmonyOS clang wrappers to scripts/ohos/
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
if ([string]::IsNullOrWhiteSpace($env:OHOS_NATIVE_SDK)) {
|
||||
[Console]::Error.WriteLine("error: set OHOS_NATIVE_SDK to the OpenHarmony native SDK directory. It must contain llvm\bin and sysroot.")
|
||||
exit 1
|
||||
}
|
||||
|
||||
$sdk = $env:OHOS_NATIVE_SDK
|
||||
$clang = [System.IO.Path]::Combine($sdk, "llvm", "bin", "clang.exe")
|
||||
$sysroot = [System.IO.Path]::Combine($sdk, "sysroot")
|
||||
|
||||
if (-not (Test-Path -LiteralPath $clang -PathType Leaf -ErrorAction SilentlyContinue)) {
|
||||
[Console]::Error.WriteLine("error: OHOS_NATIVE_SDK does not contain llvm\bin\clang.exe: $sdk")
|
||||
exit 1
|
||||
}
|
||||
|
||||
if (-not (Test-Path -LiteralPath $sysroot -PathType Container -ErrorAction SilentlyContinue)) {
|
||||
[Console]::Error.WriteLine("error: OHOS_NATIVE_SDK does not contain sysroot: $sdk")
|
||||
exit 1
|
||||
}
|
||||
|
||||
& $clang -target aarch64-linux-ohos "--sysroot=$sysroot" -D__MUSL__ @args
|
||||
exit $LASTEXITCODE
|
||||
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env sh
|
||||
set -eu
|
||||
|
||||
if [ -z "${OHOS_NATIVE_SDK:-}" ]; then
|
||||
echo "error: set OHOS_NATIVE_SDK to the OpenHarmony native SDK directory. It must contain llvm/bin and sysroot." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sdk=$OHOS_NATIVE_SDK
|
||||
clang=$sdk/llvm/bin/clang
|
||||
sysroot=$sdk/sysroot
|
||||
|
||||
if [ ! -x "$clang" ]; then
|
||||
echo "error: OHOS_NATIVE_SDK does not contain executable llvm/bin/clang: $sdk" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d "$sysroot" ]; then
|
||||
echo "error: OHOS_NATIVE_SDK does not contain sysroot: $sdk" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exec "$clang" -target aarch64-linux-ohos "--sysroot=$sysroot" -D__MUSL__ "$@"
|
||||
@@ -0,0 +1,23 @@
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
if ([string]::IsNullOrWhiteSpace($env:OHOS_NATIVE_SDK)) {
|
||||
[Console]::Error.WriteLine("error: set OHOS_NATIVE_SDK to the OpenHarmony native SDK directory. It must contain llvm\bin and sysroot.")
|
||||
exit 1
|
||||
}
|
||||
|
||||
$sdk = $env:OHOS_NATIVE_SDK
|
||||
$clangxx = [System.IO.Path]::Combine($sdk, "llvm", "bin", "clang++.exe")
|
||||
$sysroot = [System.IO.Path]::Combine($sdk, "sysroot")
|
||||
|
||||
if (-not (Test-Path -LiteralPath $clangxx -PathType Leaf -ErrorAction SilentlyContinue)) {
|
||||
[Console]::Error.WriteLine("error: OHOS_NATIVE_SDK does not contain llvm\bin\clang++.exe: $sdk")
|
||||
exit 1
|
||||
}
|
||||
|
||||
if (-not (Test-Path -LiteralPath $sysroot -PathType Container -ErrorAction SilentlyContinue)) {
|
||||
[Console]::Error.WriteLine("error: OHOS_NATIVE_SDK does not contain sysroot: $sdk")
|
||||
exit 1
|
||||
}
|
||||
|
||||
& $clangxx -target aarch64-linux-ohos "--sysroot=$sysroot" -D__MUSL__ @args
|
||||
exit $LASTEXITCODE
|
||||
@@ -0,0 +1,23 @@
|
||||
#!/usr/bin/env sh
|
||||
set -eu
|
||||
|
||||
if [ -z "${OHOS_NATIVE_SDK:-}" ]; then
|
||||
echo "error: set OHOS_NATIVE_SDK to the OpenHarmony native SDK directory. It must contain llvm/bin and sysroot." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sdk=$OHOS_NATIVE_SDK
|
||||
clangxx=$sdk/llvm/bin/clang++
|
||||
sysroot=$sdk/sysroot
|
||||
|
||||
if [ ! -x "$clangxx" ]; then
|
||||
echo "error: OHOS_NATIVE_SDK does not contain executable llvm/bin/clang++: $sdk" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -d "$sysroot" ]; then
|
||||
echo "error: OHOS_NATIVE_SDK does not contain sysroot: $sdk" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
exec "$clangxx" -target aarch64-linux-ohos "--sysroot=$sysroot" -D__MUSL__ "$@"
|
||||
Reference in New Issue
Block a user