aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2021-01-18 14:39:19 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2021-01-18 14:46:35 +0300
commit00d21c8d6d202375761f332084e01661241376a9 (patch)
tree79c6cc2e03ecfbadee367362e7277af0444b3237
parentREADME: update (diff)
downloadcmake-common-00d21c8d6d202375761f332084e01661241376a9.tar.gz
cmake-common-00d21c8d6d202375761f332084e01661241376a9.zip
project.ci: --install picks the directory automatically
-rw-r--r--.ci/Makefile16
-rw-r--r--.github/workflows/ci_appveyor.yml5
-rw-r--r--.github/workflows/ci_travis.yml5
-rw-r--r--project/ci/cmake.py7
-rw-r--r--project/ci/dirs.py5
5 files changed, 24 insertions, 14 deletions
diff --git a/.ci/Makefile b/.ci/Makefile
index 86be651..b8e614a 100644
--- a/.ci/Makefile
+++ b/.ci/Makefile
@@ -58,7 +58,7 @@ python := python3
endif
ifeq ($(windows),1)
-install_prefix = C:/install
+install_prefix := C:/install
else
install_prefix := $$HOME/install
endif
@@ -316,7 +316,9 @@ boost/65/ls: echo/boost/65/ls
.PHONY: boost/65/exe/build
boost/65/exe/build: echo/boost/65/exe/build
- TRAVIS_BUILD_DIR="$$TRAVIS_BUILD_DIR/examples/boost" "$(python)" -m project.ci.travis.cmake --install "$(install_prefix)/boost_1_65_0"
+ TRAVIS_BUILD_DIR="$$TRAVIS_BUILD_DIR/examples/boost" "$(python)" -m project.ci.travis.cmake --install
+
+ci_install_dir := $$HOME/install
endif
ifdef APPVEYOR
.PHONY: boost/65/build
@@ -329,20 +331,22 @@ boost/65/ls: echo/boost/65/ls
.PHONY: boost/65/exe/build
boost/65/exe/build: echo/boost/65/exe/build
- set "APPVEYOR_BUILD_FOLDER=%APPVEYOR_BUILD_FOLDER%\examples\boost" && "$(python)" -m project.ci.appveyor.cmake --install "$(install_prefix)/boost_1_65_0"
+ set "APPVEYOR_BUILD_FOLDER=%APPVEYOR_BUILD_FOLDER%\examples\boost" && "$(python)" -m project.ci.appveyor.cmake --install
+
+ci_install_dir := C:/projects/install
endif
.PHONY: boost/65/exe/run
boost/65/exe/run: echo/boost/65/exe/run
- "$(install_prefix)/boost_1_65_0/bin/foo"
+ "$(ci_install_dir)/bin/foo"
.PHONY: boost/65/exe/arch
boost/65/exe/arch: echo/boost/65/exe/arch
- $(verify_arch) "$(install_prefix)/boost_1_65_0/bin/foo$(exe_ext)" x64
+ $(verify_arch) "$(ci_install_dir)/bin/foo$(exe_ext)" x64
.PHONY: boost/65/exe/symbols
boost/65/exe/symbols: echo/boost/65/exe/symbols
- $(verify_symbols) "$(install_prefix)/boost_1_65_0/bin/foo$(exe_ext)"
+ $(verify_symbols) "$(ci_install_dir)/bin/foo$(exe_ext)"
.PHONY: boost/65/exe
boost/65/exe: boost/65/exe/build boost/65/exe/run boost/65/exe/arch boost/65/exe/symbols
diff --git a/.github/workflows/ci_appveyor.yml b/.github/workflows/ci_appveyor.yml
index 3033607..8427e43 100644
--- a/.github/workflows/ci_appveyor.yml
+++ b/.github/workflows/ci_appveyor.yml
@@ -57,11 +57,12 @@ jobs:
- name: Build example project
run: |
- python -m project.ci.appveyor.cmake --install ..\install
+ python -m project.ci.appveyor.cmake --install
- name: Run example project
run: |
- $foo_path = Join-Path (Split-Path (Get-Location).Path) install bin foo.exe
+ cd C:\projects\install\bin
+ $foo_path = Join-Path (Get-Location).Path foo.exe
$relative = 'test.txt'
$absolute = Join-Path (Get-Location).Path $relative
diff --git a/.github/workflows/ci_travis.yml b/.github/workflows/ci_travis.yml
index be2d1cb..060970d 100644
--- a/.github/workflows/ci_travis.yml
+++ b/.github/workflows/ci_travis.yml
@@ -51,11 +51,12 @@ jobs:
- name: Build example project
run: |
- python -m project.ci.travis.cmake --install ../install
+ python -m project.ci.travis.cmake --install
- name: Run example project
run: |
- $foo_path = Join-Path (Split-Path (Get-Location).Path) install bin foo
+ cd "$env:HOME/install/bin"
+ $foo_path = Join-Path (Get-Location).Path foo
$relative = 'test.txt'
$absolute = Join-Path (Get-Location).Path $relative
diff --git a/project/ci/cmake.py b/project/ci/cmake.py
index 2f801de..67ad13a 100644
--- a/project/ci/cmake.py
+++ b/project/ci/cmake.py
@@ -20,8 +20,8 @@ def _parse_args(dirs, argv=None):
description=dirs.get_cmake_help(),
formatter_class=argparse.RawDescriptionHelpFormatter)
- parser.add_argument('--install', metavar='DIR', dest='install_dir',
- help='install directory')
+ parser.add_argument('--install', action='store_true',
+ help='install the project')
parser.add_argument('--boost', metavar='DIR', dest='boost_dir',
help='set Boost directory path')
parser.add_argument('--toolset', metavar='TOOLSET',
@@ -35,9 +35,10 @@ def _parse_args(dirs, argv=None):
def build_ci(dirs, argv=None):
args = _parse_args(dirs, argv)
+ install_dir = dirs.get_install_dir() if args.install else None
params = BuildParameters(dirs.get_src_dir(),
build_dir=dirs.get_cmake_dir(),
- install_dir=args.install_dir,
+ install_dir=install_dir,
platform=dirs.get_platform(),
configuration=dirs.get_configuration(),
boost_dir=args.boost_dir or dirs.get_boost_dir(),
diff --git a/project/ci/dirs.py b/project/ci/dirs.py
index 5bfedda..4e61015 100644
--- a/project/ci/dirs.py
+++ b/project/ci/dirs.py
@@ -42,6 +42,9 @@ class Dirs(abc.ABC):
def get_cmake_dir(self):
return os.path.join(self.get_build_dir(), 'build')
+ def get_install_dir(self):
+ return os.path.join(self.get_build_dir(), 'install')
+
@abc.abstractmethod
def get_cmake_args(self):
pass
@@ -61,7 +64,7 @@ Boost is built in {self.get_boost_dir()}.
This is similar to running project.cmake.build, but auto-fills some parameters
from environment variables.
-The project is built in {self.get_cmake_dir()}.
+The project is built in {self.get_cmake_dir()} and installed to {self.get_install_dir()}.
'''