1
0
mirror of https://github.com/facebook/proxygen.git synced 2025-08-08 18:02:05 +03:00

Add argument to pass extra arguments to boost b2 build tool (#28)

Summary:
X-link: https://github.com/facebook/fb303/pull/28

X-link: https://github.com/facebook/fboss/pull/115

X-link: https://github.com/facebook/folly/pull/1736

Pull Request resolved: https://github.com/facebook/proxygen/pull/403

X-link: https://github.com/facebook/fbthrift/pull/488

This adds a way to pass arguments to the `b2` build tool, used by Boost. This is needed in order to link a getdeps built boost into an relocatable `.so`. The motivating use case is that we need to statically link Boost into a native library used by a python wheel, which must be relocatable. This functionality already exists for CMake-based projects.

Reviewed By: mackorone

Differential Revision: D34796774

fbshipit-source-id: 0d6a9f4703865dc02048b87e77394c44ef646af6
This commit is contained in:
David Greenberg
2022-03-14 09:19:39 -07:00
committed by Facebook GitHub Bot
parent 3d5f4f15ee
commit e6abe0844b
2 changed files with 15 additions and 0 deletions

View File

@@ -595,6 +595,8 @@ class BuildCmd(ProjectCmdBase):
else {} else {}
) )
extra_b2_args = args.extra_b2_args or []
if sources_changed or reconfigure or not os.path.exists(built_marker): if sources_changed or reconfigure or not os.path.exists(built_marker):
if os.path.exists(built_marker): if os.path.exists(built_marker):
os.unlink(built_marker) os.unlink(built_marker)
@@ -620,6 +622,7 @@ class BuildCmd(ProjectCmdBase):
loader, loader,
final_install_prefix=loader.get_project_install_prefix(m), final_install_prefix=loader.get_project_install_prefix(m),
extra_cmake_defines=extra_cmake_defines, extra_cmake_defines=extra_cmake_defines,
extra_b2_args=extra_b2_args,
) )
builder.build(install_dirs, reconfigure=reconfigure) builder.build(install_dirs, reconfigure=reconfigure)
@@ -760,6 +763,15 @@ class BuildCmd(ProjectCmdBase):
'e.g: \'{"CMAKE_CXX_FLAGS": "--bla"}\'' '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( parser.add_argument(
"--shared-libs", "--shared-libs",
help="Build shared libraries if possible", help="Build shared libraries if possible",

View File

@@ -466,6 +466,7 @@ class ManifestParser(object):
loader, loader,
final_install_prefix=None, final_install_prefix=None,
extra_cmake_defines=None, extra_cmake_defines=None,
extra_b2_args=None,
): ):
builder = self.get_builder_name(ctx) builder = self.get_builder_name(ctx)
build_in_src_dir = self.get("build", "build_in_src_dir", "false", ctx=ctx) build_in_src_dir = self.get("build", "build_in_src_dir", "false", ctx=ctx)
@@ -527,6 +528,8 @@ class ManifestParser(object):
if builder == "boost": if builder == "boost":
args = self.get_section_as_args("b2.args", ctx) 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) return Boost(build_options, ctx, self, src_dir, build_dir, inst_dir, args)
if builder == "bistro": if builder == "bistro":