aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/project/cmake/build.py
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2020-03-28 19:19:22 +0000
committerEgor Tensin <Egor.Tensin@gmail.com>2020-03-28 23:54:28 +0000
commit8a408b4c95a5e6be2808ef9516bcbebddf8b09a6 (patch)
tree611639829cb54daabb7d536e5c11ffaadf5a03d5 /project/cmake/build.py
parentWIP: restructure (diff)
downloadcmake-common-8a408b4c95a5e6be2808ef9516bcbebddf8b09a6.tar.gz
cmake-common-8a408b4c95a5e6be2808ef9516bcbebddf8b09a6.zip
project.boost: factor out Configuration/Platform/Linkage
Diffstat (limited to 'project/cmake/build.py')
-rw-r--r--project/cmake/build.py21
1 files changed, 3 insertions, 18 deletions
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,