CMake options for building an OpenMP offloading compiler

Here’s how I build a compiler for device offloading.

cmake -S llvm -B /tmp/llvm-build -G Ninja -DCMAKE_BUILD_TYPE=Release \
        -DCMAKE_INSTALL_PREFIX=/tmp/clang \
        -DLLVM_ENABLE_PROJECTS="clang;lld" \
        -DLLVM_ENABLE_RUNTIMES="openmp;libcxx;libcxxabi" \
        -DLIBOMPTARGET_ENABLE_DEBUG=ON \
        -DCLANG_OPENMP_NVPTX_DEFAULT_ARCH=sm_80 \
        -DLIBOMPTARGET_NVPTX_COMPUTE_CAPABILITIES=80 \
        -DGCC_INSTALL_PREFIX=/path/to/gcc/11.2.0

Thanks to Joseph for the slide deck https://www.openmp.org/wp-content/uploads/OpenMP-Offloading-in-LLVM-15.pdf