aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/project/ci/cmake.py
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2021-01-25 01:19:44 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2021-01-25 01:27:18 +0300
commit2e6ab77866bbdef6abcc149ddc430b1d9481b4f7 (patch)
treea259154cfc51dfe983516ad6c76ecd78ecb7a7c0 /project/ci/cmake.py
parentbye-bye, Travis & AppVeyor! (diff)
downloadcmake-common-2e6ab77866bbdef6abcc149ddc430b1d9481b4f7.tar.gz
cmake-common-2e6ab77866bbdef6abcc149ddc430b1d9481b4f7.zip
project.ci: auto-detect CI system
Diffstat (limited to '')
-rw-r--r--project/ci/cmake.py20
1 files changed, 17 insertions, 3 deletions
diff --git a/project/ci/cmake.py b/project/ci/cmake.py
index 262aafa..ff21873 100644
--- a/project/ci/cmake.py
+++ b/project/ci/cmake.py
@@ -8,17 +8,19 @@ import logging
import os.path
import sys
+from project.ci.dirs import Dirs
from project.cmake.build import BuildParameters, build
from project.toolchain import ToolchainType
+from project.utils import setup_logging
-def _parse_args(dirs, 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=dirs.get_cmake_help(),
+ description=Dirs.get_cmake_help(),
formatter_class=argparse.RawDescriptionHelpFormatter)
parser.add_argument('--install', action='store_true',
@@ -36,12 +38,15 @@ def _parse_args(dirs, argv=None):
def build_ci(dirs, argv=None):
- args = _parse_args(dirs, argv)
+ args = _parse_args(argv)
+ if dirs is None:
+ dirs = Dirs.detect()
src_dir = dirs.get_src_dir()
if args.subdir:
src_dir = os.path.join(src_dir, args.subdir)
install_dir = dirs.get_install_dir() if args.install else None
+
params = BuildParameters(src_dir,
build_dir=dirs.get_cmake_dir(),
install_dir=install_dir,
@@ -51,3 +56,12 @@ def build_ci(dirs, argv=None):
toolset=args.toolset,
cmake_args=dirs.get_cmake_args() + args.cmake_args)
build(params)
+
+
+def main(argv=None):
+ with setup_logging():
+ build_ci(None, argv)
+
+
+if __name__ == '__main__':
+ main()