5 from sys import executable as python_cmd
11 env.Prepend(CPPPATH = [
16 '#src/gallium/include',
17 '#src/gallium/auxiliary',
23 env.Prepend(LIBS = [mesautil])
25 # Make glcpp-parse.h and glsl_parser.h reachable from the include path.
26 env.Append(CPPPATH = [Dir('.').abspath, Dir('glcpp').abspath])
28 glcpp_env = env.Clone()
29 glcpp_env.Append(YACCFLAGS = [
34 glsl_env = env.Clone()
35 glsl_env.Append(YACCFLAGS = [
36 '--defines=%s' % File('glsl_parser.h').abspath,
40 # without this line scons will expect "glsl_parser.hpp" instead of
41 # "glsl_parser.h", causing glsl_parser.cpp to be regenerated every time
42 glsl_env['YACCHXXFILESUFFIX'] = '.h'
44 glcpp_lexer = glcpp_env.CFile('glcpp/glcpp-lex.c', 'glcpp/glcpp-lex.l')
45 glcpp_parser = glcpp_env.CFile('glcpp/glcpp-parse.c', 'glcpp/glcpp-parse.y')
46 glsl_lexer = glsl_env.CXXFile('glsl_lexer.cpp', 'glsl_lexer.ll')
47 glsl_parser = glsl_env.CXXFile('glsl_parser.cpp', 'glsl_parser.yy')
49 # common generated sources
57 # parse Makefile.sources
58 source_lists = env.ParseSourceList('Makefile.sources')
60 # add non-generated sources
61 for l in ('LIBGLCPP_FILES', 'LIBGLSL_FILES'):
62 glsl_sources += source_lists[l]
65 env.Prepend(CPPPATH = ['#/src/getopt'])
66 env.PrependUnique(LIBS = [getopt])
68 # Copy these files to avoid generation object files into src/mesa/program
69 env.Prepend(CPPPATH = ['#src/mesa/main'])
70 env.Command('imports.c', '#src/mesa/main/imports.c', Copy('$TARGET', '$SOURCE'))
71 # Copy these files to avoid generation object files into src/mesa/program
72 env.Prepend(CPPPATH = ['#src/mesa/program'])
73 env.Command('prog_hash_table.c', '#src/mesa/program/prog_hash_table.c', Copy('$TARGET', '$SOURCE'))
74 env.Command('symbol_table.c', '#src/mesa/program/symbol_table.c', Copy('$TARGET', '$SOURCE'))
75 env.Command('dummy_errors.c', '#src/mesa/program/dummy_errors.c', Copy('$TARGET', '$SOURCE'))
77 compiler_objs = env.StaticObject(source_lists['GLSL_COMPILER_CXX_FILES'])
79 mesa_objs = env.StaticObject([
87 compiler_objs += mesa_objs
89 glsl = env.ConvenienceLibrary(
91 source = glsl_sources,
94 # SCons builtin dependency scanner doesn't detect that glsl_lexer.ll depends on
96 env.Depends(glsl, glsl_parser)
100 # Skip building these programs as they will cause SCons error "Two environments
101 # with different actions were specified for the same target"
102 if env['crosscompile'] or env['embedded']:
107 if env['platform'] == 'windows':
108 env.PrependUnique(LIBS = [
112 env.Prepend(LIBS = [glsl])
114 glsl_compiler = env.Program(
115 target = 'glsl_compiler',
116 source = compiler_objs,
118 env.Alias('glsl_compiler', glsl_compiler)
121 target = 'glcpp/glcpp',
122 source = ['glcpp/glcpp.c'] + mesa_objs,
124 env.Alias('glcpp', glcpp)