diff --git a/build/fbcode_builder/getdeps.py b/build/fbcode_builder/getdeps.py index a4ae0cbfbb..58387232e9 100755 --- a/build/fbcode_builder/getdeps.py +++ b/build/fbcode_builder/getdeps.py @@ -595,6 +595,8 @@ def run_project_cmd(self, args, loader, manifest): else {} ) + extra_b2_args = args.extra_b2_args or [] + if sources_changed or reconfigure or not os.path.exists(built_marker): if os.path.exists(built_marker): os.unlink(built_marker) @@ -620,6 +622,7 @@ def run_project_cmd(self, args, loader, manifest): loader, final_install_prefix=loader.get_project_install_prefix(m), extra_cmake_defines=extra_cmake_defines, + extra_b2_args=extra_b2_args, ) builder.build(install_dirs, reconfigure=reconfigure) @@ -760,6 +763,15 @@ def setup_project_cmd_parser(self, parser): 'e.g: \'{"CMAKE_CXX_FLAGS": "--bla"}\'' ), ) + parser.add_argument( + "--extra-b2-args", + help=( + "Repeatable argument that contains extra arguments to pass " + "to b2, which compiles boost. " + "e.g.: 'cxxflags=-fPIC' 'cflags=-fPIC'" + ), + action="append", + ) parser.add_argument( "--shared-libs", help="Build shared libraries if possible", diff --git a/build/fbcode_builder/getdeps/manifest.py b/build/fbcode_builder/getdeps/manifest.py index 705c2af4c7..b9e29fa4ec 100644 --- a/build/fbcode_builder/getdeps/manifest.py +++ b/build/fbcode_builder/getdeps/manifest.py @@ -466,6 +466,7 @@ def create_builder( # noqa:C901 loader, final_install_prefix=None, extra_cmake_defines=None, + extra_b2_args=None, ): builder = self.get_builder_name(ctx) build_in_src_dir = self.get("build", "build_in_src_dir", "false", ctx=ctx) @@ -527,6 +528,8 @@ def create_builder( # noqa:C901 if builder == "boost": args = self.get_section_as_args("b2.args", ctx) + if extra_b2_args is not None: + args += extra_b2_args return Boost(build_options, ctx, self, src_dir, build_dir, inst_dir, args) if builder == "bistro":