meson: remove '--outdir' argument in script
Usage of '--outdir' argument in python scripts makes it very complicated for tools like ninja-to-soong to generate the Android equivalent build file. This is because the option is less clear on what will be generated. Instead, change it for '--out' where we give the full path of the file to generate. This has the good point of deduplicating the locations of the file name to have it only in 'meson.build'. Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37741>
This commit is contained in:
@@ -53,7 +53,7 @@ nir_intrinsics_h = custom_target(
|
||||
'nir_intrinsics.h',
|
||||
input : 'nir_intrinsics_h.py',
|
||||
output : 'nir_intrinsics.h',
|
||||
command : [prog_python, '@INPUT@', '--outdir', meson.current_build_dir()],
|
||||
command : [prog_python, '@INPUT@', '--out', '@OUTPUT@'],
|
||||
capture : false,
|
||||
depend_files : files('nir_intrinsics.py'),
|
||||
)
|
||||
@@ -62,7 +62,7 @@ nir_intrinsics_indices_h = custom_target(
|
||||
'nir_intrinsics_indices.h',
|
||||
input : 'nir_intrinsics_indices_h.py',
|
||||
output : 'nir_intrinsics_indices.h',
|
||||
command : [prog_python, '@INPUT@', '--outdir', meson.current_build_dir()],
|
||||
command : [prog_python, '@INPUT@', '--out', '@OUTPUT@'],
|
||||
capture : false,
|
||||
depend_files : files('nir_intrinsics.py'),
|
||||
)
|
||||
@@ -71,7 +71,7 @@ nir_intrinsics_c = custom_target(
|
||||
'nir_intrinsic.c',
|
||||
input : 'nir_intrinsics_c.py',
|
||||
output : 'nir_intrinsics.c',
|
||||
command : [prog_python, '@INPUT@', '--outdir', meson.current_build_dir()],
|
||||
command : [prog_python, '@INPUT@', '--out', '@OUTPUT@'],
|
||||
capture: false,
|
||||
depend_files : files('nir_intrinsics.py'),
|
||||
)
|
||||
|
||||
@@ -72,13 +72,12 @@ import os
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--outdir', required=True,
|
||||
help='Directory to put the generated files in')
|
||||
parser.add_argument('--out', required=True,
|
||||
help='Output C file')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
path = os.path.join(args.outdir, 'nir_intrinsics.c')
|
||||
with open(path, 'w', encoding='utf-8') as f:
|
||||
with open(args.out, 'w', encoding='utf-8') as f:
|
||||
f.write(Template(template).render(
|
||||
INTR_OPCODES=INTR_OPCODES, INTR_INDICES=INTR_INDICES,
|
||||
reduce=reduce, operator=operator))
|
||||
|
||||
@@ -56,13 +56,12 @@ import os
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--outdir', required=True,
|
||||
help='Directory to put the generated files in')
|
||||
parser.add_argument('--out', required=True,
|
||||
help='Output H file')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
path = os.path.join(args.outdir, 'nir_intrinsics.h')
|
||||
with open(path, 'w', encoding='utf-8') as f:
|
||||
with open(args.out, 'w', encoding='utf-8') as f:
|
||||
f.write(Template(template).render(INTR_OPCODES=INTR_OPCODES, INTR_INDICES=INTR_INDICES))
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@@ -80,13 +80,12 @@ import os
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--outdir', required=True,
|
||||
help='Directory to put the generated files in')
|
||||
parser.add_argument('--out', required=True,
|
||||
help='Output H file')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
path = os.path.join(args.outdir, 'nir_intrinsics_indices.h')
|
||||
with open(path, 'w', encoding='utf-8') as f:
|
||||
with open(args.out, 'w', encoding='utf-8') as f:
|
||||
f.write(Template(template).render(INTR_INDICES=INTR_INDICES))
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
@@ -63,13 +63,12 @@ brw_device_sha1_update(struct mesa_sha1 *ctx,
|
||||
def main():
|
||||
"""print intel_device_serialize.c at the specified path"""
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('--outdir', required=True,
|
||||
help='Directory to put the generated files in')
|
||||
parser.add_argument('--out', required=True,
|
||||
help='Output C file')
|
||||
args = parser.parse_args()
|
||||
path = os.path.join(args.outdir, 'brw_device_sha1_gen.c')
|
||||
device_members = intel_device_info.TYPES_BY_NAME["intel_device_info"].members
|
||||
compiler_fields = [field for field in device_members if field.compiler_field]
|
||||
with open(path, 'w', encoding='utf-8') as f:
|
||||
with open(args.out, 'w', encoding='utf-8') as f:
|
||||
try:
|
||||
f.write(Template(template).render(compiler_fields=compiler_fields))
|
||||
except:
|
||||
|
||||
@@ -127,7 +127,7 @@ libintel_compiler_brw_files = files(
|
||||
brw_device_sha1_gen_src = custom_target('brw_device_sha1_gen.c',
|
||||
input : ['brw_device_sha1_gen_c.py', '../dev/intel_device_info.py'],
|
||||
output : ['brw_device_sha1_gen.c'],
|
||||
command : [prog_python, '@INPUT0@', '--outdir', meson.current_build_dir()])
|
||||
command : [prog_python, '@INPUT0@', '--out', '@OUTPUT@'])
|
||||
|
||||
|
||||
brw_nir_lower_fsign = custom_target(
|
||||
|
||||
@@ -538,8 +538,14 @@ def main():
|
||||
help='Vulkan API XML files',
|
||||
action='append',
|
||||
dest='xml_files')
|
||||
parser.add_argument('--outdir',
|
||||
help='Directory to put the generated files in',
|
||||
parser.add_argument('--out-c',
|
||||
help='Output C file',
|
||||
required=True)
|
||||
parser.add_argument('--out-h',
|
||||
help='Output H file',
|
||||
required=True)
|
||||
parser.add_argument('--out-d',
|
||||
help='Output defines H file',
|
||||
required=True)
|
||||
|
||||
args = parser.parse_args()
|
||||
@@ -559,9 +565,9 @@ def main():
|
||||
bitmasks = sorted(bitmask_factory.registry.values(), key=lambda e: e.name)
|
||||
object_types = sorted(obj_type_factory.registry.values(), key=lambda e: e.name)
|
||||
|
||||
for template, file_ in [(C_TEMPLATE, os.path.join(args.outdir, 'vk_enum_to_str.c')),
|
||||
(H_TEMPLATE, os.path.join(args.outdir, 'vk_enum_to_str.h')),
|
||||
(H_DEFINE_TEMPLATE, os.path.join(args.outdir, 'vk_enum_defines.h'))]:
|
||||
for template, file_ in [(C_TEMPLATE, args.out_c),
|
||||
(H_TEMPLATE, args.out_h),
|
||||
(H_DEFINE_TEMPLATE, args.out_d)]:
|
||||
with open(file_, 'w', encoding='utf-8') as f:
|
||||
f.write(template.render(
|
||||
file=os.path.basename(__file__),
|
||||
|
||||
@@ -90,7 +90,9 @@ vk_enum_to_str = custom_target(
|
||||
output : ['vk_enum_to_str.c', 'vk_enum_to_str.h', 'vk_enum_defines.h'],
|
||||
command : [
|
||||
prog_python, '@INPUT0@', '--xml', '@INPUT1@',
|
||||
'--outdir', meson.current_build_dir(),
|
||||
'--out-c', '@OUTPUT0@',
|
||||
'--out-h', '@OUTPUT1@',
|
||||
'--out-d', '@OUTPUT2@',
|
||||
'--beta', with_vulkan_beta.to_string()
|
||||
],
|
||||
depend_files : vk_enum_to_str_depend_files,
|
||||
@@ -102,7 +104,7 @@ vk_struct_type_cast = custom_target(
|
||||
output : ['vk_struct_type_cast.h'],
|
||||
command : [
|
||||
prog_python, '@INPUT0@', '--xml', '@INPUT1@',
|
||||
'--outdir', meson.current_build_dir(),
|
||||
'--out', '@OUTPUT@',
|
||||
'--beta', with_vulkan_beta.to_string()
|
||||
],
|
||||
depend_files : vk_struct_type_cast_depend_files,
|
||||
|
||||
@@ -91,8 +91,8 @@ def main():
|
||||
help='Vulkan API XML files',
|
||||
action='append',
|
||||
dest='xml_files')
|
||||
parser.add_argument('--outdir',
|
||||
help='Directory to put the generated files in',
|
||||
parser.add_argument('--out',
|
||||
help='Output H file',
|
||||
required=True)
|
||||
parser.add_argument('--beta', required=True, help='Enable beta extensions.')
|
||||
|
||||
@@ -105,7 +105,7 @@ def main():
|
||||
|
||||
structs = sorted(structs, key=lambda s: s.name)
|
||||
|
||||
for template, file_ in [(H_TEMPLATE, os.path.join(args.outdir, 'vk_struct_type_cast.h'))]:
|
||||
for template, file_ in [(H_TEMPLATE, args.out)]:
|
||||
with open(file_, 'w', encoding='utf-8') as f:
|
||||
f.write(template.render(
|
||||
file=os.path.basename(__file__),
|
||||
|
||||
Reference in New Issue
Block a user