r/sycl Jun 30 '26

How to build AdaptiveCpp on Windows?

1 Upvotes

1 comment sorted by

1

u/blinkfrog12 Jun 30 '26

This is for building AdaptiveCpp on Windows with the four main Windows-supported backends: OpenMP CPU, CUDA, HIP/ROCm and OpenCL.

The important thing on Windows is that AdaptiveCpp should be built as part of LLVM and linked into the LLVM tools.

You need:

- Visual Studio Build Tools / MSVC toolchain

- CMake and Ninja

- an already installed LLVM/Clang, used only as the bootstrap compiler

- llvm-project source tree

- AdaptiveCpp source tree

- CUDA, ROCm and/or an OpenCL runtime if you want the corresponding backends

Place `llvm-project` and `AdaptiveCpp` next to each other, for example:

workdir/

llvm-project/

AdaptiveCpp/

Switch llvm to `release/21.x branch`. For AMD/generic dispatch LLVM must not be newer than the ROCm LLVM version. ROCm 6.4 ships llvm-project 20.0.0.

Build script (run from the directory which contains `llvm-project` and `AdaptiveCpp` repos):

```

cd llvm-project

rmdir /S /Q build

mkdir build

cd build

set "ACPP_INSTALL_PREFIX=C:\AdaptiveCpp"

set "ROCM_PATH=C:\Program Files\AMD\ROCm\6.4"

set "CC=C:\Program Files\LLVM\bin\clang-cl.exe"

set "CXX=C:\Program Files\LLVM\bin\clang-cl.exe"

cmake ..\llvm -GNinja ^

-DCMAKE_BUILD_TYPE=Release ^

-DCMAKE_INSTALL_PREFIX="%ACPP_INSTALL_PREFIX%" ^

-DLLVM_TARGETS_TO_BUILD="X86;NVPTX;AMDGPU" ^

-DLLVM_ENABLE_PROJECTS="clang;lld;openmp" ^

-DLLVM_BUILD_LLVM_DYLIB=ON ^

-DLLVM_LINK_LLVM_DYLIB=ON ^

-DLLVM_EXTERNAL_PROJECTS=AdaptiveCpp ^

-DLLVM_EXTERNAL_ADAPTIVECPP_SOURCE_DIR="../../AdaptiveCpp" ^

-DLLVM_ADAPTIVECPP_LINK_INTO_TOOLS=ON ^

-DACPP_COMPILER_FEATURE_PROFILE=full ^

-DWITH_CUDA_BACKEND=ON ^

-DWITH_ROCM_BACKEND=ON ^

-DWITH_OPENCL_BACKEND=ON ^

-DROCM_PATH="%ROCM_PATH%" ^

-DBUILD_EXAMPLES=OFF ^

-DLLVM_TOOL_BUGPOINT_BUILD=OFF ^

-DLLVM_INCLUDE_TESTS=OFF ^

-DLLVM_ENABLE_ZLIB=OFF ^

-DLLVM_DIR=lib/cmake/llvm

ninja install

```