diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-29 04:41:38 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-29 04:41:38 +0000 |
commit | 7b6e527f440cd7e6f8be2b07cee320ee6ca18786 (patch) | |
tree | 4a2738d69fa2814659fdadddf5826282e73d81f4 /test cases/nasm/1 configure file/meson.build | |
parent | Initial commit. (diff) | |
download | meson-upstream.tar.xz meson-upstream.zip |
Adding upstream version 1.0.1.upstream/1.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test cases/nasm/1 configure file/meson.build')
-rw-r--r-- | test cases/nasm/1 configure file/meson.build | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/test cases/nasm/1 configure file/meson.build b/test cases/nasm/1 configure file/meson.build new file mode 100644 index 0000000..85ecaf1 --- /dev/null +++ b/test cases/nasm/1 configure file/meson.build @@ -0,0 +1,55 @@ +project('nasm config file', 'c') + +if host_machine.cpu_family() == 'x86' and host_machine.system() == 'windows' + asm_format = 'win32' +elif host_machine.cpu_family() == 'x86_64' and host_machine.system() == 'windows' + asm_format = 'win64' +elif host_machine.cpu_family() == 'x86' and host_machine.system() == 'linux' + asm_format = 'elf32' +elif host_machine.cpu_family() == 'x86_64' and host_machine.system() == 'linux' + asm_format = 'elf64' +else + error('MESON_SKIP_TEST: skipping test on this platform') +endif + +nasm = find_program('nasm', required: false) + +if not nasm.found() + error('MESON_SKIP_TEST: nasm not available') +endif + +conf = configuration_data() + +conf.set('HELLO', 0) + +asm_gen = generator(nasm, + output : '@BASENAME@.o', + arguments : [ + '-f', asm_format, + '-i', meson.current_source_dir() + '/', + '-i', join_paths(meson.current_source_dir(), ''), + '-P', join_paths(meson.current_build_dir(), 'config.asm'), + '@INPUT@', + '-o', '@OUTPUT@']) + + +config_file = configure_file( + output: 'config.asm', + configuration: conf, + output_format: 'nasm', +) + +cc = meson.get_compiler('c') +link_args = cc.get_supported_link_arguments(['-no-pie']) + +exe = executable('hello', asm_gen.process('hello.asm'), + link_args: link_args, +) + +test('test-nasm-configure-file', exe) + +exe2 = executable('hello2', objects : exe.extract_all_objects(), + link_args: link_args, +) + +test('test-nasm-extract-all-objects', exe2) |