summaryrefslogtreecommitdiffstats
path: root/third_party/mesa/BUILD.gn
blob: 5108af19254d1fc625de63fe3e2215b850e2eb18 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.

import("//build/config/ui.gni")

config("mesa_headers_config") {
  include_dirs = [ "src/include" ]
  if (!use_x11) {
    defines = [ "MESA_EGL_NO_X11_HEADERS" ]
  }
}

# This directory contains checked-in files generated from the Mesa build.
generated_src_dir = "src/chromium_gensrc"

source_set("mesa_headers") {
  public_configs = [ ":mesa_headers_config" ]
}

# This config must generally be prepended to the configs list so that the Mesa
# dirs appear before the system ones on Windows. This is necessary so that
# #include "GL/gl.h" means to include Mesa's, not the system's.
config("mesa_internal_config") {
  cflags = []
  defines = [
    "MAPI_ABI_HEADER=\"glapi_mapi_tmp_shared.h\"",
    "PACKAGE_NAME=\"Mesa\"",
    "PACKAGE_TARNAME=\"mesa\"",
    "PACKAGE_VERSION=\"9.0.3\"",
    "PACKAGE_STRING=\"Mesa\ 9.0.3\"",
    "PACKAGE_BUGREPORT=\"https://bugs.freedesktop.org/enter_bug.cgi\?product=Mesa\"",
    "PACKAGE_URL=\"\"",
    "PACKAGE=\"mesa\"",
    "VERSION=\"9.0.3\"",
    "STDC_HEADERS=1",
    "HAVE_SYS_TYPES_H=1",
    "HAVE_SYS_STAT_H=1",
    "HAVE_STDLIB_H=1",
    "HAVE_STRING_H=1",
    "HAVE_MEMORY_H=1",
    "HAVE_STRINGS_H=1",
    "HAVE_INTTYPES_H=1",
    "HAVE_STDINT_H=1",
    "HAVE_DLFCN_H=1",
    "LT_OBJDIR=\".libs/\"",
    "YYTEXT_POINTER=1",
    "HAVE_LIBEXPAT=1",
    "HAVE_LIBXCB_DRI2=1",
    "FEATURE_GL=1",
    "MAPI_MODE_GLAPI",

    #"USE_X86_64_ASM",
    "IN_DRI_DRIVER",
    "USE_XCB",
    "GLX_INDIRECT_RENDERING",
    "GLX_DIRECT_RENDERING",
    "USE_EXTERNAL_DXTN_LIB=1",
    "IN_DRI_DRIVER",
    "HAVE_ALIAS",
    "HAVE_MINCORE",
    "HAVE_LIBUDEV",
    "_GLAPI_NO_EXPORTS",
  ]
  include_dirs = [
    "src/src/gallium/auxiliary",
    "src/src/gallium/include",
    "src/src/glsl",
    "src/src/glsl/glcpp",
    "src/src/mapi",
    "src/src/mapi/glapi",
    "src/src/mesa",
    "src/src/mesa/main",
    "src/include",
    "$generated_src_dir/mesa/",
    "$generated_src_dir/mesa/main",
    "$generated_src_dir/mesa/program",
    "$generated_src_dir/mesa/glapi",
  ]

  if (is_android) {
    defines += [ "_GNU_SOURCE" ]
  }

  if (is_linux) {
    defines += [ "_GNU_SOURCE" ]
  }

  if (is_win) {
    defines += [
      # Generated files use const only if __cplusplus or __STDC__ is defined.
      # On Windows, neither is defined, so define YY_USE_CONST to explicitly
      # enable const.
      "YY_USE_CONST",
    ]
  }

  if (is_posix) {
    defines += [
      "HAVE_DLOPEN",
      "HAVE_PTHREAD=1",
      "HAVE_UNISTD_H=1",
    ]

    if (!is_android) {
      defines += [ "HAVE_POSIX_MEMALIGN" ]
    }

    if (!is_android && !is_mac) {
      cflags += [ "-fPIC" ]
    }
  }
}

# mesa_internal_config is prepended to the config lists.  Flags that
# disable warnings need to be appended instead so that they show up
# after flags like -Wall. (gn orders flags on a target before flags from
# configs.)
config("mesa_internal_warnings") {
  cflags = []
  if (is_clang) {
    cflags += [
      "-Wno-tautological-constant-out-of-range-compare",
      "-Wno-mismatched-tags",  # Fixed upstream.

      # mesa's STATIC_ASSERT() macro expands to an ununused typedef.
      "-Wno-unused-local-typedef",
    ]
  }
  if (is_win) {
    # TODO(scottmg): http://crbug.com/143877 These should be removed if
    # Mesa is ever rolled and the warnings are fixed.
    cflags += [
      "/wd4005",  # Macro defined twice.
      "/wd4018",  # Signed/unsigned mismatch in comparison.
      "/wd4065",  # Switch statement contains 'default' but no 'case' labels.
      "/wd4090",  # 'Operation' : different 'modifier' qualifiers
      "/wd4099",  # Type name struct-vs-class doesn't match.
      "/wd4273",  # Inconsistent DLL linkage.
      "/wd4291",  # No matching operator delete found for placement new.
      "/wd4305",  # Truncation from int to float.
      "/wd4334",  # Result of 32-bit shift implicitly converted to 64 bits.
      "/wd4345",  # POD-type default initializers.
      "/wd4311",  # Pointer truncation TODO(brucedawson): http://crbug.com/554200
    ]
  }
}

config("mesa_libglslcommon_warnings") {
  if (is_clang) {
    cflags = [
      # https://bugs.freedesktop.org/show_bug.cgi?id=91645:
      "-Wno-overloaded-virtual",
    ]
  }
}

static_library("mesa_libglslcommon") {
  sources = [
    "$generated_src_dir/mesa/glcpp-lex.c",
    "$generated_src_dir/mesa/glcpp-parse.c",
    "$generated_src_dir/mesa/glcpp-parse.h",
    "$generated_src_dir/mesa/glsl_lexer.cc",
    "$generated_src_dir/mesa/glsl_parser.cc",
    "$generated_src_dir/mesa/main/dispatch.h",
    "src/src/glsl/ast_expr.cpp",
    "src/src/glsl/ast_function.cpp",
    "src/src/glsl/ast_to_hir.cpp",
    "src/src/glsl/ast_type.cpp",
    "src/src/glsl/builtin_variables.cpp",
    "src/src/glsl/glcpp/glcpp.h",
    "src/src/glsl/glcpp/pp.c",
    "src/src/glsl/glsl_parser_extras.cpp",
    "src/src/glsl/glsl_parser_extras.h",
    "src/src/glsl/glsl_symbol_table.cpp",
    "src/src/glsl/glsl_symbol_table.h",
    "src/src/glsl/glsl_types.cpp",
    "src/src/glsl/glsl_types.h",
    "src/src/glsl/hir_field_selection.cpp",
    "src/src/glsl/ir.cpp",
    "src/src/glsl/ir.h",
    "src/src/glsl/ir_basic_block.cpp",
    "src/src/glsl/ir_basic_block.h",
    "src/src/glsl/ir_builder.cpp",
    "src/src/glsl/ir_builder.h",
    "src/src/glsl/ir_clone.cpp",
    "src/src/glsl/ir_constant_expression.cpp",
    "src/src/glsl/ir_expression_flattening.cpp",
    "src/src/glsl/ir_expression_flattening.h",
    "src/src/glsl/ir_function.cpp",
    "src/src/glsl/ir_function_can_inline.cpp",
    "src/src/glsl/ir_function_detect_recursion.cpp",
    "src/src/glsl/ir_hierarchical_visitor.cpp",
    "src/src/glsl/ir_hierarchical_visitor.h",
    "src/src/glsl/ir_hv_accept.cpp",
    "src/src/glsl/ir_import_prototypes.cpp",
    "src/src/glsl/ir_print_visitor.cpp",
    "src/src/glsl/ir_print_visitor.h",
    "src/src/glsl/ir_reader.cpp",
    "src/src/glsl/ir_reader.h",
    "src/src/glsl/ir_rvalue_visitor.cpp",
    "src/src/glsl/ir_rvalue_visitor.h",
    "src/src/glsl/ir_set_program_inouts.cpp",
    "src/src/glsl/ir_validate.cpp",
    "src/src/glsl/ir_variable_refcount.cpp",
    "src/src/glsl/ir_variable_refcount.h",
    "src/src/glsl/link_functions.cpp",
    "src/src/glsl/link_uniform_initializers.cpp",
    "src/src/glsl/link_uniforms.cpp",
    "src/src/glsl/linker.cpp",
    "src/src/glsl/linker.h",
    "src/src/glsl/loop_analysis.cpp",
    "src/src/glsl/loop_analysis.h",
    "src/src/glsl/loop_controls.cpp",
    "src/src/glsl/loop_unroll.cpp",
    "src/src/glsl/lower_clip_distance.cpp",
    "src/src/glsl/lower_discard.cpp",
    "src/src/glsl/lower_discard_flow.cpp",
    "src/src/glsl/lower_if_to_cond_assign.cpp",
    "src/src/glsl/lower_instructions.cpp",
    "src/src/glsl/lower_jumps.cpp",
    "src/src/glsl/lower_mat_op_to_vec.cpp",
    "src/src/glsl/lower_noise.cpp",
    "src/src/glsl/lower_output_reads.cpp",
    "src/src/glsl/lower_texture_projection.cpp",
    "src/src/glsl/lower_ubo_reference.cpp",
    "src/src/glsl/lower_variable_index_to_cond_assign.cpp",
    "src/src/glsl/lower_vec_index_to_cond_assign.cpp",
    "src/src/glsl/lower_vec_index_to_swizzle.cpp",
    "src/src/glsl/lower_vector.cpp",
    "src/src/glsl/opt_algebraic.cpp",
    "src/src/glsl/opt_array_splitting.cpp",
    "src/src/glsl/opt_constant_folding.cpp",
    "src/src/glsl/opt_constant_propagation.cpp",
    "src/src/glsl/opt_constant_variable.cpp",
    "src/src/glsl/opt_copy_propagation.cpp",
    "src/src/glsl/opt_copy_propagation_elements.cpp",
    "src/src/glsl/opt_dead_code.cpp",
    "src/src/glsl/opt_dead_code_local.cpp",
    "src/src/glsl/opt_dead_functions.cpp",
    "src/src/glsl/opt_function_inlining.cpp",
    "src/src/glsl/opt_if_simplification.cpp",
    "src/src/glsl/opt_noop_swizzle.cpp",
    "src/src/glsl/opt_redundant_jumps.cpp",
    "src/src/glsl/opt_structure_splitting.cpp",
    "src/src/glsl/opt_swizzle_swizzle.cpp",
    "src/src/glsl/opt_tree_grafting.cpp",
    "src/src/glsl/program.h",
    "src/src/glsl/ralloc.c",
    "src/src/glsl/ralloc.h",
    "src/src/glsl/s_expression.cpp",
    "src/src/glsl/s_expression.h",

    # Skipped in the GN build. This file duplicates symbols from errors.c and
    # happens to link in GYP due to static library link ordering.
    #"src/src/glsl/standalone_scaffolding.cpp",
    #"src/src/glsl/standalone_scaffolding.h",
    "src/src/glsl/strtod.c",
    "src/src/glsl/strtod.h",
  ]

  configs -= [ "//build/config/compiler:chromium_code" ]
  configs += [ "//build/config/compiler:no_chromium_code" ]
  previous_configs = configs
  configs = []
  configs = [ ":mesa_internal_config" ] + previous_configs + [
              ":mesa_internal_warnings",
              ":mesa_libglslcommon_warnings",
            ]

  if (is_clang) {
    # Mesa triggers some of these Clang warnings.
    configs -= [ "//build/config/clang:extra_warnings" ]
  }

  deps = [
    ":mesa_headers",
  ]
}

static_library("mesa") {
  sources = [
    "$generated_src_dir/mesa/builtin_function.cpp",
    "$generated_src_dir/mesa/enums.c",
    "$generated_src_dir/mesa/glapi_mapi_tmp_shared.h",
    "$generated_src_dir/mesa/lex.yy.c",
    "$generated_src_dir/mesa/program/program_parse.tab.c",
    "$generated_src_dir/mesa/program/program_parse.tab.h",
    "src/src/mapi/mapi/entry.c",
    "src/src/mapi/mapi/entry.h",
    "src/src/mapi/mapi/mapi_glapi.c",
    "src/src/mapi/mapi/stub.c",
    "src/src/mapi/mapi/stub.h",
    "src/src/mapi/mapi/table.c",
    "src/src/mapi/mapi/table.h",
    "src/src/mapi/mapi/u_current.c",
    "src/src/mapi/mapi/u_current.h",
    "src/src/mapi/mapi/u_execmem.c",
    "src/src/mapi/mapi/u_execmem.h",
    "src/src/mesa/main/accum.c",
    "src/src/mesa/main/accum.h",
    "src/src/mesa/main/api_arrayelt.c",
    "src/src/mesa/main/api_arrayelt.h",
    "src/src/mesa/main/api_exec.c",
    "src/src/mesa/main/api_exec.h",
    "src/src/mesa/main/api_loopback.c",
    "src/src/mesa/main/api_loopback.h",
    "src/src/mesa/main/api_validate.c",
    "src/src/mesa/main/api_validate.h",
    "src/src/mesa/main/arbprogram.c",
    "src/src/mesa/main/arbprogram.h",
    "src/src/mesa/main/arrayobj.c",
    "src/src/mesa/main/arrayobj.h",
    "src/src/mesa/main/atifragshader.c",
    "src/src/mesa/main/atifragshader.h",
    "src/src/mesa/main/attrib.c",
    "src/src/mesa/main/attrib.h",
    "src/src/mesa/main/blend.c",
    "src/src/mesa/main/blend.h",
    "src/src/mesa/main/bufferobj.c",
    "src/src/mesa/main/bufferobj.h",
    "src/src/mesa/main/buffers.c",
    "src/src/mesa/main/buffers.h",
    "src/src/mesa/main/clear.c",
    "src/src/mesa/main/clear.h",
    "src/src/mesa/main/clip.c",
    "src/src/mesa/main/clip.h",
    "src/src/mesa/main/colortab.c",
    "src/src/mesa/main/colortab.h",
    "src/src/mesa/main/condrender.c",
    "src/src/mesa/main/condrender.h",
    "src/src/mesa/main/context.c",
    "src/src/mesa/main/context.h",
    "src/src/mesa/main/convolve.c",
    "src/src/mesa/main/convolve.h",
    "src/src/mesa/main/cpuinfo.c",
    "src/src/mesa/main/cpuinfo.h",
    "src/src/mesa/main/debug.c",
    "src/src/mesa/main/debug.h",
    "src/src/mesa/main/depth.c",
    "src/src/mesa/main/depth.h",
    "src/src/mesa/main/dlist.c",
    "src/src/mesa/main/dlist.h",
    "src/src/mesa/main/drawpix.c",
    "src/src/mesa/main/drawpix.h",
    "src/src/mesa/main/drawtex.c",
    "src/src/mesa/main/drawtex.h",
    "src/src/mesa/main/enable.c",
    "src/src/mesa/main/enable.h",
    "src/src/mesa/main/enums.h",
    "src/src/mesa/main/errors.c",
    "src/src/mesa/main/errors.h",
    "src/src/mesa/main/eval.c",
    "src/src/mesa/main/eval.h",
    "src/src/mesa/main/execmem.c",
    "src/src/mesa/main/extensions.c",
    "src/src/mesa/main/extensions.h",
    "src/src/mesa/main/fbobject.c",
    "src/src/mesa/main/fbobject.h",
    "src/src/mesa/main/feedback.c",
    "src/src/mesa/main/feedback.h",
    "src/src/mesa/main/ff_fragment_shader.cpp",
    "src/src/mesa/main/ffvertex_prog.c",
    "src/src/mesa/main/ffvertex_prog.h",
    "src/src/mesa/main/fog.c",
    "src/src/mesa/main/fog.h",
    "src/src/mesa/main/format_pack.c",
    "src/src/mesa/main/format_pack.h",
    "src/src/mesa/main/format_unpack.c",
    "src/src/mesa/main/format_unpack.h",
    "src/src/mesa/main/formats.c",
    "src/src/mesa/main/formats.h",
    "src/src/mesa/main/framebuffer.c",
    "src/src/mesa/main/framebuffer.h",
    "src/src/mesa/main/get.c",
    "src/src/mesa/main/get.h",
    "src/src/mesa/main/getstring.c",
    "src/src/mesa/main/glformats.c",
    "src/src/mesa/main/glformats.h",
    "src/src/mesa/main/hash.c",
    "src/src/mesa/main/hash.h",
    "src/src/mesa/main/hint.c",
    "src/src/mesa/main/hint.h",
    "src/src/mesa/main/histogram.c",
    "src/src/mesa/main/histogram.h",
    "src/src/mesa/main/image.c",
    "src/src/mesa/main/image.h",
    "src/src/mesa/main/imports.c",
    "src/src/mesa/main/imports.h",
    "src/src/mesa/main/light.c",
    "src/src/mesa/main/light.h",
    "src/src/mesa/main/lines.c",
    "src/src/mesa/main/lines.h",
    "src/src/mesa/main/matrix.c",
    "src/src/mesa/main/matrix.h",
    "src/src/mesa/main/mipmap.c",
    "src/src/mesa/main/mipmap.h",
    "src/src/mesa/main/mm.c",
    "src/src/mesa/main/mm.h",
    "src/src/mesa/main/multisample.c",
    "src/src/mesa/main/multisample.h",
    "src/src/mesa/main/nvprogram.c",
    "src/src/mesa/main/nvprogram.h",
    "src/src/mesa/main/pack.c",
    "src/src/mesa/main/pack.h",
    "src/src/mesa/main/pbo.c",
    "src/src/mesa/main/pbo.h",
    "src/src/mesa/main/pixel.c",
    "src/src/mesa/main/pixel.h",
    "src/src/mesa/main/pixelstore.c",
    "src/src/mesa/main/pixelstore.h",
    "src/src/mesa/main/pixeltransfer.c",
    "src/src/mesa/main/pixeltransfer.h",
    "src/src/mesa/main/points.c",
    "src/src/mesa/main/points.h",
    "src/src/mesa/main/polygon.c",
    "src/src/mesa/main/polygon.h",
    "src/src/mesa/main/queryobj.c",
    "src/src/mesa/main/queryobj.h",
    "src/src/mesa/main/rastpos.c",
    "src/src/mesa/main/rastpos.h",
    "src/src/mesa/main/readpix.c",
    "src/src/mesa/main/readpix.h",
    "src/src/mesa/main/remap.c",
    "src/src/mesa/main/remap.h",
    "src/src/mesa/main/renderbuffer.c",
    "src/src/mesa/main/renderbuffer.h",
    "src/src/mesa/main/samplerobj.c",
    "src/src/mesa/main/samplerobj.h",
    "src/src/mesa/main/scissor.c",
    "src/src/mesa/main/scissor.h",
    "src/src/mesa/main/shader_query.cpp",
    "src/src/mesa/main/shaderapi.c",
    "src/src/mesa/main/shaderapi.h",
    "src/src/mesa/main/shaderobj.c",
    "src/src/mesa/main/shaderobj.h",
    "src/src/mesa/main/shared.c",
    "src/src/mesa/main/shared.h",
    "src/src/mesa/main/state.c",
    "src/src/mesa/main/state.h",
    "src/src/mesa/main/stencil.c",
    "src/src/mesa/main/stencil.h",
    "src/src/mesa/main/syncobj.c",
    "src/src/mesa/main/syncobj.h",
    "src/src/mesa/main/texcompress.c",
    "src/src/mesa/main/texcompress.h",
    "src/src/mesa/main/texcompress_cpal.c",
    "src/src/mesa/main/texcompress_cpal.h",
    "src/src/mesa/main/texcompress_etc.c",
    "src/src/mesa/main/texcompress_etc.h",
    "src/src/mesa/main/texcompress_fxt1.c",
    "src/src/mesa/main/texcompress_fxt1.h",
    "src/src/mesa/main/texcompress_rgtc.c",
    "src/src/mesa/main/texcompress_rgtc.h",
    "src/src/mesa/main/texcompress_s3tc.c",
    "src/src/mesa/main/texcompress_s3tc.h",
    "src/src/mesa/main/texenv.c",
    "src/src/mesa/main/texenv.h",
    "src/src/mesa/main/texformat.c",
    "src/src/mesa/main/texformat.h",
    "src/src/mesa/main/texgen.c",
    "src/src/mesa/main/texgen.h",
    "src/src/mesa/main/texgetimage.c",
    "src/src/mesa/main/texgetimage.h",
    "src/src/mesa/main/teximage.c",
    "src/src/mesa/main/teximage.h",
    "src/src/mesa/main/texobj.c",
    "src/src/mesa/main/texobj.h",
    "src/src/mesa/main/texparam.c",
    "src/src/mesa/main/texparam.h",
    "src/src/mesa/main/texstate.c",
    "src/src/mesa/main/texstate.h",
    "src/src/mesa/main/texstorage.c",
    "src/src/mesa/main/texstorage.h",
    "src/src/mesa/main/texstore.c",
    "src/src/mesa/main/texstore.h",
    "src/src/mesa/main/texturebarrier.c",
    "src/src/mesa/main/texturebarrier.h",
    "src/src/mesa/main/transformfeedback.c",
    "src/src/mesa/main/transformfeedback.h",
    "src/src/mesa/main/uniform_query.cpp",
    "src/src/mesa/main/uniforms.c",
    "src/src/mesa/main/uniforms.h",
    "src/src/mesa/main/varray.c",
    "src/src/mesa/main/varray.h",
    "src/src/mesa/main/version.c",
    "src/src/mesa/main/version.h",
    "src/src/mesa/main/viewport.c",
    "src/src/mesa/main/viewport.h",
    "src/src/mesa/main/vtxfmt.c",
    "src/src/mesa/main/vtxfmt.h",
    "src/src/mesa/math/m_debug_clip.c",
    "src/src/mesa/math/m_debug_norm.c",
    "src/src/mesa/math/m_debug_xform.c",
    "src/src/mesa/math/m_eval.c",
    "src/src/mesa/math/m_eval.h",
    "src/src/mesa/math/m_matrix.c",
    "src/src/mesa/math/m_matrix.h",
    "src/src/mesa/math/m_translate.c",
    "src/src/mesa/math/m_translate.h",
    "src/src/mesa/math/m_vector.c",
    "src/src/mesa/math/m_vector.h",
    "src/src/mesa/math/m_xform.c",
    "src/src/mesa/math/m_xform.h",
    "src/src/mesa/program/arbprogparse.c",
    "src/src/mesa/program/arbprogparse.h",
    "src/src/mesa/program/hash_table.c",
    "src/src/mesa/program/hash_table.h",
    "src/src/mesa/program/ir_to_mesa.cpp",
    "src/src/mesa/program/ir_to_mesa.h",
    "src/src/mesa/program/nvfragparse.c",
    "src/src/mesa/program/nvfragparse.h",
    "src/src/mesa/program/nvvertparse.c",
    "src/src/mesa/program/nvvertparse.h",
    "src/src/mesa/program/prog_cache.c",
    "src/src/mesa/program/prog_cache.h",
    "src/src/mesa/program/prog_execute.c",
    "src/src/mesa/program/prog_execute.h",
    "src/src/mesa/program/prog_instruction.c",
    "src/src/mesa/program/prog_instruction.h",
    "src/src/mesa/program/prog_noise.c",
    "src/src/mesa/program/prog_noise.h",
    "src/src/mesa/program/prog_opt_constant_fold.c",
    "src/src/mesa/program/prog_optimize.c",
    "src/src/mesa/program/prog_optimize.h",
    "src/src/mesa/program/prog_parameter.c",
    "src/src/mesa/program/prog_parameter.h",
    "src/src/mesa/program/prog_parameter_layout.c",
    "src/src/mesa/program/prog_parameter_layout.h",
    "src/src/mesa/program/prog_print.c",
    "src/src/mesa/program/prog_print.h",
    "src/src/mesa/program/prog_statevars.c",
    "src/src/mesa/program/prog_statevars.h",
    "src/src/mesa/program/program.c",
    "src/src/mesa/program/program.h",
    "src/src/mesa/program/program_parse_extra.c",
    "src/src/mesa/program/programopt.c",
    "src/src/mesa/program/programopt.h",
    "src/src/mesa/program/register_allocate.c",
    "src/src/mesa/program/register_allocate.h",
    "src/src/mesa/program/sampler.cpp",
    "src/src/mesa/program/sampler.h",
    "src/src/mesa/program/string_to_uint_map.cpp",
    "src/src/mesa/program/symbol_table.c",
    "src/src/mesa/program/symbol_table.h",
    "src/src/mesa/swrast/s_aaline.c",
    "src/src/mesa/swrast/s_aaline.h",
    "src/src/mesa/swrast/s_aatriangle.c",
    "src/src/mesa/swrast/s_aatriangle.h",
    "src/src/mesa/swrast/s_alpha.c",
    "src/src/mesa/swrast/s_alpha.h",
    "src/src/mesa/swrast/s_atifragshader.c",
    "src/src/mesa/swrast/s_atifragshader.h",
    "src/src/mesa/swrast/s_bitmap.c",
    "src/src/mesa/swrast/s_blend.c",
    "src/src/mesa/swrast/s_blend.h",
    "src/src/mesa/swrast/s_blit.c",
    "src/src/mesa/swrast/s_clear.c",
    "src/src/mesa/swrast/s_context.c",
    "src/src/mesa/swrast/s_context.h",
    "src/src/mesa/swrast/s_copypix.c",
    "src/src/mesa/swrast/s_depth.c",
    "src/src/mesa/swrast/s_depth.h",
    "src/src/mesa/swrast/s_drawpix.c",
    "src/src/mesa/swrast/s_feedback.c",
    "src/src/mesa/swrast/s_feedback.h",
    "src/src/mesa/swrast/s_fog.c",
    "src/src/mesa/swrast/s_fog.h",
    "src/src/mesa/swrast/s_fragprog.c",
    "src/src/mesa/swrast/s_fragprog.h",
    "src/src/mesa/swrast/s_lines.c",
    "src/src/mesa/swrast/s_lines.h",
    "src/src/mesa/swrast/s_logic.c",
    "src/src/mesa/swrast/s_logic.h",
    "src/src/mesa/swrast/s_masking.c",
    "src/src/mesa/swrast/s_masking.h",
    "src/src/mesa/swrast/s_points.c",
    "src/src/mesa/swrast/s_points.h",
    "src/src/mesa/swrast/s_renderbuffer.c",
    "src/src/mesa/swrast/s_renderbuffer.h",
    "src/src/mesa/swrast/s_span.c",
    "src/src/mesa/swrast/s_span.h",
    "src/src/mesa/swrast/s_stencil.c",
    "src/src/mesa/swrast/s_stencil.h",
    "src/src/mesa/swrast/s_texcombine.c",
    "src/src/mesa/swrast/s_texcombine.h",
    "src/src/mesa/swrast/s_texfetch.c",
    "src/src/mesa/swrast/s_texfetch.h",
    "src/src/mesa/swrast/s_texfilter.c",
    "src/src/mesa/swrast/s_texfilter.h",
    "src/src/mesa/swrast/s_texrender.c",
    "src/src/mesa/swrast/s_texture.c",
    "src/src/mesa/swrast/s_triangle.c",
    "src/src/mesa/swrast/s_triangle.h",
    "src/src/mesa/swrast/s_zoom.c",
    "src/src/mesa/swrast/s_zoom.h",
    "src/src/mesa/swrast_setup/ss_context.c",
    "src/src/mesa/swrast_setup/ss_context.h",
    "src/src/mesa/swrast_setup/ss_triangle.c",
    "src/src/mesa/swrast_setup/ss_triangle.h",
    "src/src/mesa/tnl/t_context.c",
    "src/src/mesa/tnl/t_context.h",
    "src/src/mesa/tnl/t_draw.c",
    "src/src/mesa/tnl/t_pipeline.c",
    "src/src/mesa/tnl/t_pipeline.h",
    "src/src/mesa/tnl/t_rasterpos.c",
    "src/src/mesa/tnl/t_vb_fog.c",
    "src/src/mesa/tnl/t_vb_light.c",
    "src/src/mesa/tnl/t_vb_normals.c",
    "src/src/mesa/tnl/t_vb_points.c",
    "src/src/mesa/tnl/t_vb_program.c",
    "src/src/mesa/tnl/t_vb_render.c",
    "src/src/mesa/tnl/t_vb_texgen.c",
    "src/src/mesa/tnl/t_vb_texmat.c",
    "src/src/mesa/tnl/t_vb_vertex.c",
    "src/src/mesa/tnl/t_vertex.c",
    "src/src/mesa/tnl/t_vertex.h",
    "src/src/mesa/tnl/t_vertex_generic.c",
    "src/src/mesa/tnl/t_vertex_sse.c",
    "src/src/mesa/tnl/t_vp_build.c",
    "src/src/mesa/tnl/t_vp_build.h",
    "src/src/mesa/vbo/vbo_context.c",
    "src/src/mesa/vbo/vbo_context.h",
    "src/src/mesa/vbo/vbo_exec.c",
    "src/src/mesa/vbo/vbo_exec.h",
    "src/src/mesa/vbo/vbo_exec_api.c",
    "src/src/mesa/vbo/vbo_exec_array.c",
    "src/src/mesa/vbo/vbo_exec_draw.c",
    "src/src/mesa/vbo/vbo_exec_eval.c",
    "src/src/mesa/vbo/vbo_noop.c",
    "src/src/mesa/vbo/vbo_noop.h",
    "src/src/mesa/vbo/vbo_primitive_restart.c",
    "src/src/mesa/vbo/vbo_rebase.c",
    "src/src/mesa/vbo/vbo_save.c",
    "src/src/mesa/vbo/vbo_save.h",
    "src/src/mesa/vbo/vbo_save_api.c",
    "src/src/mesa/vbo/vbo_save_draw.c",
    "src/src/mesa/vbo/vbo_save_loopback.c",
    "src/src/mesa/vbo/vbo_split.c",
    "src/src/mesa/vbo/vbo_split.h",
    "src/src/mesa/vbo/vbo_split_copy.c",
    "src/src/mesa/vbo/vbo_split_inplace.c",
    "src/src/mesa/x86-64/x86-64.c",
    "src/src/mesa/x86-64/x86-64.h",
  ]

  configs -= [ "//build/config/compiler:chromium_code" ]
  configs += [ "//build/config/compiler:no_chromium_code" ]
  previous_configs = configs
  configs = []
  configs = [ ":mesa_internal_config" ] + previous_configs +
            [ ":mesa_internal_warnings" ]

  if (is_clang) {
    # Mesa triggers some of these Clang warnings.
    configs -= [ "//build/config/clang:extra_warnings" ]
  }

  cflags = []

  if (is_android && !is_clang) {
    # Disable sincos() optimization to avoid a linker error
    # since Android's math library doesn't have sincos().
    # Either -fno-builtin-sin or -fno-builtin-cos works.
    cflags += [ "-fno-builtin-sin" ]
  }

  if (is_win) {
    defines = [
      # Because we're building as a static library
      "_GLAPI_NO_EXPORTS",
    ]
  }

  deps = [
    ":mesa_headers",
  ]
}

# Building this target will hide the native OpenGL shared library and
# replace it with a slow software renderer.
#
# Note: on x64 Windows this target gives warnings to the effect of:
#   osmesa.osmesa.obj : warning LNK4197: export 'OSMesaGetIntegerv' specified
#   multiple times; using first specification
# This also happens with the GYP build.
loadable_module("osmesa") {
  sources = [
    "src/src/mesa/drivers/common/driverfuncs.c",
    "src/src/mesa/drivers/common/driverfuncs.h",
    "src/src/mesa/drivers/common/meta.c",
    "src/src/mesa/drivers/common/meta.h",
    "src/src/mesa/drivers/osmesa/osmesa.c",
  ]

  configs -= [ "//build/config/compiler:chromium_code" ]
  configs += [
    ":mesa_headers_config",
    "//build/config/compiler:no_chromium_code",
  ]
  previous_configs = configs
  configs = []
  configs = [ ":mesa_internal_config" ] + previous_configs +
            [ ":mesa_internal_warnings" ]

  include_dirs = [ "src/src/mesa/drivers" ]

  if (is_clang) {
    # Mesa triggers some of these Clang warnings.
    configs -= [ "//build/config/clang:extra_warnings" ]
  }

  if (is_win) {
    ldflags = [ "/DEF:" + rebase_path("src/src/mesa/drivers/osmesa/osmesa.def",
                                      root_build_dir) ]

    # TODO(brucedawson) : remove when crbug.com/482671 is resolved by
    # Microsoft.
    configs -= [ "//build/config/win:default_incremental_linking" ]
    configs += [ "//build/config/win:no_incremental_linking" ]
  }

  deps = [
    ":mesa",
    ":mesa_headers",
    ":mesa_libglslcommon",
    "//base",  # Required for the allocator implementation.
    "//build/config/sanitizers:deps",
  ]

  if (is_win) {
    defines = [
      "BUILD_GL32",
      "KEYWORD1=GLAPI",
      "KEYWORD2=GLAPIENTRY",
    ]
  }
}

if (is_linux) {
  config("wayland_drm_protocol_config") {
    include_dirs = [ "$generated_src_dir/egl/wayland/wayland-drm" ]
  }

  source_set("wayland_drm_protocol") {
    sources = [
      "$generated_src_dir/egl/wayland/wayland-drm/wayland-drm-client-protocol.h",
      "$generated_src_dir/egl/wayland/wayland-drm/wayland-drm-protocol.c",
      "$generated_src_dir/egl/wayland/wayland-drm/wayland-drm-server-protocol.h",
    ]

    deps = [
      "//third_party/wayland:wayland_util",
    ]

    configs -= [ "//build/config/compiler:chromium_code" ]
    configs += [ "//build/config/compiler:no_chromium_code" ]

    public_configs = [ ":wayland_drm_protocol_config" ]
  }
}