aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/project/configuration.py
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2021-03-20 13:16:15 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2021-03-20 14:34:32 +0300
commite731e6345d7fa1c2326b18c56f5dc361ea3adbfb (patch)
treecc72442867919028eda33b264c02eab47ca3a049 /project/configuration.py
parentworkflows/basic: enable on windows-2016 (diff)
downloadcmake-common-e731e6345d7fa1c2326b18c56f5dc361ea3adbfb.tar.gz
cmake-common-e731e6345d7fa1c2326b18c56f5dc361ea3adbfb.zip
project.platform: add platform 'auto'
There were two problems: * On Windows, VS 2019 defaults to x64 while VS 2017 defaults to x86. * Too much focus on x86(-64) might mean that building stuff on ARM can become difficult. These were all addressed by adding a new platform 'auto'. On Windows, it defaults to picking either x64 or x86 (depending on the host arch) for both Boost and CMake. On Linux, it lets the compiler decide what arch to target.
Diffstat (limited to '')
-rw-r--r--project/configuration.py24
1 files changed, 22 insertions, 2 deletions
diff --git a/project/configuration.py b/project/configuration.py
index 4b25c6e..5bfc317 100644
--- a/project/configuration.py
+++ b/project/configuration.py
@@ -29,7 +29,7 @@ class Configuration(Enum):
except ValueError as e:
raise argparse.ArgumentTypeError(f'invalid configuration: {s}') from e
- def to_boost_variant(self):
+ def variant(self):
'''Roughly maps CMake's CMAKE_BUILD_TYPE to Boost's variant.
AFAIK, Boost only supports debug/release, MinSizeRel and RelWithDebInfo
@@ -38,5 +38,25 @@ class Configuration(Enum):
MinSizeRel/RelWithDebInfo.
'''
if self in (Configuration.MINSIZEREL, Configuration.RELWITHDEBINFO):
- return Configuration.RELEASE.to_boost_variant()
+ return Configuration.RELEASE.variant()
return str(self).lower()
+
+ def b2_variant(self):
+ return [f'variant={self.variant()}']
+
+ def b2_args(self):
+ args = []
+ args += self.b2_variant()
+ return args
+
+ def build_type(self):
+ '''Maps to CMAKE_BUILD_TYPE.'''
+ return str(self)
+
+ def cmake_build_type(self):
+ return ['-D', f'CMAKE_BUILD_TYPE={self.build_type()}']
+
+ def cmake_args(self):
+ args = []
+ args += self.cmake_build_type()
+ return args