diff options
-rw-r--r-- | .travis.yml | 6 | ||||
-rw-r--r-- | appveyor.yml | 6 | ||||
-rwxr-xr-x | boost/build/build.py | 34 | ||||
-rw-r--r-- | boost/build/ci/appveyor.py | 15 | ||||
-rwxr-xr-x | boost/build/ci/travis.py | 7 |
5 files changed, 58 insertions, 10 deletions
diff --git a/.travis.yml b/.travis.yml index 69205ff..8c325bb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -12,10 +12,10 @@ script: - ./boost/build/build.py download 1.58.0 - ./boost/build/build.py download --cache . 1.72.0 - - ./boost/build/build.py build --configuration Debug --platform x86 -- ./boost_1_58_0 --with-filesystem --with-program_options + - ./boost/build/build.py build --configuration Debug --platform x86 -- ./boost_1_58_0 --with-filesystem --with-program_options - find boost_1_58_0/stage -type f | sort - - ./boost/build/build.py build --configuration Debug Release --platform x86 x64 -- ./boost_1_72_0 link=static --with-filesystem --with-program_options + - ./boost/build/build.py build --configuration Debug Release --platform x86 x64 --link shared -- ./boost_1_72_0 --with-filesystem --with-program_options - find boost_1_72_0/stage -type f | sort - - travis_boost_version=1.65.0 configuration=Release platform=x64 ./boost/build/ci/travis.py -- --with-filesystem --with-program_options + - travis_boost_version=1.65.0 configuration=Release platform=x64 ./boost/build/ci/travis.py --link static -- --with-filesystem --with-program_options - find "$HOME/boost_1_65_0/stage" -type f | sort diff --git a/appveyor.yml b/appveyor.yml index 2c1497c..866ed06 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -12,10 +12,10 @@ build_script: - '"%python_exe%" ./boost/build/build.py download 1.58.0' - '"%python_exe%" ./boost/build/build.py download --cache . 1.72.0' - - '"%python_exe%" ./boost/build/build.py build --configuration Debug --platform x86 -- ./boost_1_58_0 --with-filesystem --with-program_options' + - '"%python_exe%" ./boost/build/build.py build --configuration Debug --platform x86 -- ./boost_1_58_0 --with-filesystem --with-program_options' - dir /a-D /S /B boost_1_58_0\stage - - '"%python_exe%" ./boost/build/build.py build --configuration Debug Release --platform x86 x64 -- ./boost_1_72_0 link=static --with-filesystem --with-program_options' + - '"%python_exe%" ./boost/build/build.py build --configuration Debug Release --platform x86 x64 --link shared -- ./boost_1_72_0 --with-filesystem --with-program_options' - dir /a-D /S /B boost_1_72_0\stage - - cmd: set "appveyor_boost_version=1.65.0" && set "CONFIGURATION=Release" && set "PLATFORM=x64" && "%python_exe%" ./boost/build/ci/appveyor.py -- --with-filesystem --with-program_options + - cmd: set "appveyor_boost_version=1.65.0" && set "CONFIGURATION=Release" && set "PLATFORM=x64" && "%python_exe%" ./boost/build/ci/appveyor.py --link static -- --with-filesystem --with-program_options - dir /a-D /S /B C:\boost_1_65_0\stage diff --git a/boost/build/build.py b/boost/build/build.py index 02ab9b0..e04aa30 100755 --- a/boost/build/build.py +++ b/boost/build/build.py @@ -100,6 +100,25 @@ def _parse_configuration(s): raise argparse.ArgumentTypeError(f'invalid configuration: {s}') +class Link(Enum): + STATIC = 'static' + SHARED = 'shared' + + @staticmethod + def all(): + return tuple(Link) + + def __str__(self): + return self.value + + +def _parse_link(s): + try: + return Link(s) + except ValueError: + raise argparse.ArgumentTypeError(f'invalid linkage: {s}') + + Version = namedtuple('Version', ['major', 'minor', 'patch']) @@ -303,6 +322,7 @@ class BoostBuild: def __init__(self, args): self.platforms = args.platforms or Platform.all() self.configurations = args.configurations or Configuration.all() + self.link = args.link or Link.all() self.stage_dir = 'stage' @@ -316,6 +336,7 @@ class BoostBuild: for platform in self.platforms: platform_params = [f'--build-dir={build_dir}'] platform_params.append(self._address_model(platform)) + platform_params.append(self._linkage()) platform_params += self.b2_args if _on_windows(): platform_params.append(self._windows_stagedir(platform)) @@ -343,6 +364,10 @@ class BoostBuild: logging.info('Removing build directory: %s', build_dir) return + def _linkage(self): + link = ','.join(map(str, self.link)) + return f'link={link}' + @staticmethod def _address_model(platform): return f'address-model={platform.get_address_model()}' @@ -389,6 +414,8 @@ def _parse_args(argv=None): build = subparsers.add_parser('build', help='build Boost libraries') + # These are used to put the built libraries into proper stage/ + # subdirectories (to avoid name clashes). build.add_argument('--platform', metavar='PLATFORM', nargs='*', dest='platforms', default=[], type=_parse_platform, @@ -397,6 +424,13 @@ def _parse_args(argv=None): nargs='*', dest='configurations', default=[], type=_parse_configuration, help='target configuration (e.g. Debug/Release)') + # This is needed because the default behaviour on Linux and Windows is + # different: static & dynamic libs are built on Linux, but only static libs + # are built on Windows by default. + build.add_argument('--link', metavar='LINKAGE', + nargs='*', default=[], + type=_parse_link, + help='how the libraries are linked (i.e. static/shared)') build.add_argument('--build', metavar='DIR', dest='build_dir', type=_parse_dir, diff --git a/boost/build/ci/appveyor.py b/boost/build/ci/appveyor.py index 3f8d0cd..e6a330d 100644 --- a/boost/build/ci/appveyor.py +++ b/boost/build/ci/appveyor.py @@ -56,6 +56,8 @@ def _parse_args(argv=None): logging.info('Command line arguments: %s', argv) parser = argparse.ArgumentParser() + parser.add_argument('--link', metavar='LINKAGE', nargs='*', + help='how the libraries are linked (i.e. static/shared)') parser.add_argument('b2_args', nargs='*', metavar='B2_ARG', default=[], help='additional b2 arguments, to be passed verbatim') return parser.parse_args(argv) @@ -71,20 +73,25 @@ def build_appveyor(argv=None): from build import BoostVersion, main as build_main version = BoostVersion.from_string(_get_boost_version()) - travis_argv = [ + appveyor_argv = [ 'download', '--unpack', _get_build_dir(), '--', str(version) ] - build_main(travis_argv) + build_main(appveyor_argv) - travis_argv = [ + appveyor_argv = [ 'build', '--configuration', _get_configuration(), '--platform', _get_platform(), + ] + if args.link is not None: + appveyor_argv.append('--link') + appveyor_argv += args.link + appveyor_argv += [ '--', version.dir_path(_get_build_dir()), ] - build_main(travis_argv + args.b2_args) + build_main(appveyor_argv + args.b2_args) def main(argv=None): diff --git a/boost/build/ci/travis.py b/boost/build/ci/travis.py index d5d00eb..74ba29f 100755 --- a/boost/build/ci/travis.py +++ b/boost/build/ci/travis.py @@ -54,6 +54,8 @@ def _parse_args(argv=None): logging.info('Command line arguments: %s', argv) parser = argparse.ArgumentParser() + parser.add_argument('--link', metavar='LINKAGE', nargs='*', + help='how the libraries are linked (i.e. static/shared)') parser.add_argument('b2_args', nargs='*', metavar='B2_ARG', default=[], help='additional b2 arguments, to be passed verbatim') return parser.parse_args(argv) @@ -80,6 +82,11 @@ def build_travis(argv=None): 'build', '--configuration', _get_configuration(), '--platform', _get_platform(), + ] + if args.link is not None: + travis_argv.append('--link') + travis_argv += args.link + travis_argv += [ '--', version.dir_path(_get_build_dir()), ] build_main(travis_argv + args.b2_args) |