diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2021-03-20 13:16:15 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2021-03-20 14:34:32 +0300 |
commit | e731e6345d7fa1c2326b18c56f5dc361ea3adbfb (patch) | |
tree | cc72442867919028eda33b264c02eab47ca3a049 /project/cmake/build.py | |
parent | workflows/basic: enable on windows-2016 (diff) | |
download | cmake-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 'project/cmake/build.py')
-rw-r--r-- | project/cmake/build.py | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/project/cmake/build.py b/project/cmake/build.py index 1e9a90d..a2fea78 100644 --- a/project/cmake/build.py +++ b/project/cmake/build.py @@ -34,7 +34,7 @@ from project.toolchain import ToolchainType from project.utils import normalize_path, mkdir_parent, run, setup_logging -DEFAULT_PLATFORM = None +DEFAULT_PLATFORM = Platform.AUTO DEFAULT_CONFIGURATION = Configuration.DEBUG DEFAULT_TOOLSET = ToolchainType.AUTO @@ -81,18 +81,14 @@ class GenerationPhase: def _get_boost_args(self): if self.boost_dir is None: return [] - stagedir = self._stagedir(self.boost_dir, self.platform, self.configuration) + root = self.boost_dir + librarydir = self.platform.boost_librarydir(self.configuration) + librarydir = os.path.join(self.boost_dir, librarydir) return [ - '-D', f'BOOST_ROOT={self.boost_dir}', - '-D', f'BOOST_LIBRARYDIR={stagedir}', + '-D', f'BOOST_ROOT={root}', + '-D', f'BOOST_LIBRARYDIR={librarydir}', ] - @staticmethod - def _stagedir(boost_dir, platform, configuration): - if platform is None: - platform = Platform.native() - return os.path.join(boost_dir, 'stage', str(platform), str(configuration), 'lib') - def run(self, toolchain): run_cmake(self._cmake_args(toolchain)) |