-
Notifications
You must be signed in to change notification settings - Fork 10.5k
/
Copy pathlit.site.cfg.in
135 lines (109 loc) · 4.87 KB
/
lit.site.cfg.in
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
# lit.site.cfg.in - Local configuration for the 'lit' test runner -*- python -*-
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.txt for license information
# See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
#
# -----------------------------------------------------------------------------
import os
import platform
import sys
config.cmake = "@CMAKE_COMMAND@"
config.llvm_src_root = "@LLVM_MAIN_SRC_DIR@"
config.llvm_obj_root = "@LLVM_BINARY_DIR@"
config.llvm_tools_dir = "@LLVM_TOOLS_DIR@"
config.llvm_libs_dir = "@LLVM_LIBS_DIR@"
config.llvm_code_generators = "@LLVM_TARGETS_TO_BUILD@".split(";")
config.lit_tools_dir = "@LLVM_LIT_TOOLS_DIR@"
config.swift_src_root = lit_config.params.get("swift_src_root", "@SWIFT_SOURCE_DIR@")
config.swift_obj_root = "@SWIFT_BINARY_DIR@"
config.target_triple = "@TARGET_TRIPLE@"
config.variant_triple = "@VARIANT_TRIPLE@"
config.variant_sdk = "@VARIANT_SDK@"
config.variant_suffix = "@VARIANT_SUFFIX@"
config.swiftlib_dir = "@LIT_SWIFTLIB_DIR@"
config.swift_test_results_dir = \
lit_config.params.get("swift_test_results_dir", "@SWIFT_TEST_RESULTS_DIR@")
config.coverage_mode = "@SWIFT_ANALYZE_CODE_COVERAGE@"
config.lldb_build_root = "@LLDB_BUILD_DIR@"
config.libdispatch_build_path = "@SWIFT_PATH_TO_LIBDISPATCH_BUILD@"
config.swift_driver_test_options = "@SWIFT_DRIVER_TEST_OPTIONS@"
config.swift_frontend_test_options = "@SWIFT_FRONTEND_TEST_OPTIONS@"
# --- Darwin ---
config.darwin_xcrun_toolchain = "@SWIFT_DARWIN_XCRUN_TOOLCHAIN@"
# --- android ---
config.android_ndk_path = "@SWIFT_ANDROID_NDK_PATH@"
config.android_ndk_gcc_version = "@SWIFT_ANDROID_NDK_GCC_VERSION@"
config.android_api_level = "@SWIFT_ANDROID_API_LEVEL@"
# --- Windows ---
msvc_runtime_flags = {
'MultiThreaded': 'MT',
'MultiThreadedDebug': 'MTd',
'MultiThreadedDLL': 'MD',
'MultiThreadedDebugDLL': 'MDd',
}
config.swift_stdlib_msvc_runtime = \
msvc_runtime_flags["@SWIFT_STDLIB_MSVC_RUNTIME_LIBRARY@"]
config.darwin_enable_maccatalyst = "@SWIFT_ENABLE_MACCATALYST@" == "TRUE"
config.darwin_maccatalyst_build_flavor = "@BUILD_FLAVOR@"
config.darwin_osx_variant_suffix = "@DEFAULT_OSX_VARIANT_SUFFIX@"
# Please remember to handle empty strings and/or unset variables correctly.
if "@SWIFT_ASAN_BUILD@" == "TRUE":
config.available_features.add("asan")
else:
config.available_features.add('no_asan')
if "@SWIFT_RUNTIME_ENABLE_LEAK_CHECKER@" == "TRUE":
config.available_features.add('leak-checker')
if '@SWIFT_TOOLS_ENABLE_LTO@'.lower() in ['full', 'thin']:
config.available_features.add('lto')
else:
config.available_features.add('no_lto')
if "@LLVM_ENABLE_ASSERTIONS@" == "TRUE":
config.available_features.add('asserts')
else:
config.available_features.add('no_asserts')
if "@SWIFT_STDLIB_ASSERTIONS@" == "TRUE":
config.available_features.add('swift_stdlib_asserts')
else:
config.available_features.add('swift_stdlib_no_asserts')
if "@SWIFT_OPTIMIZED@" == "TRUE":
config.available_features.add("optimized_stdlib")
if "@SWIFT_STDLIB_SINGLE_THREADED_RUNTIME@" == "TRUE":
config.available_features.add("single_threaded_runtime")
if "@SWIFT_ENABLE_RUNTIME_FUNCTION_COUNTERS@" == "TRUE":
config.available_features.add('runtime_function_counters')
if "@CMAKE_GENERATOR@" == "Xcode":
xcode_bin_dir = os.path.join(config.llvm_obj_root, "@LLVM_BUILD_TYPE@",
'bin')
lit_config.note('Adding to path: ' + xcode_bin_dir)
config.environment['PATH'] = \
os.path.pathsep.join((xcode_bin_dir, config.environment['PATH']))
config.available_features.add("CMAKE_GENERATOR=@CMAKE_GENERATOR@")
if "@SWIFT_ENABLE_MACCATALYST@" == "TRUE":
config.available_features.add('maccatalyst_support')
if "@SWIFT_BUILD_SYNTAXPARSERLIB@" == "TRUE":
config.available_features.add('syntax_parser_lib')
if "@SWIFT_ENABLE_SOURCEKIT_TESTS@" == "TRUE":
config.available_features.add('sourcekit')
if "@SWIFT_HAVE_LIBXML2@" == "TRUE":
config.available_features.add('libxml2')
if "@SWIFT_USE_LINKER@" == "lld":
config.android_linker_name = "lld"
else:
# even if SWIFT_USE_LINKER isn't set, we cannot use BFD for Android
config.android_linker_name = "gold"
if '@SWIFT_INCLUDE_TOOLS@' == 'TRUE':
config.available_features.add('swift_tools_extra')
if "@SWIFT_ENABLE_EXPERIMENTAL_DIFFERENTIABLE_PROGRAMMING@" == "TRUE":
config.available_features.add('differentiable_programming')
if "@SWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY@" == "TRUE":
config.available_features.add('concurrency')
# Let the main config do the real work.
if config.test_exec_root is None:
config.test_exec_root = os.path.dirname(os.path.realpath(__file__))
lit_config.load_config(
config, os.path.join(config.swift_src_root, "test", "lit.cfg"))