| 1 | $ErrorActionPreference = "Stop" |
| 2 | |
| 3 | if ([string]::IsNullOrWhiteSpace($env:OHOS_NATIVE_SDK)) { |
| 4 | [Console]::Error.WriteLine("error: set OHOS_NATIVE_SDK to the OpenHarmony native SDK directory. It must contain llvm\bin and sysroot.") |
| 5 | exit 1 |
| 6 | } |
| 7 | |
| 8 | $sdk = $env:OHOS_NATIVE_SDK |
| 9 | $clangxx = [System.IO.Path]::Combine($sdk, "llvm", "bin", "clang++.exe") |
| 10 | $sysroot = [System.IO.Path]::Combine($sdk, "sysroot") |
| 11 | |
| 12 | if (-not (Test-Path -LiteralPath $clangxx -PathType Leaf -ErrorAction SilentlyContinue)) { |
| 13 | [Console]::Error.WriteLine("error: OHOS_NATIVE_SDK does not contain llvm\bin\clang++.exe: $sdk") |
| 14 | exit 1 |
| 15 | } |
| 16 | |
| 17 | if (-not (Test-Path -LiteralPath $sysroot -PathType Container -ErrorAction SilentlyContinue)) { |
| 18 | [Console]::Error.WriteLine("error: OHOS_NATIVE_SDK does not contain sysroot: $sdk") |
| 19 | exit 1 |
| 20 | } |
| 21 | |
| 22 | & $clangxx -target aarch64-linux-ohos "--sysroot=$sysroot" -D__MUSL__ @args |
| 23 | exit $LASTEXITCODE |
| 24 |