nasm: Harcode default path on Windows

NASM's installer does not add itself into PATH, even when installed by
choco.
pull/10922/head
Xavier Claessens 2 years ago committed by Xavier Claessens
parent eb731cda75
commit 4f4076bfc0
  1. 4
      mesonbuild/compilers/detect.py
  2. 13
      test cases/nasm/2 asm language/meson.build

@ -1151,6 +1151,10 @@ def detect_nasm_compiler(env: 'Environment', for_machine: MachineChoice) -> Comp
popen_exceptions: T.Dict[str, Exception] = {}
for comp in compilers:
if comp == ['nasm'] and is_windows() and not shutil.which(comp[0]):
# nasm is not in PATH on Windows by default
default_path = os.path.join(os.environ['ProgramFiles'], 'NASM')
comp[0] = shutil.which(comp[0], path=default_path) or comp[0]
try:
output = Popen_safe(comp + ['--version'])[1]
except OSError as e:

@ -1,18 +1,15 @@
project('test', 'c')
nasm = find_program('nasm', required: false)
yasm = find_program('yasm', required: false)
if not nasm.found() and not yasm.found()
assert(not add_languages('nasm', required: false))
error('MESON_SKIP_TEST: nasm not available')
endif
if not host_machine.cpu_family().startswith('x86')
assert(not add_languages('nasm', required: false))
error('MESON_SKIP_TEST: nasm only supported for x86 and x86_64')
endif
add_languages('nasm')
if not add_languages('nasm', required: false)
nasm = find_program('nasm', 'yasm', required: false)
assert(not nasm.found())
error('MESON_SKIP_TEST: nasm not found')
endif
config_file = configure_file(
output: 'config.asm',

Loading…
Cancel
Save