aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2022-10-20 09:13:59 +0200
committerXavier Claessens <xclaesse@gmail.com>2022-10-24 11:06:57 +0200
commit4f4076bfc0dacbc5f804ad2d970054ab43d162b3 (patch)
tree868868b7bf1bbda02eaa20db88d8930c5a3ce32c
parenteb731cda758b5d0e2c83d934714b4e7a2656e805 (diff)
downloadmeson-4f4076bfc0dacbc5f804ad2d970054ab43d162b3.zip
meson-4f4076bfc0dacbc5f804ad2d970054ab43d162b3.tar.gz
meson-4f4076bfc0dacbc5f804ad2d970054ab43d162b3.tar.bz2
nasm: Harcode default path on Windows
NASM's installer does not add itself into PATH, even when installed by choco.
-rw-r--r--mesonbuild/compilers/detect.py4
-rw-r--r--test cases/nasm/2 asm language/meson.build13
2 files changed, 9 insertions, 8 deletions
diff --git a/mesonbuild/compilers/detect.py b/mesonbuild/compilers/detect.py
index 8644d75..849024c 100644
--- a/mesonbuild/compilers/detect.py
+++ b/mesonbuild/compilers/detect.py
@@ -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:
diff --git a/test cases/nasm/2 asm language/meson.build b/test cases/nasm/2 asm language/meson.build
index ced2ded..e1ef10a 100644
--- a/test cases/nasm/2 asm language/meson.build
+++ b/test cases/nasm/2 asm language/meson.build
@@ -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',