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 4.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158
  1. import common
  2. Import('*')
  3. from sys import executable as python_cmd
  4. env = env.Clone()
  5. env.Prepend(CPPPATH = [
  6. '#src/mapi',
  7. '#src/mesa',
  8. '#src/glsl',
  9. ])
  10. if env['platform'] == 'windows':
  11. env.Prepend(CPPPATH = ['#src/talloc'])
  12. sources = [
  13. 'glcpp/glcpp-lex.c',
  14. 'glcpp/glcpp-parse.c',
  15. 'glcpp/pp.c',
  16. 'ast_expr.cpp',
  17. 'ast_function.cpp',
  18. 'ast_to_hir.cpp',
  19. 'ast_type.cpp',
  20. 'glsl_lexer.cpp',
  21. 'glsl_parser.cpp',
  22. 'glsl_parser_extras.cpp',
  23. 'glsl_types.cpp',
  24. 'glsl_symbol_table.cpp',
  25. 'hir_field_selection.cpp',
  26. 'ir_basic_block.cpp',
  27. 'ir_clone.cpp',
  28. 'ir_constant_expression.cpp',
  29. 'ir.cpp',
  30. 'ir_expression_flattening.cpp',
  31. 'ir_function_can_inline.cpp',
  32. 'ir_function.cpp',
  33. 'ir_hierarchical_visitor.cpp',
  34. 'ir_hv_accept.cpp',
  35. 'ir_import_prototypes.cpp',
  36. 'ir_print_visitor.cpp',
  37. 'ir_reader.cpp',
  38. 'ir_rvalue_visitor.cpp',
  39. 'ir_set_program_inouts.cpp',
  40. 'ir_validate.cpp',
  41. 'ir_variable.cpp',
  42. 'ir_variable_refcount.cpp',
  43. 'linker.cpp',
  44. 'link_functions.cpp',
  45. 'loop_analysis.cpp',
  46. 'loop_controls.cpp',
  47. 'loop_unroll.cpp',
  48. 'lower_discard.cpp',
  49. 'lower_if_to_cond_assign.cpp',
  50. 'lower_instructions.cpp',
  51. 'lower_jumps.cpp',
  52. 'lower_mat_op_to_vec.cpp',
  53. 'lower_noise.cpp',
  54. 'lower_variable_index_to_cond_assign.cpp',
  55. 'lower_vec_index_to_cond_assign.cpp',
  56. 'lower_vec_index_to_swizzle.cpp',
  57. 'lower_vector.cpp',
  58. 'opt_algebraic.cpp',
  59. 'opt_constant_folding.cpp',
  60. 'opt_constant_propagation.cpp',
  61. 'opt_constant_variable.cpp',
  62. 'opt_copy_propagation.cpp',
  63. 'opt_dead_code.cpp',
  64. 'opt_dead_code_local.cpp',
  65. 'opt_dead_functions.cpp',
  66. 'opt_discard_simplification.cpp',
  67. 'opt_function_inlining.cpp',
  68. 'opt_if_simplification.cpp',
  69. 'opt_noop_swizzle.cpp',
  70. 'opt_redundant_jumps.cpp',
  71. 'opt_structure_splitting.cpp',
  72. 'opt_swizzle_swizzle.cpp',
  73. 'opt_tree_grafting.cpp',
  74. 'ralloc.c',
  75. 's_expression.cpp',
  76. 'strtod.c',
  77. ]
  78. if env['platform'] == common.host_platform:
  79. if env['msvc']:
  80. env.Prepend(CPPPATH = ['#/src/getopt'])
  81. env.PrependUnique(LIBS = [getopt])
  82. if env['platform'] == 'windows':
  83. env.Prepend(CPPPATH = ['#src/talloc'])
  84. env.Prepend(LIBS = [talloc])
  85. else:
  86. env.Prepend(CPPPATH = ['#include'])
  87. env.Prepend(LIBS = ['talloc'])
  88. builtin_compiler = env.Program(
  89. target = 'builtin_compiler',
  90. source = sources + ['main.cpp', 'builtin_stubs.cpp',
  91. '#src/mesa/program/hash_table.c',
  92. '#src/mesa/program/symbol_table.c'],
  93. )
  94. builtin_glsl_function = env.CodeGenerate(
  95. target = 'builtin_function.cpp',
  96. script = 'builtins/tools/generate_builtins.py',
  97. source = builtin_compiler,
  98. command = python_cmd + ' $SCRIPT $SOURCE > $TARGET'
  99. )
  100. env.Depends(builtin_glsl_function, ['builtins/tools/generate_builtins.py', 'builtins/tools/texture_builtins.py'] + Glob('builtins/ir/*'))
  101. if env['msvc']:
  102. # There is no LD_LIBRARY_PATH equivalent on Windows. We need to ensure
  103. # talloc.dll is on the same dir as builtin_function.
  104. talloc_dll_src = talloc.dir.File('talloc.dll')
  105. talloc_dll_dst = builtin_compiler[0].dir.File('talloc.dll')
  106. talloc_dll = env.Command(talloc_dll_dst, talloc_dll_src, Copy(talloc_dll_dst, talloc_dll_src))
  107. env.Depends('builtin_function.cpp', talloc_dll)
  108. Export('builtin_glsl_function')
  109. if common.cross_compiling:
  110. Return()
  111. sources += builtin_glsl_function
  112. glsl = env.ConvenienceLibrary(
  113. target = 'glsl',
  114. source = sources,
  115. )
  116. Export('glsl')
  117. # FIXME: We can't build the programs because there's a cyclic dependency between tis directory and src/mesa
  118. Return()
  119. env = env.Clone()
  120. if env['platform'] == 'windows':
  121. env.PrependUnique(LIBS = [
  122. 'user32',
  123. ])
  124. env.Prepend(LIBS = [glsl, talloc])
  125. env.Program(
  126. target = 'glsl2',
  127. source = [
  128. 'main.cpp',
  129. ]
  130. )
  131. env.Program(
  132. target = 'glcpp',
  133. source = ['glcpp/glcpp.c'],
  134. )