Check for Xcode command-line tools

This commit is contained in:
Ben Visness 2023-09-23 17:15:08 -05:00 committed by MartinFouilleul
parent 1cc8778982
commit 4f0738fe64
2 changed files with 19 additions and 14 deletions

View File

@ -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

View File

@ -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():