forked from libass/libass
-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Unlike the x86 asm code, arm64 asm uses GNU asm.
- Loading branch information
1 parent
45363ae
commit 5ef3cc9
Showing
2 changed files
with
34 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -162,31 +162,36 @@ endif | |
|
||
# ASM | ||
|
||
nasm_args = [] | ||
asm_args = [] | ||
|
||
# Architecture check | ||
if host_machine.cpu_family() == 'x86' | ||
bittype = '32' | ||
nasm_args += '-DARCH_X86_64=0' | ||
asm_args += '-DARCH_X86_64=0' | ||
cpu_family = 'x86' | ||
elif host_machine.cpu_family() == 'x86_64' | ||
bittype = '64' | ||
nasm_args += '-DARCH_X86_64=1' | ||
asm_args += '-DARCH_X86_64=1' | ||
cpu_family = 'x86' | ||
elif host_machine.cpu_family() == 'aarch64' and host_system == 'darwin' | ||
bittype = '64' | ||
cpu_family = 'arm64' | ||
endif | ||
|
||
if cpu_family == 'x86' or cpu_family == 'arm64' | ||
if cpu_family == 'x86' | ||
nasm = find_program('nasm', required: get_option('asm')) | ||
enable_asm = nasm.found() | ||
use_nasm = true | ||
elif cpu_family == 'arm64' | ||
enable_asm = true | ||
use_nasm = false | ||
else | ||
enable_asm = false | ||
use_nasm = false | ||
endif | ||
|
||
# NASM version check | ||
if enable_asm | ||
if use_nasm | ||
# This can be cleaned up once 0.64 is available, see https://github.com/xclaesse/libass/commit/cfd3d9971bd585939b97409c0aac79cab3dd2da5 | ||
nasm_r = run_command(nasm, '-v', check: true) | ||
out = nasm_r.stdout().strip().split() | ||
|
@@ -203,27 +208,27 @@ endif | |
|
||
if get_option('asm').enabled() and (not enable_asm) | ||
error('ASM functions were enabled but are unavailable.') | ||
elif (not enable_asm) and (cpu_family == 'x86' or cpu_family == 'arm64') and (not get_option('asm').disabled()) | ||
elif (not enable_asm) and use_nasm and (not get_option('asm').disabled()) | ||
warning('Install nasm-2.10 or later for a significantly faster libass build.') | ||
endif | ||
|
||
# System check | ||
if enable_asm | ||
if host_system == 'windows' | ||
nasm_args += ['-f', 'win' + bittype] | ||
asm_args += ['-f', 'win' + bittype] | ||
if bittype == '32' | ||
nasm_args += '-DPREFIX' | ||
asm_args += '-DPREFIX' | ||
endif | ||
elif host_system == 'darwin' | ||
if cpu_family == 'arm64' | ||
nasm_args += '-DPREFIX' | ||
asm_args += '-DPREFIX' | ||
else | ||
nasm_args += ['-f', 'macho' + bittype, '-DPREFIX', '-DSTACK_ALIGNMENT=16'] | ||
asm_args += ['-f', 'macho' + bittype, '-DPREFIX', '-DSTACK_ALIGNMENT=16'] | ||
endif | ||
elif host_system == 'linux' or host_system == 'sunos' or host_system == 'haiku' or host_system == 'gnu' | ||
nasm_args += ['-f', 'elf' + bittype, '-DSTACK_ALIGNMENT=16'] | ||
asm_args += ['-f', 'elf' + bittype, '-DSTACK_ALIGNMENT=16'] | ||
elif host_system == 'dragonfly' or host_system.endswith('bsd') | ||
nasm_args += ['-f', 'elf' + bittype] | ||
asm_args += ['-f', 'elf' + bittype] | ||
else | ||
error('Please contact libass upstream to figure out if ASM support for your platform can be added. In the meantime, disabling.') | ||
enable_asm = false | ||
|
@@ -238,10 +243,14 @@ if enable_asm | |
conf.set('ARCH_AARCH64', 1) | ||
endif | ||
|
||
nasm_args += '-Dprivate_prefix=ass' | ||
nasm_args += ['-I', meson.current_source_dir() / 'libass' + '/', '-DPIC=1', '-o', '@OUTPUT@', '@INPUT@'] | ||
if use_nasm | ||
asm_args += '-Dprivate_prefix=ass' | ||
asm_args += ['-I', meson.current_source_dir() / 'libass' + '/', '-DPIC=1', '-o', '@OUTPUT@', '@INPUT@'] | ||
|
||
nasm_gen = generator(nasm, output: '@[email protected]', arguments: nasm_args) | ||
nasm_gen = generator(nasm, output: '@[email protected]', arguments: asm_args) | ||
else | ||
add_project_arguments(asm_args, language: 'c') | ||
endif | ||
endif | ||
|
||
config_h_in = configure_file(output: 'config.h.in', configuration: conf) | ||
|