diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2019-12-14 03:46:03 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2019-12-15 00:49:01 +0300 |
commit | 86f069fe70a8ece2829953264ef372d0a661b454 (patch) | |
tree | 1f7f07caf7d52fa1a5aa0aa17def5742be1fdfc1 /ci/build_appveyor.py | |
parent | fix PyLint warnings (diff) | |
download | cmake-common-86f069fe70a8ece2829953264ef372d0a661b454.tar.gz cmake-common-86f069fe70a8ece2829953264ef372d0a661b454.zip |
build: clean up silly cmd line params
They were just plain synonyms for CMake flags, barely had any value.
Diffstat (limited to '')
-rwxr-xr-x | ci/build_appveyor.py | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/ci/build_appveyor.py b/ci/build_appveyor.py index 2d2ee65..56b4d4b 100755 --- a/ci/build_appveyor.py +++ b/ci/build_appveyor.py @@ -9,6 +9,7 @@ # the AppVeyor-defined environment variables. # The project is built in C:\Projects\build. +import argparse from enum import Enum import logging import os @@ -77,6 +78,11 @@ def _env(name): return os.environ[name] +def _check_appveyor(): + if 'APPVEYOR' not in os.environ: + raise RuntimeError('not running on AppVeyor') + + def _get_src_dir(): return _env('APPVEYOR_BUILD_FOLDER') @@ -104,18 +110,38 @@ def _setup_logging(): level=logging.INFO) -def build_appveyor(argv=None): +def _parse_args(argv=None): if argv is None: argv = sys.argv[1:] logging.info('Command line arguments: %s', argv) + + parser = argparse.ArgumentParser(description='Build a CMake project on AppVeyor') + parser.add_argument('--install', metavar='DIR', dest='install_dir', + help='install directory') + parser.add_argument('cmake_args', nargs='*', metavar='CMAKE_ARG', + help='additional CMake arguments, to be passed verbatim') + return parser.parse_args(argv) + + +def build_appveyor(argv=None): + args = _parse_args(argv) + _check_appveyor() + appveyor_argv = [ '--src', _get_src_dir(), '--build', _get_build_dir(), - '--generator', _get_generator(), - '--platform', _get_platform(), '--configuration', _get_configuration(), ] - build(appveyor_argv + argv) + if args.install_dir is not None: + appveyor_argv += [ + '--install', args.install_dir, + ] + appveyor_argv += [ + '--', + '-G', _get_generator(), + '-A', _get_platform(), + ] + build(appveyor_argv + args.cmake_args) def main(argv=None): |