aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/project/ci
diff options
context:
space:
mode:
Diffstat (limited to 'project/ci')
-rw-r--r--project/ci/cmake.py8
-rw-r--r--project/ci/dirs.py17
-rw-r--r--project/ci/github/__init__.py0
-rw-r--r--project/ci/github/boost.py17
-rw-r--r--project/ci/github/cmake.py17
5 files changed, 58 insertions, 1 deletions
diff --git a/project/ci/cmake.py b/project/ci/cmake.py
index 67ad13a..262aafa 100644
--- a/project/ci/cmake.py
+++ b/project/ci/cmake.py
@@ -5,6 +5,7 @@
import argparse
import logging
+import os.path
import sys
from project.cmake.build import BuildParameters, build
@@ -27,6 +28,8 @@ def _parse_args(dirs, argv=None):
parser.add_argument('--toolset', metavar='TOOLSET',
type=ToolchainType.parse,
help='toolset to use')
+ parser.add_argument('--subdir', metavar='DIR',
+ help='relative project 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)
@@ -35,8 +38,11 @@ def _parse_args(dirs, argv=None):
def build_ci(dirs, argv=None):
args = _parse_args(dirs, argv)
+ 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(dirs.get_src_dir(),
+ params = BuildParameters(src_dir,
build_dir=dirs.get_cmake_dir(),
install_dir=install_dir,
platform=dirs.get_platform(),
diff --git a/project/ci/dirs.py b/project/ci/dirs.py
index 4e61015..6c6de65 100644
--- a/project/ci/dirs.py
+++ b/project/ci/dirs.py
@@ -100,3 +100,20 @@ class AppVeyor(Dirs):
def get_cmake_args(self):
return ['-G', str(Generator.from_image(Image.get()))]
+
+
+class GitHub(Dirs):
+ def get_platform(self):
+ return Platform.parse(env('platform'))
+
+ def get_configuration(self):
+ return Configuration.parse(env('configuration'))
+
+ def get_src_dir(self):
+ return env('GITHUB_WORKSPACE')
+
+ def get_build_dir(self):
+ return os.path.dirname(env('GITHUB_WORKSPACE'))
+
+ def get_cmake_args(self):
+ return []
diff --git a/project/ci/github/__init__.py b/project/ci/github/__init__.py
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/project/ci/github/__init__.py
diff --git a/project/ci/github/boost.py b/project/ci/github/boost.py
new file mode 100644
index 0000000..5fd1e48
--- /dev/null
+++ b/project/ci/github/boost.py
@@ -0,0 +1,17 @@
+# Copyright (c) 2019 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.
+
+from project.ci.boost import build_ci
+from project.ci.dirs import GitHub
+from project.utils import setup_logging
+
+
+def main(argv=None):
+ with setup_logging():
+ build_ci(GitHub(), argv)
+
+
+if __name__ == '__main__':
+ main()
diff --git a/project/ci/github/cmake.py b/project/ci/github/cmake.py
new file mode 100644
index 0000000..9b9c7b9
--- /dev/null
+++ b/project/ci/github/cmake.py
@@ -0,0 +1,17 @@
+# Copyright (c) 2019 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.
+
+from project.ci.cmake import build_ci
+from project.ci.dirs import GitHub
+from project.utils import setup_logging
+
+
+def main(argv=None):
+ with setup_logging():
+ build_ci(GitHub(), argv)
+
+
+if __name__ == '__main__':
+ main()