diff options
| author | L. E. Segovia <amy@amyspark.me> | 2023-04-25 11:33:43 -0300 |
|---|---|---|
| committer | L. E. Segovia <amy@amyspark.me> | 2024-04-09 22:11:04 -0300 |
| commit | c0696889ff4fdde18a1ea3cbfba727f1a4b7a137 (patch) | |
| tree | 93efa9f5d37ab87949826a4a3bc2a060d42c4291 /mesonbuild/backend/backends.py | |
| parent | 7b77fa01745171bed238b4c40a6b485c67d6b060 (diff) | |
| download | meson-c0696889ff4fdde18a1ea3cbfba727f1a4b7a137.tar.gz | |
backends: Add Nasm support to Xcode through a custom build rule
Diffstat (limited to 'mesonbuild/backend/backends.py')
| -rw-r--r-- | mesonbuild/backend/backends.py | 39 |
1 files changed, 29 insertions, 10 deletions
diff --git a/mesonbuild/backend/backends.py b/mesonbuild/backend/backends.py index af730f88e..0db5c79af 100644 --- a/mesonbuild/backend/backends.py +++ b/mesonbuild/backend/backends.py @@ -2013,6 +2013,34 @@ class Backend: env.prepend('PATH', list(extra_paths)) return env + def compiler_to_generator_args(self, target: build.BuildTarget, + compiler: 'Compiler', output: str = '@OUTPUT@', + depfile: T.Union[str, None] = '@DEPFILE@', + extras: T.Union[T.List[str], None] = None, + input: str = '@INPUT@') -> CompilerArgs: + ''' + The VS and Xcode backends need the full set of arguments for making a + custom build rule. This is a convenience method to convert a Compiler + to its arguments, for later concatenation. + ''' + # FIXME: There are many other args missing + commands = self.generate_basic_compiler_args(target, compiler) + if depfile: + commands += compiler.get_dependency_gen_args(output, depfile) + commands += compiler.get_output_args(output) + commands += self.get_source_dir_include_args(target, compiler) + commands += self.get_build_dir_include_args(target, compiler) + commands += compiler.get_compile_only_args() + # Add per-target compile args, f.ex, `c_args : ['-DFOO']`. We set these + # near the end since these are supposed to override everything else. + commands += self.escape_extra_args(target.get_extra_args(compiler.get_language())) + # Do not escape this one, it is interpreted by the build system + # (Xcode considers these as variables to expand at build time) + if extras is not None: + commands += extras + commands += [input] + return commands + def compiler_to_generator(self, target: build.BuildTarget, compiler: 'Compiler', sources: _ALL_SOURCES_TYPE, @@ -2026,16 +2054,7 @@ class Backend: exelist = compiler.get_exelist() exe = programs.ExternalProgram(exelist[0]) args = exelist[1:] - # FIXME: There are many other args missing - commands = self.generate_basic_compiler_args(target, compiler) - commands += compiler.get_dependency_gen_args('@OUTPUT@', '@DEPFILE@') - commands += compiler.get_output_args('@OUTPUT@') - commands += compiler.get_compile_only_args() + ['@INPUT@'] - commands += self.get_source_dir_include_args(target, compiler) - commands += self.get_build_dir_include_args(target, compiler) - # Add per-target compile args, f.ex, `c_args : ['-DFOO']`. We set these - # near the end since these are supposed to override everything else. - commands += self.escape_extra_args(target.get_extra_args(compiler.get_language())) + commands = self.compiler_to_generator_args(target, compiler) generator = build.Generator(exe, args + commands.to_native(), [output_templ], depfile='@PLAINNAME@.d', depends=depends) |
