From 00290ddef6c340575898974c63e57975e3866b75 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Wed, 15 Dec 2021 13:40:15 +0300 Subject: basic macOS support I don't have a Mac to test on, but the knowledge that there is basic support for macOS is still nice. --- .github/workflows/basic.yml | 2 +- project/boost/build.py | 2 +- project/os.py | 5 ++++- project/utils.py | 6 +++--- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/.github/workflows/basic.yml b/.github/workflows/basic.yml index 545dc28..f7d8fc5 100644 --- a/.github/workflows/basic.yml +++ b/.github/workflows/basic.yml @@ -21,7 +21,7 @@ jobs: os: strategy: matrix: - os: [ubuntu-18.04, ubuntu-20.04, windows-2016, windows-2019] + os: [ubuntu-18.04, ubuntu-20.04, windows-2016, windows-2019, macos-10.15, macos-11] include: - boost-version: 1.72.0 runs-on: '${{ matrix.os }}' diff --git a/project/boost/build.py b/project/boost/build.py index a192585..fd73b6e 100644 --- a/project/boost/build.py +++ b/project/boost/build.py @@ -101,7 +101,7 @@ class BuildParameters: logging.warning("Cannot link the runtime statically to a dynamic library, going to link dynamically") runtime_link = Linkage.SHARED elif on_linux_like(): - logging.warning("Cannot link to the GNU C Library (which is assumed) statically, going to link dynamically") + logging.warning("Cannot link to the GNU C Library or BSD libc (which are assumed) statically, going to link dynamically") runtime_link = Linkage.SHARED yield link, runtime_link diff --git a/project/os.py b/project/os.py index eaa63db..cb5bd44 100644 --- a/project/os.py +++ b/project/os.py @@ -11,6 +11,7 @@ class OS(Enum): WINDOWS = 'Windows' LINUX = 'Linux' CYGWIN = 'Cygwin' + MACOS = 'macOS' def __str__(self): return str(self.value) @@ -22,6 +23,8 @@ class OS(Enum): return OS.WINDOWS if system == 'Linux': return OS.LINUX + if system == 'Darwin': + return OS.MACOS if system.startswith('CYGWIN_NT'): return OS.CYGWIN raise NotImplementedError(f'unsupported OS: {system}') @@ -42,7 +45,7 @@ def on_linux(): def on_linux_like(): os = OS.current() - return os is OS.LINUX or os is OS.CYGWIN + return os is OS.LINUX or os is OS.CYGWIN or os is OS.MACOS def on_cygwin(): diff --git a/project/utils.py b/project/utils.py index 39dfb0d..6697ff7 100644 --- a/project/utils.py +++ b/project/utils.py @@ -13,7 +13,7 @@ import sys import tempfile import time -from project.os import on_cygwin, on_linux +import project.os def normalize_path(s): @@ -25,7 +25,7 @@ def mkdir_parent(path): def full_exe_name(exe): - if on_linux(): + if not project.os.on_windows_like(): # There's no PATHEXT on Linux. return exe # b2 on Windows/Cygwin doesn't like it when the executable name doesn't @@ -34,7 +34,7 @@ def full_exe_name(exe): path = shutil.which(exe, path=dir_path) if not path: raise RuntimeError(f"executable '{exe}' could not be found") - if on_cygwin(): + if project.os.on_cygwin(): # On Cygwin, shutil.which('gcc') == '/usr/bin/gcc' and shutil.which('gcc.exe') # == '/usr/bin/gcc.exe'; we want the latter version. shutil.which('clang++') # == '/usr/bin/clang++' is fine though, since it _is_ the complete path -- cgit v1.2.3