aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/project
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2021-01-25 16:05:51 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2021-01-31 14:25:07 +0300
commitd4673a2ff058529488dddf2e0520ee68ec88a0c7 (patch)
treea2a622511aa5af0b67d91da19937b48539f67041 /project
parentproject.ci: auto-fill --toolset from environment (diff)
downloadcmake-common-d4673a2ff058529488dddf2e0520ee68ec88a0c7.tar.gz
cmake-common-d4673a2ff058529488dddf2e0520ee68ec88a0c7.zip
project.ci: use pre-built Boost when available
Diffstat (limited to '')
-rw-r--r--project/ci/appveyor/generator.py13
-rw-r--r--project/ci/cmake.py11
-rw-r--r--project/ci/dirs.py22
3 files changed, 45 insertions, 1 deletions
diff --git a/project/ci/appveyor/generator.py b/project/ci/appveyor/generator.py
index 19c11df..454bd4a 100644
--- a/project/ci/appveyor/generator.py
+++ b/project/ci/appveyor/generator.py
@@ -28,6 +28,19 @@ class Image(Enum):
def get():
return Image.parse(env('APPVEYOR_BUILD_WORKER_IMAGE'))
+ def get_prebuilt_boost_dir(self):
+ # As of 2021-01-25, these are the latest pre-built Boost distributions:
+ # https://www.appveyor.com/docs/windows-images-software/#boost
+ if self is Image.VS_2013:
+ return 'C:\\Libraries\\boost_1_58_0'
+ if self is Image.VS_2015:
+ return 'C:\\Libraries\\boost_1_69_0'
+ if self is Image.VS_2017:
+ return 'C:\\Libraries\\boost_1_69_0'
+ if self is Image.VS_2019:
+ return 'C:\\Libraries\\boost_1_73_0'
+ raise NotImplementedError(f'unsupported AppVeyor image: {self}')
+
class Generator(Enum):
VS_2013 = 'Visual Studio 12 2013'
diff --git a/project/ci/cmake.py b/project/ci/cmake.py
index 6635dbf..70fd885 100644
--- a/project/ci/cmake.py
+++ b/project/ci/cmake.py
@@ -43,12 +43,21 @@ def build_ci(dirs, argv=None):
src_dir = os.path.join(src_dir, args.subdir)
install_dir = dirs.get_install_dir() if args.install else None
+ boost_dir = args.boost_dir
+ if not boost_dir:
+ # If we've built Boost using project.ci.boost already, use that.
+ # Otherwise, try to use the latest pre-built Boost provided by the CI
+ # system.
+ boost_dir = dirs.get_boost_dir()
+ if not os.path.isdir(boost_dir):
+ boost_dir = dirs.get_prebuilt_boost_dir()
+
params = BuildParameters(src_dir,
build_dir=dirs.get_cmake_dir(),
install_dir=install_dir,
platform=dirs.get_platform(),
configuration=dirs.get_configuration(),
- boost_dir=args.boost_dir or dirs.get_boost_dir(),
+ boost_dir=boost_dir,
toolset=dirs.get_toolset(),
cmake_args=dirs.get_cmake_args() + args.cmake_args)
build(params)
diff --git a/project/ci/dirs.py b/project/ci/dirs.py
index 33bd667..946a315 100644
--- a/project/ci/dirs.py
+++ b/project/ci/dirs.py
@@ -10,6 +10,7 @@ import os.path
from project.boost.version import Version
from project.ci.appveyor.generator import Generator, Image
from project.configuration import Configuration
+import project.os
from project.platform import Platform
from project.toolchain import ToolchainType
from project.utils import env
@@ -59,6 +60,10 @@ class Dirs(abc.ABC):
def get_build_dir(self):
pass
+ @abc.abstractmethod
+ def get_prebuilt_boost_dir(self):
+ pass
+
def get_boost_version(self):
return Version.from_string(env('boost_version'))
@@ -118,6 +123,11 @@ class Travis(Dirs):
def get_build_dir(self):
return env('HOME')
+ def get_prebuilt_boost_dir(self):
+ # Travis doesn't have pre-built Boost (available for installation from
+ # the official Ubuntu repositories though).
+ return None
+
def get_cmake_args(self):
return []
@@ -142,6 +152,9 @@ class AppVeyor(Dirs):
def get_build_dir(self):
return R'C:\projects'
+ def get_prebuilt_boost_dir(self):
+ return Image.get().get_prebuilt_boost_dir()
+
def get_cmake_args(self):
return ['-G', str(Generator.from_image(Image.get()))]
@@ -166,6 +179,15 @@ class GitHub(Dirs):
def get_build_dir(self):
return os.path.dirname(env('GITHUB_WORKSPACE'))
+ def get_prebuilt_boost_dir(self):
+ # As of 2021-01-25, Boost 1.72.0 is pre-built (on all images except for
+ # ubuntu-20.04 for some reason). The path is stored in environment
+ # variable BOOST_ROOT_1_72_0.
+ var_name = 'BOOST_ROOT_1_72_0'
+ if var_name in os.environ:
+ return os.environ[var_name]
+ return None
+
def get_cmake_args(self):
return []