Boost: fix logic for controlling which libs build on Windows (#46414)

Older builds of Boost were failing on Windows because they were
adding --without-... flags for libraries that did not exist in those
versions. So:

* lib variants are updated with version range info (current range
  info for libs is not comprehensive, but represents changes over the
  last few minor versions up to 1.85)
* On Windows, --without-... options are omitted for libraries when they
  don't exist for the version of boost being built. Non-Windows uses
  a different approach, which was not affected because the new libraries
  were not activated by default. It would benefit from similar attention
  though to avoid potential future issues.
This commit is contained in:
James Smillie 2024-10-18 15:37:41 -06:00 committed by GitHub
parent df6427d259
commit 899004e29a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -154,8 +154,12 @@ class Boost(Package):
"wave",
]
# Add any extra requirements for specific
all_libs_opts = {"charconv": {"when": "@1.85.0:"}, "cobalt": {"when": "@1.84.0:"}}
for lib in all_libs:
variant(lib, default=False, description="Compile with {0} library".format(lib))
lib_opts = all_libs_opts.get(lib, {})
variant(lib, default=False, description="Compile with {0} library".format(lib), **lib_opts)
@property
def libs(self):
@ -624,9 +628,13 @@ def determine_b2_options(self, spec, options):
options.append("runtime-link=shared")
else:
options.append("runtime-link=static")
# Any lib that is in self.all_libs AND in the variants dictionary
# AND is set to False should be added to options in a --without flag
for lib in self.all_libs:
if f"+{lib}" not in spec:
options.append(f"--without-{lib}")
if lib not in self.spec.variants.dict or self.spec.satisfies(f"+{lib}"):
continue
options.append(f"--without-{lib}")
if not spec.satisfies("@:1.75 %intel") and not spec.satisfies("platform=windows"):
# When building any version >= 1.76, the toolset must be specified.