mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-20 03:00:11 +01:00
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:
parent
acf953757e
commit
cb86341829
9 changed files with 34 additions and 30 deletions
|
|
@ -53,7 +53,7 @@ nir_intrinsics_h = custom_target(
|
||||||
'nir_intrinsics.h',
|
'nir_intrinsics.h',
|
||||||
input : 'nir_intrinsics_h.py',
|
input : 'nir_intrinsics_h.py',
|
||||||
output : 'nir_intrinsics.h',
|
output : 'nir_intrinsics.h',
|
||||||
command : [prog_python, '@INPUT@', '--outdir', meson.current_build_dir()],
|
command : [prog_python, '@INPUT@', '--out', '@OUTPUT@'],
|
||||||
capture : false,
|
capture : false,
|
||||||
depend_files : files('nir_intrinsics.py'),
|
depend_files : files('nir_intrinsics.py'),
|
||||||
)
|
)
|
||||||
|
|
@ -62,7 +62,7 @@ nir_intrinsics_indices_h = custom_target(
|
||||||
'nir_intrinsics_indices.h',
|
'nir_intrinsics_indices.h',
|
||||||
input : 'nir_intrinsics_indices_h.py',
|
input : 'nir_intrinsics_indices_h.py',
|
||||||
output : 'nir_intrinsics_indices.h',
|
output : 'nir_intrinsics_indices.h',
|
||||||
command : [prog_python, '@INPUT@', '--outdir', meson.current_build_dir()],
|
command : [prog_python, '@INPUT@', '--out', '@OUTPUT@'],
|
||||||
capture : false,
|
capture : false,
|
||||||
depend_files : files('nir_intrinsics.py'),
|
depend_files : files('nir_intrinsics.py'),
|
||||||
)
|
)
|
||||||
|
|
@ -71,7 +71,7 @@ nir_intrinsics_c = custom_target(
|
||||||
'nir_intrinsic.c',
|
'nir_intrinsic.c',
|
||||||
input : 'nir_intrinsics_c.py',
|
input : 'nir_intrinsics_c.py',
|
||||||
output : 'nir_intrinsics.c',
|
output : 'nir_intrinsics.c',
|
||||||
command : [prog_python, '@INPUT@', '--outdir', meson.current_build_dir()],
|
command : [prog_python, '@INPUT@', '--out', '@OUTPUT@'],
|
||||||
capture: false,
|
capture: false,
|
||||||
depend_files : files('nir_intrinsics.py'),
|
depend_files : files('nir_intrinsics.py'),
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -72,13 +72,12 @@ import os
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('--outdir', required=True,
|
parser.add_argument('--out', required=True,
|
||||||
help='Directory to put the generated files in')
|
help='Output C file')
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
path = os.path.join(args.outdir, 'nir_intrinsics.c')
|
with open(args.out, 'w', encoding='utf-8') as f:
|
||||||
with open(path, 'w', encoding='utf-8') as f:
|
|
||||||
f.write(Template(template).render(
|
f.write(Template(template).render(
|
||||||
INTR_OPCODES=INTR_OPCODES, INTR_INDICES=INTR_INDICES,
|
INTR_OPCODES=INTR_OPCODES, INTR_INDICES=INTR_INDICES,
|
||||||
reduce=reduce, operator=operator))
|
reduce=reduce, operator=operator))
|
||||||
|
|
|
||||||
|
|
@ -56,13 +56,12 @@ import os
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('--outdir', required=True,
|
parser.add_argument('--out', required=True,
|
||||||
help='Directory to put the generated files in')
|
help='Output H file')
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
path = os.path.join(args.outdir, 'nir_intrinsics.h')
|
with open(args.out, 'w', encoding='utf-8') as f:
|
||||||
with open(path, 'w', encoding='utf-8') as f:
|
|
||||||
f.write(Template(template).render(INTR_OPCODES=INTR_OPCODES, INTR_INDICES=INTR_INDICES))
|
f.write(Template(template).render(INTR_OPCODES=INTR_OPCODES, INTR_INDICES=INTR_INDICES))
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
||||||
|
|
@ -80,13 +80,12 @@ import os
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('--outdir', required=True,
|
parser.add_argument('--out', required=True,
|
||||||
help='Directory to put the generated files in')
|
help='Output H file')
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
||||||
path = os.path.join(args.outdir, 'nir_intrinsics_indices.h')
|
with open(args.out, 'w', encoding='utf-8') as f:
|
||||||
with open(path, 'w', encoding='utf-8') as f:
|
|
||||||
f.write(Template(template).render(INTR_INDICES=INTR_INDICES))
|
f.write(Template(template).render(INTR_INDICES=INTR_INDICES))
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
||||||
|
|
@ -63,13 +63,12 @@ brw_device_sha1_update(struct mesa_sha1 *ctx,
|
||||||
def main():
|
def main():
|
||||||
"""print intel_device_serialize.c at the specified path"""
|
"""print intel_device_serialize.c at the specified path"""
|
||||||
parser = argparse.ArgumentParser()
|
parser = argparse.ArgumentParser()
|
||||||
parser.add_argument('--outdir', required=True,
|
parser.add_argument('--out', required=True,
|
||||||
help='Directory to put the generated files in')
|
help='Output C file')
|
||||||
args = parser.parse_args()
|
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
|
device_members = intel_device_info.TYPES_BY_NAME["intel_device_info"].members
|
||||||
compiler_fields = [field for field in device_members if field.compiler_field]
|
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:
|
try:
|
||||||
f.write(Template(template).render(compiler_fields=compiler_fields))
|
f.write(Template(template).render(compiler_fields=compiler_fields))
|
||||||
except:
|
except:
|
||||||
|
|
|
||||||
|
|
@ -127,7 +127,7 @@ libintel_compiler_brw_files = files(
|
||||||
brw_device_sha1_gen_src = custom_target('brw_device_sha1_gen.c',
|
brw_device_sha1_gen_src = custom_target('brw_device_sha1_gen.c',
|
||||||
input : ['brw_device_sha1_gen_c.py', '../dev/intel_device_info.py'],
|
input : ['brw_device_sha1_gen_c.py', '../dev/intel_device_info.py'],
|
||||||
output : ['brw_device_sha1_gen.c'],
|
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(
|
brw_nir_lower_fsign = custom_target(
|
||||||
|
|
|
||||||
|
|
@ -538,8 +538,14 @@ def main():
|
||||||
help='Vulkan API XML files',
|
help='Vulkan API XML files',
|
||||||
action='append',
|
action='append',
|
||||||
dest='xml_files')
|
dest='xml_files')
|
||||||
parser.add_argument('--outdir',
|
parser.add_argument('--out-c',
|
||||||
help='Directory to put the generated files in',
|
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)
|
required=True)
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
|
|
@ -559,9 +565,9 @@ def main():
|
||||||
bitmasks = sorted(bitmask_factory.registry.values(), key=lambda e: e.name)
|
bitmasks = sorted(bitmask_factory.registry.values(), key=lambda e: e.name)
|
||||||
object_types = sorted(obj_type_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')),
|
for template, file_ in [(C_TEMPLATE, args.out_c),
|
||||||
(H_TEMPLATE, os.path.join(args.outdir, 'vk_enum_to_str.h')),
|
(H_TEMPLATE, args.out_h),
|
||||||
(H_DEFINE_TEMPLATE, os.path.join(args.outdir, 'vk_enum_defines.h'))]:
|
(H_DEFINE_TEMPLATE, args.out_d)]:
|
||||||
with open(file_, 'w', encoding='utf-8') as f:
|
with open(file_, 'w', encoding='utf-8') as f:
|
||||||
f.write(template.render(
|
f.write(template.render(
|
||||||
file=os.path.basename(__file__),
|
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'],
|
output : ['vk_enum_to_str.c', 'vk_enum_to_str.h', 'vk_enum_defines.h'],
|
||||||
command : [
|
command : [
|
||||||
prog_python, '@INPUT0@', '--xml', '@INPUT1@',
|
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()
|
'--beta', with_vulkan_beta.to_string()
|
||||||
],
|
],
|
||||||
depend_files : vk_enum_to_str_depend_files,
|
depend_files : vk_enum_to_str_depend_files,
|
||||||
|
|
@ -102,7 +104,7 @@ vk_struct_type_cast = custom_target(
|
||||||
output : ['vk_struct_type_cast.h'],
|
output : ['vk_struct_type_cast.h'],
|
||||||
command : [
|
command : [
|
||||||
prog_python, '@INPUT0@', '--xml', '@INPUT1@',
|
prog_python, '@INPUT0@', '--xml', '@INPUT1@',
|
||||||
'--outdir', meson.current_build_dir(),
|
'--out', '@OUTPUT@',
|
||||||
'--beta', with_vulkan_beta.to_string()
|
'--beta', with_vulkan_beta.to_string()
|
||||||
],
|
],
|
||||||
depend_files : vk_struct_type_cast_depend_files,
|
depend_files : vk_struct_type_cast_depend_files,
|
||||||
|
|
|
||||||
|
|
@ -91,8 +91,8 @@ def main():
|
||||||
help='Vulkan API XML files',
|
help='Vulkan API XML files',
|
||||||
action='append',
|
action='append',
|
||||||
dest='xml_files')
|
dest='xml_files')
|
||||||
parser.add_argument('--outdir',
|
parser.add_argument('--out',
|
||||||
help='Directory to put the generated files in',
|
help='Output H file',
|
||||||
required=True)
|
required=True)
|
||||||
parser.add_argument('--beta', required=True, help='Enable beta extensions.')
|
parser.add_argument('--beta', required=True, help='Enable beta extensions.')
|
||||||
|
|
||||||
|
|
@ -105,7 +105,7 @@ def main():
|
||||||
|
|
||||||
structs = sorted(structs, key=lambda s: s.name)
|
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:
|
with open(file_, 'w', encoding='utf-8') as f:
|
||||||
f.write(template.render(
|
f.write(template.render(
|
||||||
file=os.path.basename(__file__),
|
file=os.path.basename(__file__),
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue