1b8e80941Smrg# Copyright © 2017 Intel Corporation
2b8e80941Smrg
3b8e80941Smrg# Permission is hereby granted, free of charge, to any person obtaining a copy
4b8e80941Smrg# of this software and associated documentation files (the "Software"), to deal
5b8e80941Smrg# in the Software without restriction, including without limitation the rights
6b8e80941Smrg# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7b8e80941Smrg# copies of the Software, and to permit persons to whom the Software is
8b8e80941Smrg# furnished to do so, subject to the following conditions:
9b8e80941Smrg
10b8e80941Smrg# The above copyright notice and this permission notice shall be included in
11b8e80941Smrg# all copies or substantial portions of the Software.
12b8e80941Smrg
13b8e80941Smrg# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14b8e80941Smrg# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15b8e80941Smrg# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16b8e80941Smrg# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17b8e80941Smrg# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18b8e80941Smrg# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19b8e80941Smrg# SOFTWARE.
20b8e80941Smrg
21b8e80941Smrginc_common = [inc_include, include_directories(
22b8e80941Smrg  '.', 'mapi', 'mesa', 'gallium/include', 'gallium/auxiliary')]
23b8e80941Smrginc_mesa = include_directories('mesa')
24b8e80941Smrginc_mapi = include_directories('mapi')
25b8e80941Smrginc_src = include_directories('.')
26b8e80941Smrginc_gallium = include_directories('gallium/include')
27b8e80941Smrginc_gallium_aux = include_directories('gallium/auxiliary')
28b8e80941Smrginc_amd_common = include_directories('amd/common')
29b8e80941Smrg
30b8e80941Smrglibglsl_util = static_library(
31b8e80941Smrg  'glsl_util',
32b8e80941Smrg  files(
33b8e80941Smrg    'mesa/main/extensions_table.c', 'mesa/main/imports.c',
34b8e80941Smrg    'mesa/program/prog_parameter.c', 'mesa/program/symbol_table.c',
35b8e80941Smrg    'mesa/program/dummy_errors.c',
36b8e80941Smrg  ),
37b8e80941Smrg  include_directories : [inc_common],
38b8e80941Smrg  c_args : [c_vis_args],
39b8e80941Smrg  build_by_default : false,
40b8e80941Smrg)
41b8e80941Smrg
42b8e80941Smrgsha1_h = custom_target(
43b8e80941Smrg  'git_sha1.h',
44b8e80941Smrg  output : 'git_sha1.h',
45b8e80941Smrg  command : [prog_python, git_sha1_gen_py, '--output', '@OUTPUT@'],
46b8e80941Smrg  build_always : true, # commit sha1 can change without having touched these files
47b8e80941Smrg)
48b8e80941Smrg
49b8e80941Smrgsubdir('gtest')
50b8e80941Smrgsubdir('util')
51b8e80941Smrgsubdir('mapi')
52b8e80941Smrg# TODO: opengl
53b8e80941Smrgsubdir('compiler')
54b8e80941Smrgsubdir('imgui')
55b8e80941Smrgif with_platform_wayland
56b8e80941Smrg  subdir('egl/wayland/wayland-drm')
57b8e80941Smrgendif
58b8e80941Smrgif with_any_vk
59b8e80941Smrg  subdir('vulkan')
60b8e80941Smrgendif
61b8e80941Smrgif with_gallium_radeonsi or with_amd_vk
62b8e80941Smrg  subdir('amd')
63b8e80941Smrgendif
64b8e80941Smrgif with_gallium_vc4 or with_gallium_v3d
65b8e80941Smrg  subdir('broadcom')
66b8e80941Smrgendif
67b8e80941Smrgif with_gallium_freedreno or with_freedreno_vk
68b8e80941Smrg  subdir('freedreno')
69b8e80941Smrgendif
70b8e80941Smrgif with_dri_i965 or with_intel_vk or with_gallium_iris
71b8e80941Smrg  subdir('intel')
72b8e80941Smrgendif
73b8e80941Smrgsubdir('mesa')
74b8e80941Smrgsubdir('loader')
75b8e80941Smrgif with_platform_haiku
76b8e80941Smrg  subdir('hgl')
77b8e80941Smrgendif
78b8e80941Smrgif with_glx == 'dri'
79b8e80941Smrg  subdir('glx')
80b8e80941Smrgendif
81b8e80941Smrgif with_gbm
82b8e80941Smrg  subdir('gbm')
83b8e80941Smrgelse
84b8e80941Smrg  inc_gbm = []
85b8e80941Smrgendif
86b8e80941Smrgif with_egl
87b8e80941Smrg  subdir('egl')
88b8e80941Smrgendif
89b8e80941Smrgif with_gallium
90b8e80941Smrg  subdir('gallium')
91b8e80941Smrg  # This has to be here since it requires libgallium, and subdir cannot
92b8e80941Smrg  # contain ..
93b8e80941Smrg  if with_tests and with_shared_glapi
94b8e80941Smrg    subdir('mesa/state_tracker/tests')
95b8e80941Smrg  endif
96b8e80941Smrgendif
97b8e80941Smrg
98b8e80941Smrg# This must be after at least mesa, glx, and gallium, since libgl will be
99b8e80941Smrg# defined in one of those subdirs depending on the glx provider.
100b8e80941Smrgif with_glx != 'disabled'
101b8e80941Smrg  # If using glvnd the pkg-config header should not point to GL_mesa, it should
102b8e80941Smrg  # point to GL. glvnd is only available on unix like platforms so adding -l
103b8e80941Smrg  # should be safe here
104b8e80941Smrg  # TODO: in the glvnd case glvnd itself should really be providing this.
105b8e80941Smrg  if with_glvnd
106b8e80941Smrg    _gl = '-L${libdir} -lGL'
107b8e80941Smrg  else
108b8e80941Smrg    _gl = libgl
109b8e80941Smrg  endif
110b8e80941Smrg
111b8e80941Smrg  pkg.generate(
112b8e80941Smrg    name : 'gl',
113b8e80941Smrg    description : 'Mesa OpenGL Library',
114b8e80941Smrg    version : meson.project_version(),
115b8e80941Smrg    libraries : _gl,
116b8e80941Smrg    libraries_private : gl_priv_libs,
117b8e80941Smrg    requires_private : gl_priv_reqs,
118b8e80941Smrg    variables : ['glx_tls=yes'],
119b8e80941Smrg  )
120b8e80941Smrgendif
121