Skip to content

Commit 70e8771

Browse files
authored
Merge pull request #62162 from drexin/wip-102476062
[Build] Use llvm-cmake-flags in llvm build-script product
2 parents 9f34fa3 + 55c0084 commit 70e8771

File tree

4 files changed

+12
-0
lines changed

4 files changed

+12
-0
lines changed

utils/build_swift/build_swift/driver_arguments.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1250,6 +1250,12 @@ def create_argument_parser():
12501250
option('--no-llvm-include-tests', toggle_false('llvm_include_tests'),
12511251
help='do not generate testing targets for LLVM')
12521252

1253+
option('--llvm-cmake-options', append,
1254+
type=argparse.ShellSplitType(),
1255+
help='CMake options used for llvm in the form of comma '
1256+
'separated options "-DCMAKE_VAR1=YES,-DCMAKE_VAR2=/tmp". Can '
1257+
'be called multiple times to add multiple such options.')
1258+
12531259
# -------------------------------------------------------------------------
12541260
in_group('Build settings for Android')
12551261

utils/build_swift/tests/expected_options.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,7 @@
201201
'lldb_build_with_xcode': '0',
202202
'llvm_assertions': True,
203203
'llvm_build_variant': 'Debug',
204+
'llvm_cmake_options': [],
204205
'llvm_enable_modules': False,
205206
'llvm_include_tests': True,
206207
'llvm_ninja_targets': [],
@@ -758,6 +759,7 @@ class BuildScriptImplOption(_BaseOption):
758759
AppendOption('--test-paths'),
759760
AppendOption('--llvm-ninja-targets'),
760761
AppendOption('--llvm-ninja-targets-for-cross-compile-hosts'),
762+
AppendOption('--llvm-cmake-options'),
761763
AppendOption('--darwin-symroot-path-filters'),
762764

763765
UnsupportedOption('--build-jobs'),

utils/swift_build_support/swift_build_support/cmake.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ def extend(self, tuples_or_options):
6161
for (variable, value) in tuples_or_options:
6262
self.define(variable, value)
6363

64+
def extend_raw(self, option_strings):
65+
self._options.extend(option_strings)
66+
6467
@staticmethod
6568
def true_false(value):
6669
if hasattr(value, 'lower'):

utils/swift_build_support/swift_build_support/products/llvm.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,7 @@ def build(self, host_target):
202202
(platform, arch) = host_target.split('-')
203203

204204
llvm_cmake_options = self.host_cmake_options(host_target)[0]
205+
llvm_cmake_options.extend_raw(self.args.llvm_cmake_options)
205206

206207
# TODO: handle cross compilation
207208
llvm_cmake_options.define('CMAKE_INSTALL_PREFIX:PATH', self.args.install_prefix)

0 commit comments

Comments
 (0)