File: CMakeLists.txt

package info (click to toggle)
llvm-toolchain-13 1%3A13.0.1-6~deb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 1,418,812 kB
  • sloc: cpp: 5,290,827; ansic: 996,570; asm: 544,593; python: 188,212; objc: 72,027; lisp: 30,291; f90: 25,395; sh: 24,900; javascript: 9,780; pascal: 9,398; perl: 7,484; ml: 5,432; awk: 3,523; makefile: 2,892; xml: 953; cs: 573; fortran: 539
file content (44 lines) | stat: -rw-r--r-- 1,975 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
cmake_minimum_required(VERSION 3.13.4)
project(LLVM_RUNTIMES C CXX ASM)

find_package(Python3 COMPONENTS Interpreter)
if(NOT Python3_Interpreter_FOUND)
  message(WARNING "Python3 not found, using python2 as a fallback")
  find_package(Python2 COMPONENTS Interpreter REQUIRED)
  if(Python2_VERSION VERSION_LESS 2.7)
    message(SEND_ERROR "Python 2.7 or newer is required")
  endif()

  # Treat python2 as python3
  add_executable(Python3::Interpreter IMPORTED)
  set_target_properties(Python3::Interpreter PROPERTIES
    IMPORTED_LOCATION ${Python2_EXECUTABLE})
  set(Python3_EXECUTABLE ${Python2_EXECUTABLE})
endif()

# This needs to be set before we add any Lit target for `add_lit_target` to
# select the right Lit to run the tests.
set(LLVM_LIT_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/bin")

# Automatically define a few variables that are normally set globally by LLVM.
# This is to keep some amount of similarity between the global LLVM build and
# this minimal build.
set(LLVM_UMBRELLA_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/../../../..")
list(APPEND CMAKE_MODULE_PATH "${LLVM_UMBRELLA_ROOT}/libcxx/cmake/Modules")
include(HandleOutOfTreeLLVM)

# Override the external Lit to make sure we use the one we generate below.
# TODO: We can remove this once we start relying on the in-tree version of Lit
#       in HandleOutOfTreeLLVM.
set(LLVM_DEFAULT_EXTERNAL_LIT "")

# Include individual runtime projects
set(LLVM_ENABLE_PROJECTS "" CACHE STRING "Semicolon-separated list of runtimes to build.")
foreach(project IN LISTS LLVM_ENABLE_PROJECTS)
  add_subdirectory("${LLVM_UMBRELLA_ROOT}/${project}" "${CMAKE_CURRENT_BINARY_DIR}/${project}")
endforeach()

# Generate the llvm-lit wrapper, needed for testing. This must be done after
# the projects have been added, since the wraper is only generated correctly
# if the test suites have already been added with add_lit_target.
add_subdirectory("${LLVM_UMBRELLA_ROOT}/llvm/utils/llvm-lit" "${CMAKE_CURRENT_BINARY_DIR}/llvm-lit")