[Mesa-dev] [PATCH 01/17] scons: Build NIR.
Rob Clark
robdclark at gmail.com
Wed May 11 16:24:13 UTC 2016
On Tue, May 10, 2016 at 3:43 PM, Emil Velikov <emil.l.velikov at gmail.com> wrote:
> On 9 May 2016 at 20:33, Rob Clark <robdclark at gmail.com> wrote:
>> From: Jose Fonseca <jfonseca at vmware.com>
>>
>> Signed-off-by: Rob Clark <robclark at freedesktop.org>
>> ---
>> src/compiler/SConscript | 57 +++++++++++++++++++++++++++++++++++++++++++++++--
>> 1 file changed, 55 insertions(+), 2 deletions(-)
>>
>> diff --git a/src/compiler/SConscript b/src/compiler/SConscript
>> index 10c79c4..dde4dfd 100644
>> --- a/src/compiler/SConscript
>> +++ b/src/compiler/SConscript
>> @@ -1,5 +1,7 @@
>> Import('*')
>>
>> +from sys import executable as python_cmd
>> +
>> env = env.Clone()
>>
>> env.MSVC2013Compat()
>> @@ -11,13 +13,64 @@ env.Prepend(CPPPATH = [
>> '#src/mesa',
>> '#src/gallium/include',
>> '#src/gallium/auxiliary',
>> + '#src/compiler',
>> + '#src/compiler/nir',
>> +])
>> +
>> +
>> +# Make generated headers reachable from the include path.
>> +env.Append(CPPPATH = [
>> + Dir('nir').abspath
>> ])
>>
>> -sources = env.ParseSourceList('Makefile.sources', 'LIBCOMPILER_FILES')
>> +# nir generated sources
>> +
>> +nir_builder_opcodes_h = env.CodeGenerate(
>> + target = 'nir/nir_builder_opcodes.h',
>> + script = 'nir/nir_builder_opcodes_h.py',
>> + source = [],
>> + command = python_cmd + ' $SCRIPT > $TARGET'
>> +)
>> +
>> +env.CodeGenerate(
>> + target = 'nir/nir_constant_expressions.c',
>> + script = 'nir/nir_constant_expressions.py',
>> + source = [],
>> + command = python_cmd + ' $SCRIPT > $TARGET'
>> +)
>> +
>> +env.CodeGenerate(
>> + target = 'nir/nir_opcodes.h',
>> + script = 'nir/nir_opcodes_h.py',
>> + source = [],
>> + command = python_cmd + ' $SCRIPT > $TARGET'
>> +)
>> +
>> +env.CodeGenerate(
>> + target = 'nir/nir_opcodes.c',
>> + script = 'nir/nir_opcodes_c.py',
>> + source = [],
>> + command = python_cmd + ' $SCRIPT > $TARGET'
>> +)
>> +
>> +env.CodeGenerate(
>> + target = 'nir/nir_opt_algebraic.c',
>> + script = 'nir/nir_algebraic.py',
>> + source = [],
>> + command = python_cmd + ' $SCRIPT > $TARGET'
>> +)
>> +
>> +# parse Makefile.sources
>> +source_lists = env.ParseSourceList('Makefile.sources')
>> +
>> +nir_sources = []
>> +nir_sources += source_lists['LIBCOMPILER_FILES']
>> +nir_sources += source_lists['NIR_FILES']
>> +nir_sources += source_lists['NIR_GENERATED_FILES']
>>
>> compiler = env.ConvenienceLibrary(
>> target = 'compiler',
>> - source = sources
>> + source = nir_sources
>> )
>> Export('compiler')
>>
> NIR already has scons build support. One just needs to add the static
> (convenience in scons speak) library 'nir' into the respective
> place(s). Something like the following untested hunk should do it. And
> yes, it is a bit nasty looking.
>
> -Emil
>
> diff --git a/src/compiler/SConscript.glsl b/src/compiler/SConscript.glsl
> index 43a11d1..4e5133b 100644
> --- a/src/compiler/SConscript.glsl
> +++ b/src/compiler/SConscript.glsl
> @@ -64,6 +64,8 @@ if env['msvc']:
> env.Prepend(CPPPATH = ['#/src/getopt'])
> env.PrependUnique(LIBS = [getopt])
>
> +env.Prepend(LIBS = [nir])
> +
> # Copy these files to avoid generation object files into src/mesa/program
> env.Prepend(CPPPATH = ['#src/mesa/main'])
> env.Command('glsl/imports.c', '#src/mesa/main/imports.c',
> Copy('$TARGET', '$SOURCE'))
hmm, seems to take more than that... but not planning to push the
parts that introduce mesa/st dependency on NIR yet so if you want to
handle adding nir to scons build, I'm happy to drop the patch..
$ scons
scons: Reading SConscript files ...
Checking for GCC ... yes
Checking for Clang ... no
scons: Found LLVM version 3.7.0
Checking for X11 (x11 xext xdamage xfixes glproto >= 1.4.13)... yes
Checking for XCB (x11-xcb xcb-glx >= 1.8.1 xcb-dri2 >= 1.8)... yes
Checking for XF86VIDMODE (xxf86vm)... yes
Checking for DRM (libdrm >= 2.4.38)... yes
Checking for UDEV (libudev >= 151)... yes
NameError: name 'nir' is not defined:
File "/home/robclark/tmp/mesa/SConstruct", line 143:
duplicate = 0 # http://www.scons.org/doc/0.97/HTML/scons-user/x2261.html
File "/usr/lib/scons/SCons/Script/SConscript.py", line 614:
return method(*args, **kw)
File "/usr/lib/scons/SCons/Script/SConscript.py", line 551:
return _SConscript(self.fs, *files, **subst_kw)
File "/usr/lib/scons/SCons/Script/SConscript.py", line 260:
exec _file_ in call_stack[-1].globals
File "/home/robclark/tmp/mesa/src/SConscript", line 8:
SConscript('compiler/SConscript')
File "/usr/lib/scons/SCons/Script/SConscript.py", line 614:
return method(*args, **kw)
File "/usr/lib/scons/SCons/Script/SConscript.py", line 551:
return _SConscript(self.fs, *files, **subst_kw)
File "/usr/lib/scons/SCons/Script/SConscript.py", line 260:
exec _file_ in call_stack[-1].globals
File "/home/robclark/tmp/mesa/src/compiler/SConscript", line 24:
SConscript('SConscript.glsl')
File "/usr/lib/scons/SCons/Script/SConscript.py", line 614:
return method(*args, **kw)
File "/usr/lib/scons/SCons/Script/SConscript.py", line 551:
return _SConscript(self.fs, *files, **subst_kw)
File "/usr/lib/scons/SCons/Script/SConscript.py", line 260:
exec _file_ in call_stack[-1].globals
File "/home/robclark/tmp/mesa/src/compiler/SConscript.glsl", line 67:
env.Prepend(LIBS = [nir])
BR,
-R
More information about the mesa-dev
mailing list