From 8a408b4c95a5e6be2808ef9516bcbebddf8b09a6 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Sat, 28 Mar 2020 19:19:22 +0000 Subject: project.boost: factor out Configuration/Platform/Linkage --- project/cmake/build.py | 21 +++------------------ 1 file changed, 3 insertions(+), 18 deletions(-) (limited to 'project/cmake/build.py') diff --git a/project/cmake/build.py b/project/cmake/build.py index 695489b..89ac6da 100644 --- a/project/cmake/build.py +++ b/project/cmake/build.py @@ -43,6 +43,8 @@ import subprocess import sys import tempfile +from project.configuration import Configuration + def _run_executable(cmd_line): logging.info('Running executable: %s', cmd_line) @@ -53,23 +55,6 @@ def _run_cmake(cmake_args): _run_executable(['cmake'] + cmake_args) -class Configuration(Enum): - DEBUG = 'Debug' - MINSIZEREL = 'MinSizeRel' - RELWITHDEBINFO = 'RelWithDebInfo' - RELEASE = 'Release' - - def __str__(self): - return self.value - - -def _parse_configuration(s): - try: - return Configuration(s) - except ValueError: - raise argparse.ArgumentTypeError(f'invalid configuration: {s}') - - @contextmanager def _create_build_dir(args): if args.build_dir is not None: @@ -151,7 +136,7 @@ def _parse_args(argv=None): type=_parse_dir, help='install directory') parser.add_argument('--configuration', metavar='CONFIG', - type=_parse_configuration, default=Configuration.DEBUG, + type=Configuration.parse, default=Configuration.DEBUG, help=f'build configuration ({"/".join(map(str, Configuration))})') parser.add_argument('src_dir', metavar='DIR', type=_parse_dir, -- cgit v1.2.3