aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/project/ci/cmake.py
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2020-03-30 11:56:05 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2020-03-30 12:03:37 +0300
commit98e3a56296cb9955e49adb09a111f26e07328338 (patch)
treebbbd6a464a809c00398bc12ef4cb472f92b30eab /project/ci/cmake.py
parentproject.cmake: make it --boost aware (diff)
downloadcmake-common-98e3a56296cb9955e49adb09a111f26e07328338.tar.gz
cmake-common-98e3a56296cb9955e49adb09a111f26e07328338.zip
project.ci: dedupe code
Diffstat (limited to '')
-rw-r--r--project/ci/cmake.py41
1 files changed, 41 insertions, 0 deletions
diff --git a/project/ci/cmake.py b/project/ci/cmake.py
new file mode 100644
index 0000000..6331e4b
--- /dev/null
+++ b/project/ci/cmake.py
@@ -0,0 +1,41 @@
+# Copyright (c) 2020 Egor Tensin <Egor.Tensin@gmail.com>
+# This file is part of the "cmake-common" project.
+# For details, see https://github.com/egor-tensin/cmake-common.
+# Distributed under the MIT License.
+
+import argparse
+import logging
+import sys
+
+from project.cmake.build import BuildParameters, build
+
+
+def _parse_args(dirs, argv=None):
+ if argv is None:
+ argv = sys.argv[1:]
+ logging.info('Command line arguments: %s', argv)
+
+ parser = argparse.ArgumentParser(
+ description=dirs.get_cmake_help(),
+ formatter_class=argparse.RawDescriptionHelpFormatter)
+
+ parser.add_argument('--install', metavar='DIR', dest='install_dir',
+ help='install directory')
+ parser.add_argument('--boost', metavar='DIR', dest='boost_dir',
+ help='set Boost directory path')
+ parser.add_argument('cmake_args', nargs='*', metavar='CMAKE_ARG', default=[],
+ help='additional CMake arguments, to be passed verbatim')
+ return parser.parse_args(argv)
+
+
+def build_ci(dirs, argv=None):
+ args = _parse_args(dirs, argv)
+
+ params = BuildParameters(dirs.get_src_dir(),
+ build_dir=dirs.get_build_dir(),
+ install_dir=args.install_dir,
+ platform=dirs.get_platform(),
+ configuration=dirs.get_configuration(),
+ boost_dir=args.boost_dir or dirs.get_boost_dir(),
+ cmake_args=dirs.get_cmake_args() + args.cmake_args)
+ build(params)