llvm-project

Форк
0
/
HandleOutOfTreeLLVM.cmake 
80 строк · 2.8 Кб
1
if (NOT DEFINED LLVM_PATH)
2
  set(LLVM_PATH ${CMAKE_CURRENT_LIST_DIR}/../../llvm CACHE PATH "" FORCE)
3
endif()
4

5
if(NOT IS_DIRECTORY ${LLVM_PATH})
6
  message(FATAL_ERROR
7
    "The provided LLVM_PATH (${LLVM_PATH}) is not a valid directory. Note that "
8
    "building libc++ outside of the monorepo is not supported anymore. Please "
9
    "use a Standalone build against the monorepo, a Runtimes build or a classic "
10
    "monorepo build.")
11
endif()
12

13
set(LLVM_INCLUDE_DIR ${LLVM_PATH}/include CACHE PATH "Path to llvm/include")
14
set(LLVM_PATH ${LLVM_PATH} CACHE PATH "Path to LLVM source tree")
15
set(LLVM_MAIN_SRC_DIR ${LLVM_PATH})
16
set(LLVM_CMAKE_DIR "${LLVM_PATH}/cmake/modules")
17
set(LLVM_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
18
set(LLVM_LIBRARY_OUTPUT_INTDIR "${CMAKE_CURRENT_BINARY_DIR}/lib")
19

20
if (EXISTS "${LLVM_CMAKE_DIR}")
21
  list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_DIR}")
22
elseif (EXISTS "${LLVM_MAIN_SRC_DIR}/cmake/modules")
23
  list(APPEND CMAKE_MODULE_PATH "${LLVM_MAIN_SRC_DIR}/cmake/modules")
24
else()
25
  message(FATAL_ERROR "Neither ${LLVM_CMAKE_DIR} nor ${LLVM_MAIN_SRC_DIR}/cmake/modules found. "
26
                      "This is not a supported configuration.")
27
endif()
28

29
message(STATUS "Configuring for standalone build.")
30

31
# By default, we target the host, but this can be overridden at CMake invocation time.
32
include(GetHostTriple)
33
get_host_triple(LLVM_INFERRED_HOST_TRIPLE)
34
set(LLVM_HOST_TRIPLE "${LLVM_INFERRED_HOST_TRIPLE}" CACHE STRING "Host on which LLVM binaries will run")
35
set(LLVM_DEFAULT_TARGET_TRIPLE "${LLVM_HOST_TRIPLE}" CACHE STRING "Target triple used by default.")
36

37
# Add LLVM Functions --------------------------------------------------------
38
if (WIN32)
39
  set(LLVM_ON_UNIX 0)
40
  set(LLVM_ON_WIN32 1)
41
else()
42
  set(LLVM_ON_UNIX 1)
43
  set(LLVM_ON_WIN32 0)
44
endif()
45

46
include(AddLLVM OPTIONAL)
47

48
# LLVM Options --------------------------------------------------------------
49
if (NOT DEFINED LLVM_INCLUDE_TESTS)
50
  set(LLVM_INCLUDE_TESTS ON)
51
endif()
52
if (NOT DEFINED LLVM_INCLUDE_DOCS)
53
  set(LLVM_INCLUDE_DOCS ON)
54
endif()
55
if (NOT DEFINED LLVM_ENABLE_SPHINX)
56
  set(LLVM_ENABLE_SPHINX OFF)
57
endif()
58

59
if (LLVM_INCLUDE_TESTS)
60
  # Required LIT Configuration ------------------------------------------------
61
  # Define the default arguments to use with 'lit', and an option for the user
62
  # to override.
63
  set(LLVM_DEFAULT_EXTERNAL_LIT "${LLVM_MAIN_SRC_DIR}/utils/lit/lit.py")
64
  set(LIT_ARGS_DEFAULT "-sv --show-xfail --show-unsupported")
65
  if (MSVC OR XCODE)
66
    set(LIT_ARGS_DEFAULT "${LIT_ARGS_DEFAULT} --no-progress-bar")
67
  endif()
68
  set(LLVM_LIT_ARGS "${LIT_ARGS_DEFAULT}" CACHE STRING "Default options for lit")
69
endif()
70

71
# Required doc configuration
72
if (LLVM_ENABLE_SPHINX)
73
  find_package(Sphinx REQUIRED)
74
endif()
75

76
if (LLVM_ON_UNIX AND NOT APPLE)
77
  set(LLVM_HAVE_LINK_VERSION_SCRIPT 1)
78
else()
79
  set(LLVM_HAVE_LINK_VERSION_SCRIPT 0)
80
endif()
81

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.