Skip to content

[Build] Use llvm-cmake-flags in llvm build-script product #62162

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions utils/build_swift/build_swift/driver_arguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -1250,6 +1250,12 @@ def create_argument_parser():
option('--no-llvm-include-tests', toggle_false('llvm_include_tests'),
help='do not generate testing targets for LLVM')

option('--llvm-cmake-options', append,
type=argparse.ShellSplitType(),
help='CMake options used for llvm in the form of comma '
'separated options "-DCMAKE_VAR1=YES,-DCMAKE_VAR2=/tmp". Can '
'be called multiple times to add multiple such options.')

# -------------------------------------------------------------------------
in_group('Build settings for Android')

Expand Down
2 changes: 2 additions & 0 deletions utils/build_swift/tests/expected_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@
'lldb_build_with_xcode': '0',
'llvm_assertions': True,
'llvm_build_variant': 'Debug',
'llvm_cmake_options': [],
'llvm_enable_modules': False,
'llvm_include_tests': True,
'llvm_ninja_targets': [],
Expand Down Expand Up @@ -758,6 +759,7 @@ class BuildScriptImplOption(_BaseOption):
AppendOption('--test-paths'),
AppendOption('--llvm-ninja-targets'),
AppendOption('--llvm-ninja-targets-for-cross-compile-hosts'),
AppendOption('--llvm-cmake-options'),
AppendOption('--darwin-symroot-path-filters'),

UnsupportedOption('--build-jobs'),
Expand Down
3 changes: 3 additions & 0 deletions utils/swift_build_support/swift_build_support/cmake.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ def extend(self, tuples_or_options):
for (variable, value) in tuples_or_options:
self.define(variable, value)

def extend_raw(self, option_strings):
self._options.extend(option_strings)

@staticmethod
def true_false(value):
if hasattr(value, 'lower'):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ def build(self, host_target):
(platform, arch) = host_target.split('-')

llvm_cmake_options = self.host_cmake_options(host_target)[0]
llvm_cmake_options.extend_raw(self.args.llvm_cmake_options)

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