1 # This file sets up a CMakeCache for the simple VE build.
3 # VE is a CPU with vector engine. But it is a connected to a host CPU as
4 # an accelerator. So, we compile programs for VE on a host using clang/llvm
5 # as a cross compiler. Therefore, the purpose of this cache file is to
6 # compile clang/llvm supporting both targets.
9 # cmake -G Ninja -DCMAKE_BUILD_TYPE=Release
10 # -C <llvm_src_root>/clang/cmake/caches/VectorEngine.cmake
11 # <llvm_src_root>/llvm-project/llvm
16 # Disable ZLIB, and ZSTD for VE since there is no pre-compiled libraries.
17 set(LLVM_ENABLE_ZLIB OFF CACHE BOOL "")
18 set(LLVM_ENABLE_ZSTD OFF CACHE BOOL "")
20 # Enable per-target runtimes directory
21 set(LLVM_ENABLE_PER_TARGET_RUNTIME_DIR On CACHE BOOL "")
23 # The lld is not supported for VE yet.
24 set(LLVM_ENABLE_PROJECTS "clang;clang-tools-extra" CACHE STRING "")
25 set(LLVM_ENABLE_RUNTIMES "compiler-rt;libcxx;libcxxabi;libunwind;openmp" CACHE STRING "")
27 # Compile for X86 and VE
28 set(LLVM_TARGETS_TO_BUILD "X86;VE" CACHE STRING "")
30 # Not use default here to use RUNTIMES_x86_64-unknown-linux-gnu_* variables.
31 set(LLVM_BUILTIN_TARGETS "x86_64-unknown-linux-gnu;ve-unknown-linux-gnu" CACHE STRING "")
32 set(LLVM_RUNTIME_TARGETS "x86_64-unknown-linux-gnu;ve-unknown-linux-gnu" CACHE STRING "")
34 # For the case of X86, we don't want to test compiler-rt for x86,
35 # so disable them as much as possible.
36 set(RUNTIMES_x86_64-unknown-linux-gnu_COMPILER_RT_BUILD_BUILTINS ON CACHE BOOL "")
37 set(RUNTIMES_x86_64-unknown-linux-gnu_COMPILER_RT_BUILD_CRT OFF CACHE BOOL "")
38 set(RUNTIMES_x86_64-unknown-linux-gnu_COMPILER_RT_BUILD_SANITIZERS OFF CACHE BOOL "")
39 set(RUNTIMES_x86_64-unknown-linux-gnu_COMPILER_RT_BUILD_XRAY OFF CACHE BOOL "")
40 set(RUNTIMES_x86_64-unknown-linux-gnu_COMPILER_RT_BUILD_LIBFUZZER OFF CACHE BOOL "")
41 set(RUNTIMES_x86_64-unknown-linux-gnu_COMPILER_RT_BUILD_CTX_PROFILE OFF CACHE BOOL "")
42 set(RUNTIMES_x86_64-unknown-linux-gnu_COMPILER_RT_BUILD_PROFILE OFF CACHE BOOL "")
43 set(RUNTIMES_x86_64-unknown-linux-gnu_COMPILER_RT_BUILD_MEMPROF OFF CACHE BOOL "")
44 set(RUNTIMES_x86_64-unknown-linux-gnu_COMPILER_RT_BUILD_ORC OFF CACHE BOOL "")
45 set(RUNTIMES_x86_64-unknown-linux-gnu_COMPILER_RT_BUILD_GWP_ASAN OFF CACHE BOOL "")
47 # VE supports builtins, crt, and profile only.
48 set(RUNTIMES_ve-unknown-linux-gnu_COMPILER_RT_BUILD_BUILTINS ON CACHE BOOL "")
49 set(RUNTIMES_ve-unknown-linux-gnu_COMPILER_RT_BUILD_CRT ON CACHE BOOL "")
50 set(RUNTIMES_ve-unknown-linux-gnu_COMPILER_RT_BUILD_SANITIZERS OFF CACHE BOOL "")
51 set(RUNTIMES_ve-unknown-linux-gnu_COMPILER_RT_BUILD_XRAY OFF CACHE BOOL "")
52 set(RUNTIMES_ve-unknown-linux-gnu_COMPILER_RT_BUILD_LIBFUZZER OFF CACHE BOOL "")
53 set(RUNTIMES_ve-unknown-linux-gnu_COMPILER_RT_BUILD_PROFILE ON CACHE BOOL "")
54 set(RUNTIMES_ve-unknown-linux-gnu_COMPILER_RT_BUILD_CTX_PROFILE OFF CACHE BOOL "")
55 set(RUNTIMES_ve-unknown-linux-gnu_COMPILER_RT_BUILD_MEMPROF OFF CACHE BOOL "")
56 set(RUNTIMES_ve-unknown-linux-gnu_COMPILER_RT_BUILD_ORC OFF CACHE BOOL "")
57 set(RUNTIMES_ve-unknown-linux-gnu_COMPILER_RT_BUILD_GWP_ASAN OFF CACHE BOOL "")
59 # VE uses builtins from Compiler-RT.
60 set(RUNTIMES_ve-unknown-linux-gnu_COMPILER_RT_USE_BUILTINS_LIBRARY TRUE CACHE BOOL "")
62 # VE uses libunwind and Compiler-RT from libcxxabi.
63 set(RUNTIMES_ve-unknown-linux-gnu_LIBCXXABI_USE_LLVM_UNWINDER TRUE CACHE BOOL "")
64 set(RUNTIMES_ve-unknown-linux-gnu_LIBCXXABI_USE_COMPILER_RT TRUE CACHE BOOL "")
66 # VE uses Compiler-RT from libcxx.
67 set(RUNTIMES_ve-unknown-linux-gnu_LIBCXX_USE_COMPILER_RT TRUE CACHE BOOL "")
69 # Pretended standalone build for OpenMP since OpenMP doesn't support
70 # LLVM_ENABLE_PER_TARGET_RUNTIME_DIR yet.
71 # - Use OPENMP_STANDALONE_BUILD
72 # - Define OPENMP_LIBDIR_SUFFIX to pretend per-target openmp directory
73 # - Define OPENMP_LLVM_TOOLS_DIR for test
74 set(RUNTIMES_x86_64-unknown-linux-gnu_OPENMP_STANDALONE_BUILD ON CACHE BOOL "")
75 set(RUNTIMES_ve-unknown-linux-gnu_OPENMP_STANDALONE_BUILD ON CACHE BOOL "")
77 # Specify LIBDIR_SUFFIX for OpenMP to install them at following directories.
78 # install/lib/clang/${VERSION}/lib/x86_64-unknown-linux-gnu
79 # install/lib/clang/${VERSION}/lib/ve-unknown-linux-gnu
80 set(RUNTIMES_x86_64-unknown-linux-gnu_OPENMP_LIBDIR_SUFFIX "/x86_64-unknown-linux-gnu" CACHE STRING "")
81 set(RUNTIMES_ve-unknown-linux-gnu_OPENMP_LIBDIR_SUFFIX "/ve-unknown-linux-gnu" CACHE STRING "")
83 # Specify OPENMP_LLVM_TOOLS_DIR for test
84 set(RUNTIMES_x86_64-unknown-linux-gnu_OPENMP_LLVM_TOOLS_DIR "${CMAKE_BINARY_DIR}/bin" CACHE STRING "")
85 set(RUNTIMES_ve-unknown-linux-gnu_OPENMP_LLVM_TOOLS_DIR "${CMAKE_BINARY_DIR}/bin" CACHE STRING "")
87 # VE doesn't support libomptarget. Disable it for x86_64 also.
88 set(RUNTIMES_x86_64-unknown-linux-gnu_OPENMP_ENABLE_LIBOMPTARGET FALSE CACHE BOOL "")
89 set(RUNTIMES_ve-unknown-linux-gnu_OPENMP_ENABLE_LIBOMPTARGET FALSE CACHE BOOL "")
91 # VE requires -lrt flag for shm_open.
92 set(RUNTIMES_ve-unknown-linux-gnu_LIBOMP_HAVE_SHM_OPEN_WITH_LRT TRUE CACHE BOOL "")
94 # Compiler flags for testing
95 set(RUNTIMES_ve-unknown-linux-gnu_COMPILER_RT_TEST_COMPILER_CFLAGS "--target=ve-unknown-linux-gnu" CACHE BOOL "")
96 set(RUNTIMES_ve-unknown-linux-gnu_LIBCXXABI_TEST_COMPILER_CFLAGS "--target=ve-unknown-linux-gnu" CACHE BOOL "")
97 set(RUNTIMES_ve-unknown-linux-gnu_LIBCXX_TEST_COMPILER_CFLAGS "--target=ve-unknown-linux-gnu" CACHE BOOL "")
98 set(RUNTIMES_ve-unknown-linux-gnu_LIBUNWIND_TEST_COMPILER_CFLAGS "--target=ve-unknown-linux-gnu" CACHE BOOL "")
99 set(RUNTIMES_ve-unknown-linux-gnu_OPENMP_TEST_OPENMP_FLAGS "--target=ve-unknown-linux-gnu -fopenmp -pthread -lrt -ldl -Wl,-rpath,${CMAKE_BINARY_DIR}/lib/ve-unknown-linux-gnu" CACHE BOOL "")
102 set(LLVM_INSTALL_TOOLCHAIN_ONLY ON CACHE BOOL "")
103 set(LLVM_TOOLCHAIN_TOOLS
122 set(LLVM_DISTRIBUTION_COMPONENTS
125 clang-resource-headers
128 ${LLVM_TOOLCHAIN_TOOLS}