| 1 | @echo off |
| 2 | setlocal |
| 3 | |
| 4 | set "OHOS_LINKER_SCRIPT=%~dp0ohos-clang.ps1" |
| 5 | if not exist "%OHOS_LINKER_SCRIPT%" ( |
| 6 | echo error: OpenHarmony linker script is missing: %OHOS_LINKER_SCRIPT% 1>&2 |
| 7 | exit /b 1 |
| 8 | ) |
| 9 | |
| 10 | rem Re-quote every argument before forwarding: cmd's %* expansion strips the |
| 11 | rem quotes that rustc put around arguments containing spaces, so a sysroot like |
| 12 | rem "D:\DevEco Studio\...\sysroot" would otherwise arrive at clang split on the |
| 13 | rem space. %~1 strips the caller's quoting, then we wrap the argument in quotes |
| 14 | rem again so PowerShell -File hands it to the script as one argument. |
| 15 | set "ARGS=" |
| 16 | :argloop |
| 17 | if "%~1"=="" goto run |
| 18 | set "ARGS=%ARGS% "%~1"" |
| 19 | shift |
| 20 | goto argloop |
| 21 | |
| 22 | :run |
| 23 | "%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoLogo -NoProfile -NonInteractive -ExecutionPolicy Bypass -File "%OHOS_LINKER_SCRIPT%" %ARGS% |
| 24 | exit /b %ERRORLEVEL% |
| 25 |