mesa/src/util/SConscript
Jonathan Marek 84ed2d0980 util/format: expose generated format packing functions through a header
Some of the generated functions can be useful without going through the
format table (filling border color struct in turnip). By not calling these
functions through the format table, we should eventually be able to garbage
collect the unused packing functions, and also allows LTOs to happen.

Signed-off-by: Jonathan Marek <jonathan@marek.ca>
Reviewed-by: Eric Anholt <eric@anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6093>
2020-08-13 16:54:06 +00:00

96 lines
2 KiB
Python

import common
Import('*')
from sys import executable as python_cmd
env = env.Clone()
env.MSVC2013Compat()
env.Prepend(CPPPATH = [
'#include',
'#src',
'#src/mapi',
'#src/mesa',
'#src/gallium/include',
'#src/gallium/auxiliary',
'#src/util',
'#src/util/format',
])
env.CodeGenerate(
target = 'format_srgb.c',
script = 'format_srgb.py',
source = [],
command = python_cmd + ' $SCRIPT > $TARGET'
)
env.CodeGenerate(
target = 'format/u_format_pack.h',
script = 'format/u_format_table.py',
source = ['format/u_format.csv'],
command = python_cmd + ' $SCRIPT $SOURCE --header > $TARGET'
)
env.Depends('format/u_format_pack.h', [
'format/u_format_parse.py',
'format/u_format_pack.py',
])
env.CodeGenerate(
target = 'format/u_format_table.c',
script = 'format/u_format_table.py',
source = ['format/u_format.csv'],
command = python_cmd + ' $SCRIPT $SOURCE > $TARGET'
)
env.Depends('format/u_format_table.c', [
'format/u_format_parse.py',
'format/u_format_pack.py',
])
# parse Makefile.sources
source_lists = env.ParseSourceList('Makefile.sources')
mesautil_sources = (
source_lists['MESA_UTIL_FILES'] +
source_lists['MESA_UTIL_GENERATED_FILES']
)
mesautilenv = env.Clone()
if env['dri']:
mesautil_sources += source_lists['XMLCONFIG_FILES']
mesautilenv.AppendUnique(LIBS = [
'expat',
])
mesautil = mesautilenv.ConvenienceLibrary(
target = 'mesautil',
source = mesautil_sources,
)
env.Alias('mesautil', mesautil)
Export('mesautil')
u_atomic_test = env.Program(
target = 'u_atomic_test',
source = ['u_atomic_test.c'],
)
env.UnitTest("u_atomic_test", u_atomic_test)
roundeven_test = env.Program(
target = 'roundeven_test',
source = ['roundeven_test.c'],
)
env.UnitTest("roundeven_test", roundeven_test)
env.Prepend(LIBS = [mesautil])
mesa_sha1_test = env.Program(
target = 'mesa-sha1_test',
source = ['mesa-sha1_test.c'],
)
env.UnitTest("mesa-sha1_test", mesa_sha1_test)