Merge remote branch 'origin/master' into pipe-video
[mesa.git] / src / glsl / SConscript
index f179721d527afe78dbcc831365582788ccbdcf63..7c6b6ae8c4df80541653cf1a257c3424a2933fa2 100644 (file)
@@ -2,16 +2,17 @@ import common
 
 Import('*')
 
+from sys import executable as python_cmd
+
 env = env.Clone()
 
 env.Prepend(CPPPATH = [
+    '#include',
     '#src/mapi',
     '#src/mesa',
+    '#src/glsl',
 ])
 
-if env['platform'] == 'windows':
-    env.Prepend(CPPPATH = ['#src/talloc'])
-
 sources = [
     'glcpp/glcpp-lex.c',
     'glcpp/glcpp-parse.c',
@@ -20,7 +21,6 @@ sources = [
     'ast_function.cpp',
     'ast_to_hir.cpp',
     'ast_type.cpp',
-    'builtin_function.cpp',
     'glsl_lexer.cpp',
     'glsl_parser.cpp',
     'glsl_parser_extras.cpp',
@@ -64,6 +64,7 @@ sources = [
     'opt_constant_propagation.cpp',
     'opt_constant_variable.cpp',
     'opt_copy_propagation.cpp',
+    'opt_copy_propagation_elements.cpp',
     'opt_dead_code.cpp',
     'opt_dead_code_local.cpp',
     'opt_dead_functions.cpp',
@@ -75,9 +76,42 @@ sources = [
     'opt_structure_splitting.cpp',
     'opt_swizzle_swizzle.cpp',
     'opt_tree_grafting.cpp',
+    'ralloc.c',
     's_expression.cpp',
     'strtod.c',
-]
+] 
+
+
+if env['crosscompile'] and env['platform'] != 'embedded':
+    Import('builtin_glsl_function')
+else:
+    if env['msvc']:
+        env.Prepend(CPPPATH = ['#/src/getopt'])
+        env.PrependUnique(LIBS = [getopt])
+
+    builtin_compiler = env.Program(
+        target = 'builtin_compiler',
+        source = sources + ['main.cpp', 'builtin_stubs.cpp',
+                            '#src/mesa/program/hash_table.c',
+                            '#src/mesa/program/symbol_table.c'],
+    )
+
+    builtin_glsl_function = env.CodeGenerate(
+        target = 'builtin_function.cpp',
+        script = 'builtins/tools/generate_builtins.py',
+        source = builtin_compiler,
+        command = python_cmd + ' $SCRIPT $SOURCE > $TARGET'
+    )
+
+    env.Depends(builtin_glsl_function, ['builtins/tools/generate_builtins.py', 'builtins/tools/texture_builtins.py'] + Glob('builtins/ir/*'))
+
+    Export('builtin_glsl_function')
+
+    if env['hostonly']:
+        Return()
+
+
+sources += builtin_glsl_function
 
 glsl = env.ConvenienceLibrary(
     target = 'glsl',
@@ -96,7 +130,7 @@ if env['platform'] == 'windows':
         'user32',
     ])
 
-env.Prepend(LIBS = [glsl, talloc])
+env.Prepend(LIBS = [glsl])
 
 env.Program(
     target = 'glsl2',