Centralize and improve checks when building samples #143
|
@ -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)
|
- Windows or Mac (Linux is not yet supported)
|
||||||
- [Python 3.8](https://www.python.org/) or newer (for command line tools)
|
- [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".
|
- **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`.
|
- **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)
|
- 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++".
|
- 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.
|
- 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
|
### Installation instructions
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ from .embed_text_files import *
|
||||||
from .version import check_if_source, is_orca_source, orca_version
|
from .version import check_if_source, is_orca_source, orca_version
|
||||||
|
|
||||||
ANGLE_VERSION = "2023-07-05"
|
ANGLE_VERSION = "2023-07-05"
|
||||||
|
MAC_SDK_DIR = "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk"
|
||||||
|
|
||||||
def attach_dev_commands(subparsers):
|
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.")
|
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)
|
], check=True)
|
||||||
|
|
||||||
def build_platform_layer_lib_mac(release):
|
def build_platform_layer_lib_mac(release):
|
||||||
sdk_dir = "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk"
|
|
||||||
|
|
||||||
flags = ["-mmacos-version-min=10.15.4"]
|
flags = ["-mmacos-version-min=10.15.4"]
|
||||||
cflags = ["-std=c11"]
|
cflags = ["-std=c11"]
|
||||||
debug_flags = ["-O3"] if release else ["-g", "-DOC_DEBUG", "-DOC_LOG_COMPILE_DEBUG"]
|
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"]
|
includes = ["-Isrc", "-Isrc/util", "-Isrc/platform", "-Isrc/ext", "-Isrc/ext/angle/include"]
|
||||||
|
|
||||||
# compile metal shader
|
# compile metal shader
|
||||||
|
@ -443,19 +441,24 @@ def ensure_programs():
|
||||||
msg.more("and \"C++ Clang Compiler\": https://visualstudio.microsoft.com/")
|
msg.more("and \"C++ Clang Compiler\": https://visualstudio.microsoft.com/")
|
||||||
exit(1)
|
exit(1)
|
||||||
|
|
||||||
|
if platform.system() == "Darwin":
|
||||||
try:
|
try:
|
||||||
subprocess.run(["clang", "-v"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
subprocess.run(["clang", "-v"], stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
||||||
except FileNotFoundError:
|
except FileNotFoundError:
|
||||||
msg = log_error("clang was not found on your system.")
|
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":
|
|
||||||
msg.more("Run the following to install it:")
|
msg.more("Run the following to install it:")
|
||||||
msg.more()
|
msg.more()
|
||||||
msg.more(" brew install llvm")
|
msg.more(" brew install llvm")
|
||||||
msg.more()
|
msg.more()
|
||||||
exit(1)
|
exit(1)
|
||||||
# TODO(ben): Check for xcode command line tools
|
|
||||||
|
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():
|
def ensure_angle():
|
||||||
|
|
Loading…
Reference in New Issue