mesa/src/glx/meson.build
Dylan Baker b5f92b6fd4 meson: fix warnings about comparing unlike types
In the old days (0.42.x), when mesa's meson system was written the
recommendation for handling conditional dependencies was to define them
as empty lists. When meson would evaluate the dependencies of a target
it would recursively flatten all of the arguments, and empty lists would
be removed. There are some problems with this, among them that lists and
dependencies have different methods (namely .found()), so the
recommendation changed to use `dependency('', required : false)` for
such cases.  This has the advantage of providing a .found() method, so
there is no need to do things like `dep_foo != [] and dep_foo.found()`,
such a dependency should never exist.

I've tested this with 0.42 (the minimum we claim to support) and 0.45.
On 0.45 this removes warnings about comparing unlike types, such as:

meson.build:1337: WARNING: Trying to compare values of different types
(DependencyHolder, list) using !=.

v2: - Use dependency('', required : false) instead of
      declare_dependency(), the later will always report that it is
      found, which is not what we want.

Signed-off-by: Dylan Baker <dylan.c.baker@intel.com>
Reviewed-by: Caio Marcelo de Oliveira Filho <caio.oliveira@intel.com>
2018-04-06 15:29:53 -07:00

187 lines
4.7 KiB
Meson

# Copyright © 2017 Intel Corporation
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
# The above copyright notice and this permission notice shall be included in
# all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
inc_glx = include_directories('.')
subdir('apple')
if with_dri_platform == 'windows'
subdir('windows')
endif
files_libglx = files(
'clientattrib.c',
'clientinfo.c',
'compsize.c',
'create_context.c',
'eval.c',
'glxclient.h',
'glxcmds.c',
'glxconfig.c',
'glxconfig.h',
'glxcurrent.c',
'glx_error.c',
'glx_error.h',
'glxext.c',
'glxextensions.c',
'glxextensions.h',
'glxhash.c',
'glxhash.h',
'glx_pbuffer.c',
'glx_query.c',
'indirect_glx.c',
'indirect_init.h',
'indirect_texture_compression.c',
'indirect_transpose_matrix.c',
'indirect_vertex_array.c',
'indirect_vertex_array.h',
'indirect_vertex_array_priv.h',
'indirect_vertex_program.c',
'indirect_window_pos.c',
'packrender.h',
'packsingle.h',
'pixel.c',
'pixelstore.c',
'query_renderer.c',
'render2.c',
'renderpix.c',
'single2.c',
'singlepix.c',
'vertarr.c',
)
extra_libs_libglx = []
extra_deps_libgl = []
extra_ld_args_libgl = []
if with_dri
files_libglx += files(
'dri_common.c',
'dri_common.h',
'dri_common_query_renderer.c',
'dri_common_interop.c',
'xfont.c',
'drisw_glx.c',
'drisw_priv.h',
)
endif
# dri2
if with_dri and with_dri_platform == 'drm' and dep_libdrm.found()
files_libglx += files(
'dri2.c',
'dri2_glx.c',
'dri2.h',
'dri2_priv.h',
'dri_glx.c',
'dri_sarea.h',
'XF86dri.c',
'xf86dri.h',
'xf86dristr.h',
)
endif
if with_dri3
files_libglx += files('dri3_glx.c', 'dri3_priv.h')
endif
if with_dri_platform == 'apple'
files_libglx += files('applegl_glx.c')
extra_libs_libglx += libappleglx
elif with_dri_platform == 'windows'
files_libglx += files('driwindows_glx.c')
extra_libs_libglx += [
libwindowsdri,
libwindowsglx,
]
extra_deps_libgl = [
meson.get_compiler('c').find_library('gdi32'),
meson.get_compiler('c').find_library('opengl32')
]
extra_ld_args_libgl = '-Wl,--disable-stdcall-fixup'
endif
if not with_glvnd
gl_lib_name = 'GL'
gl_lib_version = '1.2.0'
else
gl_lib_name = 'GLX_mesa'
gl_lib_version = '0.0.0'
files_libglx += files(
'g_glxglvnddispatchfuncs.c',
'g_glxglvnddispatchindices.h',
'glxglvnd.c',
'glxglvnd.h',
'glxglvnddispatchfuncs.h',
)
endif
gl_lib_cargs = [
'-D_REENTRANT',
'-DDEFAULT_DRIVER_DIR="@0@"'.format(dri_search_path),
]
if dep_xxf86vm.found()
gl_lib_cargs += '-DHAVE_XF86VIDMODE'
endif
libglx = static_library(
'glx',
[files_libglx, glx_generated],
include_directories : [inc_common, inc_glapi, inc_loader, inc_gl_internal],
c_args : [
c_vis_args, gl_lib_cargs,
'-DGL_LIB_NAME="lib@0@.so.@1@"'.format(gl_lib_name, gl_lib_version.split('.')[0]),
],
link_with : [
libloader, libloader_dri3_helper, libmesa_util, libxmlconfig,
extra_libs_libglx,
],
dependencies : [dep_libdrm, dep_dri2proto, dep_glproto, dep_x11, dep_glvnd],
build_by_default : false,
)
# workaround for bug #2180
dummy_c = custom_target(
'dummy_c',
output : 'dummy.c',
command : [prog_touch, '@OUTPUT@'],
)
if with_glx == 'dri'
libgl = shared_library(
gl_lib_name,
dummy_c, # workaround for bug #2180
include_directories : [inc_common, inc_glapi, inc_loader, inc_gl_internal],
link_with : [libglapi_static, libglapi],
link_whole : libglx,
link_args : [ld_args_bsymbolic, ld_args_gc_sections, extra_ld_args_libgl],
dependencies : [
dep_libdrm, dep_dl, dep_m, dep_thread, dep_x11, dep_xcb_glx, dep_xcb,
dep_x11_xcb, dep_xcb_dri2, dep_xext, dep_xfixes, dep_xdamage,
extra_deps_libgl,
],
version : gl_lib_version,
install : true,
)
endif
if with_tests
subdir('tests')
endif