Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagebash
REM You need to modify the paths below:
set build_dir=path\to\where\you\want\the\build (must alredy exist)
set clang_root=path\to\where\clang\is\installed
set clang_version=x.0.y (should match what’s in %clang_root%)

REM Some helper variables.
REM Setting CMAKE_CL_SHOWINCLUDES_PREFIX to work around PR27226.
set cmake_flags=^
  -DCMAKE_BUILD_TYPE=Release ^
  -DLLVM_ENABLE_ASSERTIONS=ON ^
  -DLLVM_INSTALL_TOOLCHAIN_ONLY=ON ^
  -DLLVM_BUILD_LLVM_C_DYLIB=ON ^
  -DCMAKE_INSTALL_UCRT_LIBRARIES=ON ^
  -DCMAKE_CL_SHOWINCLUDES_PREFIX="Note: including file: " ^
  -DLLVM_DEFAULT_TARGET_TRIPLE=aarch64-unknown-windows-msvc ^
  -DLLVM_HOST_TRIPLE=aarch64-windows-msvc ^
  -DLLVM_TARGET_ARCH=AArch64 ^
  -DCLANG_DEFAULT_LINKER=lld 

cd %build_dir%

set clang_path=%clang_root%\bin\clang-cl.exe
set builtins_path=%clang_root%\lib\clang\%clang_version%\lib\windows
set builtins_lib=clang_rt.builtins-aarch64.lib

set CC=%clang_path%
set CXX=%clang_path%

REM We enable clang because it is needed by the flang driver.
cmake -GNinja %cmake_flags% ^
  -DLLVM_ENABLE_PROJECTS="clang;flang;mlir" ^
  -DLLVM_TARGETS_TO_BUILD="AArch64" ^
  -DCMAKE_C_FLAGS="-fms-compatibility-version=19.14" ^
  -DCMAKE_CXX_FLAGS="-fms-compatibility-version=19.14" ^
  -DCMAKE_EXE_LINKER_FLAGS="%builtins_path%/%builtins_lib%" ^
  ..\llvm-project\llvm || exit /b

ninja all || ninja all || ninja all || exit /b

...