[gn build] make building on an arm mac work
Currently requires `llvm_targets_to_build = [ "X86", "AArch64" ]`: building just the host arch (i.e. aarch64) causes some linker errors.
This commit is contained in:
parent
3d12e79094
commit
5416fc014a
|
@ -32,12 +32,12 @@ def set_executable_bit(path):
|
|||
|
||||
def get_platform():
|
||||
import platform
|
||||
if sys.platform == 'darwin':
|
||||
return 'mac-amd64' if platform.machine() != 'arm64' else 'mac-arm64'
|
||||
if platform.machine() not in ('AMD64', 'x86_64'):
|
||||
return None
|
||||
if sys.platform.startswith('linux'):
|
||||
return 'linux-amd64'
|
||||
if sys.platform == 'darwin':
|
||||
return 'mac-amd64'
|
||||
if sys.platform == 'win32':
|
||||
return 'windows-amd64'
|
||||
|
||||
|
@ -47,6 +47,14 @@ def main():
|
|||
if not platform:
|
||||
print('no prebuilt binary for', sys.platform)
|
||||
return 1
|
||||
if platform == 'mac-arm64':
|
||||
print('no prebuilt mac-arm64 binaries yet. build it yourself with:')
|
||||
print(' rm -rf /tmp/gn &&')
|
||||
print(' pushd /tmp && git clone https://gn.googlesource.com/gn &&')
|
||||
print(' cd gn && build/gen.py && ninja -C out gn && popd &&')
|
||||
print(' mkdir -p llvm/utils/gn/bin/mac-arm64 &&')
|
||||
print(' cp /tmp/gn/out/gn llvm/utils/gn/bin/mac-arm64')
|
||||
return 1
|
||||
|
||||
dirname = os.path.join(os.path.dirname(__file__), 'bin', platform)
|
||||
if not os.path.exists(dirname):
|
||||
|
|
|
@ -17,12 +17,12 @@ ROOT_DIR = os.path.join(THIS_DIR, '..', '..', '..')
|
|||
|
||||
def get_platform():
|
||||
import platform
|
||||
if sys.platform == 'darwin':
|
||||
return 'mac-amd64' if platform.machine() != 'arm64' else 'mac-arm64'
|
||||
if platform.machine() not in ('AMD64', 'x86_64'):
|
||||
return None
|
||||
if sys.platform.startswith('linux'):
|
||||
return 'linux-amd64'
|
||||
if sys.platform == 'darwin':
|
||||
return 'mac-amd64'
|
||||
if sys.platform == 'win32':
|
||||
return 'windows-amd64'
|
||||
|
||||
|
|
|
@ -86,6 +86,8 @@ write_lit_config("lit_site_cfg") {
|
|||
|
||||
if (host_cpu == "x64") {
|
||||
extra_values += [ "HOST_ARCH=x86_64" ]
|
||||
} else if (host_cpu == "arm64") {
|
||||
extra_values += [ "HOST_ARCH=arm64" ]
|
||||
} else if (host_cpu == "ppc64") {
|
||||
extra_values += [ "HOST_ARCH=powerpc64le" ]
|
||||
} else {
|
||||
|
|
|
@ -88,6 +88,8 @@ write_lit_config("lit_site_cfg") {
|
|||
|
||||
if (host_cpu == "x64") {
|
||||
extra_values += [ "HOST_ARCH=x86_64" ]
|
||||
} else if (host_cpu == "arm64") {
|
||||
extra_values += [ "HOST_ARCH=arm64" ]
|
||||
} else if (host_cpu == "ppc64") {
|
||||
extra_values += [ "HOST_ARCH=powerpc64le" ]
|
||||
} else {
|
||||
|
|
|
@ -19,6 +19,8 @@ if (current_cpu == "x86") {
|
|||
} else if (current_cpu == "arm64") {
|
||||
if (current_os == "android") {
|
||||
llvm_current_triple = "aarch64-linux-android29"
|
||||
} else if (current_os == "mac") {
|
||||
llvm_current_triple = "arm64-apple-darwin"
|
||||
}
|
||||
} else if (current_cpu == "ppc64") {
|
||||
if (current_os == "linux") {
|
||||
|
|
Loading…
Reference in New Issue