101e04c3fSmrg# Copyright © 2017-2018 Intel Corporation
201e04c3fSmrg
301e04c3fSmrg# Permission is hereby granted, free of charge, to any person obtaining a copy
401e04c3fSmrg# of this software and associated documentation files (the "Software"), to deal
501e04c3fSmrg# in the Software without restriction, including without limitation the rights
601e04c3fSmrg# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
701e04c3fSmrg# copies of the Software, and to permit persons to whom the Software is
801e04c3fSmrg# furnished to do so, subject to the following conditions:
901e04c3fSmrg
1001e04c3fSmrg# The above copyright notice and this permission notice shall be included in
1101e04c3fSmrg# all copies or substantial portions of the Software.
1201e04c3fSmrg
1301e04c3fSmrg# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1401e04c3fSmrg# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1501e04c3fSmrg# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1601e04c3fSmrg# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1701e04c3fSmrg# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1801e04c3fSmrg# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
1901e04c3fSmrg# SOFTWARE.
2001e04c3fSmrg
2101e04c3fSmrgpipe_loader_link_args = [ld_args_gc_sections]
2201e04c3fSmrgpipe_loader_link_deps = []
237ec681f3Smrgpipe_loader_link_with = [libgallium]
2401e04c3fSmrgpipe_loader_comp_args = []
2501e04c3fSmrgpipe_loader_incs = [
2601e04c3fSmrg  inc_include, inc_src, inc_util, inc_gallium, inc_gallium_drivers,
2701e04c3fSmrg  inc_gallium_winsys, inc_gallium_aux,
2801e04c3fSmrg]
2901e04c3fSmrg
3001e04c3fSmrgif (with_gallium_va or with_gallium_vdpau or with_gallium_omx != 'disabled' or
317ec681f3Smrg    with_gallium_xvmc or with_dri or with_gallium_radeonsi)
3201e04c3fSmrg  pipe_loader_link_with += libgalliumvl
3301e04c3fSmrgelse
3401e04c3fSmrg  pipe_loader_link_with += libgalliumvl_stub
3501e04c3fSmrgendif
3601e04c3fSmrgif (with_gallium_va or with_gallium_vdpau or with_gallium_omx != 'disabled' or
3701e04c3fSmrg    with_gallium_xvmc)
3801e04c3fSmrg  pipe_loader_link_with += libgalliumvlwinsys
3901e04c3fSmrgendif
4001e04c3fSmrg
4101e04c3fSmrgif with_ld_version_script
4201e04c3fSmrg  pipe_loader_link_args += [
4301e04c3fSmrg    '-Wl,--version-script', join_paths(meson.current_source_dir(), 'pipe.sym')
4401e04c3fSmrg  ]
4501e04c3fSmrg  pipe_loader_link_deps += files('pipe.sym')
4601e04c3fSmrgendif
4701e04c3fSmrg
4801e04c3fSmrgpipe_loader_install_dir = join_paths(get_option('libdir'), 'gallium-pipe')
4901e04c3fSmrg
507ec681f3Smrg_kmsro_targets = [
517ec681f3Smrg   driver_kmsro, driver_v3d, driver_vc4, driver_freedreno, driver_etnaviv,
527ec681f3Smrg   driver_panfrost, driver_lima,
537ec681f3Smrg]
547ec681f3Smrg
557ec681f3Smrgif with_gallium_v3d
567ec681f3Smrg   _kmsro_targets += [idep_xmlconfig, dep_expat]
577ec681f3Smrgendif
587ec681f3Smrg
5901e04c3fSmrgpipe_loaders = [
607ec681f3Smrg  [with_gallium_i915, 'i915', driver_i915, []],
617ec681f3Smrg  [with_gallium_crocus, 'crocus', [driver_crocus, idep_xmlconfig], []],
627ec681f3Smrg  [with_gallium_iris, 'iris', [driver_iris, idep_xmlconfig], []],
637ec681f3Smrg  [with_gallium_nouveau, 'nouveau', driver_nouveau, []],
647ec681f3Smrg  [with_gallium_r300, 'r300', driver_r300, []],
657ec681f3Smrg  [with_gallium_r600, 'r600', driver_r600, []],
667ec681f3Smrg  [with_gallium_radeonsi, 'radeonsi', [driver_radeonsi, idep_xmlconfig], []],
677ec681f3Smrg  [with_gallium_freedreno, 'msm', driver_freedreno, []],
687ec681f3Smrg  [with_gallium_kmsro, 'kmsro', _kmsro_targets, []],
697ec681f3Smrg  [with_gallium_svga, 'vmwgfx', driver_svga, []],
707ec681f3Smrg  [with_gallium_softpipe, 'swrast', [driver_swrast, driver_swr], [libwsw, libws_null]],
7101e04c3fSmrg]
7201e04c3fSmrg
7301e04c3fSmrgforeach x : pipe_loaders
7401e04c3fSmrg  if x[0]
7501e04c3fSmrg    shared_library(
7601e04c3fSmrg      'pipe_@0@'.format(x[1]),
777ec681f3Smrg      'pipe_@0@.c'.format(x[1]),
787ec681f3Smrg      c_args : [pipe_loader_comp_args, '-DPIPE_LOADER_DYNAMIC=1'],
797ec681f3Smrg      cpp_args : [pipe_loader_comp_args],
807ec681f3Smrg      gnu_symbol_visibility : 'hidden',
8101e04c3fSmrg      link_args : pipe_loader_link_args,
8201e04c3fSmrg      link_depends : pipe_loader_link_deps,
8301e04c3fSmrg      include_directories : pipe_loader_incs,
8401e04c3fSmrg      link_with : [pipe_loader_link_with, x[3]],
857ec681f3Smrg      dependencies : [idep_mesautil, idep_nir, dep_thread, x[2]],
8601e04c3fSmrg      name_prefix : '',
8701e04c3fSmrg      install : true,
8801e04c3fSmrg      install_dir : pipe_loader_install_dir,
8901e04c3fSmrg    )
9001e04c3fSmrg  endif
9101e04c3fSmrgendforeach
92