From 4f0738fe64b92710ce771f0fb96a124517c5497d Mon Sep 17 00:00:00 2001 From: Ben Visness Date: Sat, 23 Sep 2023 17:15:08 -0500 Subject: [PATCH] Check for Xcode command-line tools --- Readme.md | 4 +++- scripts/dev.py | 29 ++++++++++++++++------------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/Readme.md b/Readme.md index 9233cd5..cc54e86 100644 --- a/Readme.md +++ b/Readme.md @@ -29,12 +29,14 @@ The Orca command-line tools must be installed to your system in order to use the - Windows or Mac (Linux is not yet supported) - [Python 3.8](https://www.python.org/) or newer (for command line tools) -- Clang +- Clang (version 11.0 or newer) - **Windows users:** `clang` can be installed via the Visual Studio installer. Search for "C++ Clang Compiler". - **Mac users:** Apple's built-in `clang` does not support WebAssembly. We recommend installing `clang` via [Homebrew](https://brew.sh/) with `brew install llvm`. - MSVC (Visual Studio 2022 17.5 or newer) (Windows only) - This can be installed through the [Visual Studio Community](https://visualstudio.microsoft.com/) installer. Ensure that your Visual Studio installation includes "Desktop development with C++". - Please note the version requirement! Orca requires C11 atomics, which were only added to MSVC in late 2022. +- Xcode command-line tools (Mac only) + - These can be installed with `xcode-select --install`. ### Installation instructions diff --git a/scripts/dev.py b/scripts/dev.py index a286bf3..464165a 100644 --- a/scripts/dev.py +++ b/scripts/dev.py @@ -17,7 +17,7 @@ from .embed_text_files import * from .version import check_if_source, is_orca_source, orca_version ANGLE_VERSION = "2023-07-05" - +MAC_SDK_DIR = "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" def attach_dev_commands(subparsers): dev_cmd = subparsers.add_parser("dev", help="Commands for building Orca itself. Must be run from within an Orca source checkout.") @@ -168,12 +168,10 @@ def build_platform_layer_lib_win(release): ], check=True) def build_platform_layer_lib_mac(release): - sdk_dir = "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk" - flags = ["-mmacos-version-min=10.15.4"] cflags = ["-std=c11"] debug_flags = ["-O3"] if release else ["-g", "-DOC_DEBUG", "-DOC_LOG_COMPILE_DEBUG"] - ldflags = [f"-L{sdk_dir}/usr/lib", f"-F{sdk_dir}/System/Library/Frameworks/"] + ldflags = [f"-L{MAC_SDK_DIR}/usr/lib", f"-F{MAC_SDK_DIR}/System/Library/Frameworks/"] includes = ["-Isrc", "-Isrc/util", "-Isrc/platform", "-Isrc/ext", "-Isrc/ext/angle/include"] # compile metal shader @@ -443,19 +441,24 @@ def ensure_programs(): msg.more("and \"C++ Clang Compiler\": https://visualstudio.microsoft.com/") exit(1) - try: - subprocess.run(["clang", "-v"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) - except FileNotFoundError: - msg = log_error("clang was not found on your system.") - if platform.system() == "Windows": - msg.more("We recommend installing clang via the Visual Studio installer.") - elif platform.system() == "Darwin": + if platform.system() == "Darwin": + try: + subprocess.run(["clang", "-v"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL) + except FileNotFoundError: + msg = log_error("clang was not found on your system.") msg.more("Run the following to install it:") msg.more() msg.more(" brew install llvm") msg.more() - exit(1) - # TODO(ben): Check for xcode command line tools + exit(1) + + if not os.path.exists(MAC_SDK_DIR): + msg = log_error("The Xcode command-line tools are not installed.") + msg.more("Run the following to install them:") + msg.more() + msg.more(" xcode-select --install") + msg.more() + exit(1) def ensure_angle():