Clone of mesa.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

SConscript 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  1. import common
  2. Import('*')
  3. from sys import executable as python_cmd
  4. env = env.Clone()
  5. env.MSVC2013Compat()
  6. env.Prepend(CPPPATH = [
  7. '#include',
  8. '#src',
  9. '#src/mapi',
  10. '#src/mesa',
  11. '#src/gallium/include',
  12. '#src/gallium/auxiliary',
  13. '#src/glsl',
  14. '#src/glsl/glcpp',
  15. ])
  16. env.Prepend(LIBS = [mesautil])
  17. # Make glcpp-parse.h and glsl_parser.h reachable from the include path.
  18. env.Append(CPPPATH = [Dir('.').abspath, Dir('glcpp').abspath])
  19. glcpp_env = env.Clone()
  20. glcpp_env.Append(YACCFLAGS = [
  21. '-d',
  22. '-p', 'glcpp_parser_'
  23. ])
  24. glsl_env = env.Clone()
  25. glsl_env.Append(YACCFLAGS = [
  26. '--defines=%s' % File('glsl_parser.h').abspath,
  27. '-p', '_mesa_glsl_',
  28. ])
  29. # without this line scons will expect "glsl_parser.hpp" instead of
  30. # "glsl_parser.h", causing glsl_parser.cpp to be regenerated every time
  31. glsl_env['YACCHXXFILESUFFIX'] = '.h'
  32. glcpp_lexer = glcpp_env.CFile('glcpp/glcpp-lex.c', 'glcpp/glcpp-lex.l')
  33. glcpp_parser = glcpp_env.CFile('glcpp/glcpp-parse.c', 'glcpp/glcpp-parse.y')
  34. glsl_lexer = glsl_env.CXXFile('glsl_lexer.cpp', 'glsl_lexer.ll')
  35. glsl_parser = glsl_env.CXXFile('glsl_parser.cpp', 'glsl_parser.yy')
  36. # common generated sources
  37. glsl_sources = [
  38. glcpp_lexer,
  39. glcpp_parser[0],
  40. glsl_lexer,
  41. glsl_parser[0],
  42. ]
  43. # parse Makefile.sources
  44. source_lists = env.ParseSourceList('Makefile.sources')
  45. # add non-generated sources
  46. for l in ('LIBGLCPP_FILES', 'LIBGLSL_FILES'):
  47. glsl_sources += source_lists[l]
  48. if env['msvc']:
  49. env.Prepend(CPPPATH = ['#/src/getopt'])
  50. env.PrependUnique(LIBS = [getopt])
  51. # Copy these files to avoid generation object files into src/mesa/program
  52. env.Prepend(CPPPATH = ['#src/mesa/main'])
  53. env.Command('imports.c', '#src/mesa/main/imports.c', Copy('$TARGET', '$SOURCE'))
  54. # Copy these files to avoid generation object files into src/mesa/program
  55. env.Prepend(CPPPATH = ['#src/mesa/program'])
  56. env.Command('prog_hash_table.c', '#src/mesa/program/prog_hash_table.c', Copy('$TARGET', '$SOURCE'))
  57. env.Command('symbol_table.c', '#src/mesa/program/symbol_table.c', Copy('$TARGET', '$SOURCE'))
  58. env.Command('dummy_errors.c', '#src/mesa/program/dummy_errors.c', Copy('$TARGET', '$SOURCE'))
  59. compiler_objs = env.StaticObject(source_lists['GLSL_COMPILER_CXX_FILES'])
  60. mesa_objs = env.StaticObject([
  61. 'imports.c',
  62. 'prog_hash_table.c',
  63. 'symbol_table.c',
  64. 'dummy_errors.c',
  65. ])
  66. compiler_objs += mesa_objs
  67. glsl = env.ConvenienceLibrary(
  68. target = 'glsl',
  69. source = glsl_sources,
  70. )
  71. # SCons builtin dependency scanner doesn't detect that glsl_lexer.ll depends on
  72. # glsl_parser.h
  73. env.Depends(glsl, glsl_parser)
  74. Export('glsl')
  75. # Skip building these programs as they will cause SCons error "Two environments
  76. # with different actions were specified for the same target"
  77. if env['crosscompile'] or env['embedded']:
  78. Return()
  79. env = env.Clone()
  80. if env['platform'] == 'windows':
  81. env.PrependUnique(LIBS = [
  82. 'user32',
  83. ])
  84. env.Prepend(LIBS = [compiler, glsl])
  85. glsl_compiler = env.Program(
  86. target = 'glsl_compiler',
  87. source = compiler_objs,
  88. )
  89. env.Alias('glsl_compiler', glsl_compiler)
  90. glcpp = env.Program(
  91. target = 'glcpp/glcpp',
  92. source = ['glcpp/glcpp.c'] + mesa_objs,
  93. )
  94. env.Alias('glcpp', glcpp)