mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-02-21 01:20:30 +01:00
driconf: add support for multiple input files in the static script
RADV has its own drirc file and this is required to fix the static driconf path. Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Eric Engestrom <eric@igalia.com> Reviewed-by: Dylan Baker <dylan@pnwbakers.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20077>
This commit is contained in:
parent
686ada78cd
commit
60ff0df39b
2 changed files with 18 additions and 9 deletions
|
|
@ -22,8 +22,8 @@
|
|||
|
||||
from mako.template import Template
|
||||
from xml.etree import ElementTree
|
||||
import argparse
|
||||
import os
|
||||
import sys
|
||||
|
||||
def dbg(str):
|
||||
if False:
|
||||
|
|
@ -80,12 +80,13 @@ class Device(object):
|
|||
self.engines.append(Engine(engine))
|
||||
|
||||
class DriConf(object):
|
||||
def __init__(self, xmlpath):
|
||||
def __init__(self, xmlpaths):
|
||||
self.devices = []
|
||||
root = ElementTree.parse(xmlpath).getroot()
|
||||
for xmlpath in xmlpaths:
|
||||
root = ElementTree.parse(xmlpath).getroot()
|
||||
|
||||
for device in root.findall('device'):
|
||||
self.devices.append(Device(device))
|
||||
for device in root.findall('device'):
|
||||
self.devices.append(Device(device))
|
||||
|
||||
|
||||
template = """\
|
||||
|
|
@ -225,8 +226,16 @@ static const struct driconf_device *driconf[] = {
|
|||
};
|
||||
"""
|
||||
|
||||
xml = sys.argv[1]
|
||||
dst = sys.argv[2]
|
||||
parser = argparse.ArgumentParser()
|
||||
parser.add_argument('drirc',
|
||||
nargs=argparse.ONE_OR_MORE,
|
||||
help='drirc *.conf file(s) to statically include')
|
||||
parser.add_argument('header',
|
||||
help='C header file to output the static configuration to')
|
||||
args = parser.parse_args()
|
||||
|
||||
xml = args.drirc
|
||||
dst = args.header
|
||||
|
||||
with open(dst, 'wb') as f:
|
||||
f.write(Template(template, output_encoding='utf-8').render(driconf=DriConf(xml)))
|
||||
|
|
|
|||
|
|
@ -191,10 +191,10 @@ files_xmlconfig = files(
|
|||
|
||||
files_xmlconfig += custom_target(
|
||||
'driconf_static.h',
|
||||
input: ['driconf_static.py', '00-mesa-defaults.conf'],
|
||||
input: ['driconf_static.py'] + files_drirc,
|
||||
output: 'driconf_static.h',
|
||||
command: [
|
||||
prog_python, '@INPUT0@', '@INPUT1@', '@OUTPUT@'
|
||||
prog_python, '@INPUT@', '@OUTPUT@',
|
||||
],
|
||||
)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue