2009-12-10 16:29:04 +00:00
|
|
|
import common
|
|
|
|
|
|
|
|
Import('*')
|
|
|
|
|
2011-01-07 22:30:14 +00:00
|
|
|
from sys import executable as python_cmd
|
|
|
|
|
2009-12-10 16:29:04 +00:00
|
|
|
env = env.Clone()
|
|
|
|
|
2015-03-04 14:23:52 +00:00
|
|
|
env.MSVC2013Compat()
|
|
|
|
|
2010-08-13 13:55:34 +01:00
|
|
|
env.Prepend(CPPPATH = [
|
2011-01-31 21:07:12 +00:00
|
|
|
'#include',
|
2014-02-25 07:39:14 +00:00
|
|
|
'#src',
|
2010-08-13 13:55:34 +01:00
|
|
|
'#src/mapi',
|
|
|
|
'#src/mesa',
|
2015-02-11 22:18:50 +00:00
|
|
|
'#src/gallium/include',
|
|
|
|
'#src/gallium/auxiliary',
|
2016-04-05 14:05:19 +01:00
|
|
|
'#src/compiler/glsl',
|
|
|
|
'#src/compiler/glsl/glcpp',
|
2016-05-26 00:00:38 +01:00
|
|
|
'#src/compiler/nir',
|
2010-08-13 13:55:34 +01:00
|
|
|
])
|
|
|
|
|
2014-02-25 07:39:14 +00:00
|
|
|
env.Prepend(LIBS = [mesautil])
|
|
|
|
|
2012-06-19 08:02:53 +01:00
|
|
|
# Make glcpp-parse.h and glsl_parser.h reachable from the include path.
|
2016-04-05 14:05:19 +01:00
|
|
|
env.Prepend(CPPPATH = [Dir('.').abspath, Dir('glsl').abspath])
|
2016-05-26 00:00:38 +01:00
|
|
|
# Make NIR headers reachable from the include path.
|
|
|
|
env.Prepend(CPPPATH = [Dir('.').abspath, Dir('nir').abspath])
|
2011-03-03 16:57:38 +00:00
|
|
|
|
2015-03-19 13:35:18 +00:00
|
|
|
glcpp_env = env.Clone()
|
|
|
|
glcpp_env.Append(YACCFLAGS = [
|
|
|
|
'-d',
|
|
|
|
'-p', 'glcpp_parser_'
|
|
|
|
])
|
2011-03-01 23:04:04 +00:00
|
|
|
|
2015-03-19 13:35:18 +00:00
|
|
|
glsl_env = env.Clone()
|
|
|
|
glsl_env.Append(YACCFLAGS = [
|
2016-04-05 14:05:19 +01:00
|
|
|
'--defines=%s' % File('glsl/glsl_parser.h').abspath,
|
2011-03-03 16:57:38 +00:00
|
|
|
'-p', '_mesa_glsl_',
|
|
|
|
])
|
2011-03-01 23:04:04 +00:00
|
|
|
|
2012-08-02 16:40:40 +01:00
|
|
|
# without this line scons will expect "glsl_parser.hpp" instead of
|
|
|
|
# "glsl_parser.h", causing glsl_parser.cpp to be regenerated every time
|
2015-03-19 13:35:18 +00:00
|
|
|
glsl_env['YACCHXXFILESUFFIX'] = '.h'
|
2012-08-02 16:40:40 +01:00
|
|
|
|
2016-04-05 14:05:19 +01:00
|
|
|
glcpp_lexer = glcpp_env.CFile('glsl/glcpp/glcpp-lex.c', 'glsl/glcpp/glcpp-lex.l')
|
|
|
|
glcpp_parser = glcpp_env.CFile('glsl/glcpp/glcpp-parse.c', 'glsl/glcpp/glcpp-parse.y')
|
|
|
|
glsl_lexer = glsl_env.CXXFile('glsl/glsl_lexer.cpp', 'glsl/glsl_lexer.ll')
|
|
|
|
glsl_parser = glsl_env.CXXFile('glsl/glsl_parser.cpp', 'glsl/glsl_parser.yy')
|
2011-03-01 23:04:04 +00:00
|
|
|
|
2011-10-30 11:32:25 +00:00
|
|
|
# common generated sources
|
2011-03-04 13:11:49 +00:00
|
|
|
glsl_sources = [
|
2011-03-01 23:04:04 +00:00
|
|
|
glcpp_lexer,
|
|
|
|
glcpp_parser[0],
|
|
|
|
glsl_lexer,
|
|
|
|
glsl_parser[0],
|
2016-05-25 14:30:06 +01:00
|
|
|
]
|
2009-12-10 16:29:04 +00:00
|
|
|
|
2011-10-30 11:32:25 +00:00
|
|
|
# parse Makefile.sources
|
|
|
|
source_lists = env.ParseSourceList('Makefile.sources')
|
|
|
|
|
|
|
|
# add non-generated sources
|
2012-11-07 07:18:38 +00:00
|
|
|
for l in ('LIBGLCPP_FILES', 'LIBGLSL_FILES'):
|
2011-10-30 11:32:25 +00:00
|
|
|
glsl_sources += source_lists[l]
|
|
|
|
|
2011-03-04 13:11:49 +00:00
|
|
|
if env['msvc']:
|
|
|
|
env.Prepend(CPPPATH = ['#/src/getopt'])
|
|
|
|
env.PrependUnique(LIBS = [getopt])
|
|
|
|
|
2013-09-04 05:22:17 +01:00
|
|
|
# Copy these files to avoid generation object files into src/mesa/program
|
|
|
|
env.Prepend(CPPPATH = ['#src/mesa/main'])
|
2016-04-05 14:05:19 +01:00
|
|
|
env.Command('glsl/imports.c', '#src/mesa/main/imports.c', Copy('$TARGET', '$SOURCE'))
|
2013-09-04 05:22:17 +01:00
|
|
|
# Copy these files to avoid generation object files into src/mesa/program
|
|
|
|
env.Prepend(CPPPATH = ['#src/mesa/program'])
|
2016-04-05 14:05:19 +01:00
|
|
|
env.Command('glsl/prog_hash_table.c', '#src/mesa/program/prog_hash_table.c', Copy('$TARGET', '$SOURCE'))
|
|
|
|
env.Command('glsl/symbol_table.c', '#src/mesa/program/symbol_table.c', Copy('$TARGET', '$SOURCE'))
|
|
|
|
env.Command('glsl/dummy_errors.c', '#src/mesa/program/dummy_errors.c', Copy('$TARGET', '$SOURCE'))
|
2013-09-04 05:22:17 +01:00
|
|
|
|
|
|
|
compiler_objs = env.StaticObject(source_lists['GLSL_COMPILER_CXX_FILES'])
|
|
|
|
|
|
|
|
mesa_objs = env.StaticObject([
|
2016-04-05 14:05:19 +01:00
|
|
|
'glsl/imports.c',
|
|
|
|
'glsl/prog_hash_table.c',
|
|
|
|
'glsl/symbol_table.c',
|
|
|
|
'glsl/dummy_errors.c',
|
2013-09-04 05:22:17 +01:00
|
|
|
])
|
2011-02-11 17:38:54 +00:00
|
|
|
|
2013-09-04 05:22:17 +01:00
|
|
|
compiler_objs += mesa_objs
|
2011-01-12 16:58:37 +00:00
|
|
|
|
2009-12-28 15:22:17 +00:00
|
|
|
glsl = env.ConvenienceLibrary(
|
2009-12-10 16:29:04 +00:00
|
|
|
target = 'glsl',
|
2011-03-04 13:11:49 +00:00
|
|
|
source = glsl_sources,
|
2009-12-10 16:29:04 +00:00
|
|
|
)
|
|
|
|
|
2011-03-03 16:57:38 +00:00
|
|
|
# SCons builtin dependency scanner doesn't detect that glsl_lexer.ll depends on
|
|
|
|
# glsl_parser.h
|
|
|
|
env.Depends(glsl, glsl_parser)
|
|
|
|
|
2009-12-10 16:29:04 +00:00
|
|
|
Export('glsl')
|
|
|
|
|
2011-03-04 14:29:06 +00:00
|
|
|
# Skip building these programs as they will cause SCons error "Two environments
|
|
|
|
# with different actions were specified for the same target"
|
2011-06-17 14:48:28 +01:00
|
|
|
if env['crosscompile'] or env['embedded']:
|
2011-03-04 14:29:06 +00:00
|
|
|
Return()
|
|
|
|
|
2009-12-10 16:29:04 +00:00
|
|
|
env = env.Clone()
|
|
|
|
|
|
|
|
if env['platform'] == 'windows':
|
|
|
|
env.PrependUnique(LIBS = [
|
|
|
|
'user32',
|
|
|
|
])
|
|
|
|
|
2016-01-18 08:47:13 +00:00
|
|
|
env.Prepend(LIBS = [compiler, glsl])
|
2009-12-10 16:29:04 +00:00
|
|
|
|
2016-05-14 16:59:26 +01:00
|
|
|
compiler_objs += env.StaticObject("glsl/main.cpp")
|
|
|
|
|
2013-09-09 15:58:08 +01:00
|
|
|
glsl_compiler = env.Program(
|
|
|
|
target = 'glsl_compiler',
|
2011-10-30 11:32:25 +00:00
|
|
|
source = compiler_objs,
|
2009-12-10 16:29:04 +00:00
|
|
|
)
|
2013-09-09 15:58:08 +01:00
|
|
|
env.Alias('glsl_compiler', glsl_compiler)
|
2009-12-10 16:29:04 +00:00
|
|
|
|
2011-03-04 13:11:49 +00:00
|
|
|
glcpp = env.Program(
|
2016-04-05 14:05:19 +01:00
|
|
|
target = 'glsl/glcpp/glcpp',
|
|
|
|
source = ['glsl/glcpp/glcpp.c'] + mesa_objs,
|
2009-12-10 16:29:04 +00:00
|
|
|
)
|
2011-03-04 13:11:49 +00:00
|
|
|
env.Alias('glcpp', glcpp)
|