101e04c3fSmrg# Copyright © 2017 Dylan Baker
201e04c3fSmrg# Copyright © 2018 Intel Corporation
301e04c3fSmrg
401e04c3fSmrg# Permission is hereby granted, free of charge, to any person obtaining a copy
501e04c3fSmrg# of this software and associated documentation files (the "Software"), to deal
601e04c3fSmrg# in the Software without restriction, including without limitation the rights
701e04c3fSmrg# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
801e04c3fSmrg# copies of the Software, and to permit persons to whom the Software is
901e04c3fSmrg# furnished to do so, subject to the following conditions:
1001e04c3fSmrg
1101e04c3fSmrg# The above copyright notice and this permission notice shall be included in
1201e04c3fSmrg# all copies or substantial portions of the Software.
1301e04c3fSmrg
1401e04c3fSmrg# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
1501e04c3fSmrg# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
1601e04c3fSmrg# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1701e04c3fSmrg# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1801e04c3fSmrg# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
1901e04c3fSmrg# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2001e04c3fSmrg# SOFTWARE.
2101e04c3fSmrg
2201e04c3fSmrg# TODO: support non-static targets
2301e04c3fSmrg# Static targets are always enabled in autotools (unless you modify
2401e04c3fSmrg# configure.ac)
2501e04c3fSmrg
2601e04c3fSmrggallium_dri_c_args = []
2701e04c3fSmrggallium_dri_ld_args = []
2801e04c3fSmrggallium_dri_link_depends = []
2901e04c3fSmrggallium_dri_drivers = []
3001e04c3fSmrg
3101e04c3fSmrgif with_ld_version_script
3201e04c3fSmrg  gallium_dri_ld_args += ['-Wl,--version-script', join_paths(meson.current_source_dir(), 'dri.sym')]
3301e04c3fSmrg  gallium_dri_link_depends += files('dri.sym')
3401e04c3fSmrgendif
3501e04c3fSmrgif with_ld_dynamic_list
3601e04c3fSmrg  gallium_dri_ld_args += ['-Wl,--dynamic-list', join_paths(meson.current_source_dir(), '../dri-vdpau.dyn')]
3701e04c3fSmrg  gallium_dri_link_depends += files('../dri-vdpau.dyn')
3801e04c3fSmrgendif
3901e04c3fSmrg
4001e04c3fSmrglibgallium_dri = shared_library(
4101e04c3fSmrg  'gallium_dri',
427ec681f3Smrg  files('target.c'),
4301e04c3fSmrg  include_directories : [
447ec681f3Smrg    inc_include, inc_src, inc_mapi, inc_mesa, inc_gallium, inc_gallium_aux, inc_util, inc_dri_common, inc_gallium_drivers,
457ec681f3Smrg    inc_gallium_winsys, include_directories('../../frontends/dri'),
4601e04c3fSmrg  ],
477ec681f3Smrg  gnu_symbol_visibility : 'hidden',
487ec681f3Smrg  link_args : [ld_args_build_id, ld_args_gc_sections, gallium_dri_ld_args],
4901e04c3fSmrg  link_depends : gallium_dri_link_depends,
5001e04c3fSmrg  link_with : [
517ec681f3Smrg    libdri, libmesa_gallium, libdricommon, libmegadriver_stub, libgalliumvl,
5201e04c3fSmrg    libgallium, libglapi, libpipe_loader_static, libws_null, libwsw, libswdri,
5301e04c3fSmrg    libswkmsdri,
5401e04c3fSmrg  ],
5501e04c3fSmrg  dependencies : [
567ec681f3Smrg    dep_selinux, dep_libdrm, dep_llvm, dep_thread, idep_xmlconfig, idep_mesautil,
5701e04c3fSmrg    driver_swrast, driver_r300, driver_r600, driver_radeonsi, driver_nouveau,
589f464c52Smaya    driver_kmsro, driver_v3d, driver_vc4, driver_freedreno, driver_etnaviv,
599f464c52Smaya    driver_tegra, driver_i915, driver_svga, driver_virgl,
607ec681f3Smrg    driver_swr, driver_panfrost, driver_iris, driver_lima, driver_zink, driver_d3d12,
617ec681f3Smrg    driver_asahi, driver_crocus
6201e04c3fSmrg  ],
63993e1d59Smrg  # Will be deleted during installation, see install_megadrivers.py
64993e1d59Smrg  install : true,
65993e1d59Smrg  install_dir : dri_drivers_path,
669f464c52Smaya  name_suffix : 'so',
6701e04c3fSmrg)
6801e04c3fSmrg
699f464c52Smayaforeach d : [[with_gallium_kmsro, [
709f464c52Smaya               'armada-drm_dri.so',
719f464c52Smaya               'exynos_dri.so',
729f464c52Smaya               'hx8357d_dri.so',
739f464c52Smaya               'ili9225_dri.so',
749f464c52Smaya               'ili9341_dri.so',
759f464c52Smaya               'imx-drm_dri.so',
767ec681f3Smrg               'imx-dcss_dri.so',
777ec681f3Smrg               'ingenic-drm_dri.so',
787ec681f3Smrg               'kirin_dri.so',
797ec681f3Smrg               'mali-dp_dri.so',
807ec681f3Smrg               'mcde_dri.so',
817ec681f3Smrg               'mediatek_dri.so',
829f464c52Smaya               'meson_dri.so',
839f464c52Smaya               'mi0283qt_dri.so',
847ec681f3Smrg               'mxsfb-drm_dri.so',
859f464c52Smaya               'pl111_dri.so',
869f464c52Smaya               'repaper_dri.so',
879f464c52Smaya               'rockchip_dri.so',
889f464c52Smaya               'st7586_dri.so',
899f464c52Smaya               'st7735r_dri.so',
907ec681f3Smrg               'stm_dri.so',
919f464c52Smaya	       'sun4i-drm_dri.so',
929f464c52Smaya             ]],
9301e04c3fSmrg             [with_gallium_radeonsi, 'radeonsi_dri.so'],
9401e04c3fSmrg             [with_gallium_nouveau, 'nouveau_dri.so'],
9501e04c3fSmrg             [with_gallium_freedreno, ['msm_dri.so', 'kgsl_dri.so']],
9601e04c3fSmrg             [with_gallium_softpipe or with_gallium_swr, 'swrast_dri.so'],
9701e04c3fSmrg             [with_gallium_softpipe and with_gallium_drisw_kms, 'kms_swrast_dri.so'],
9801e04c3fSmrg             [with_gallium_v3d, 'v3d_dri.so'],
9901e04c3fSmrg             [with_gallium_vc4, 'vc4_dri.so'],
1009f464c52Smaya             [with_gallium_panfrost, 'panfrost_dri.so'],
10101e04c3fSmrg             [with_gallium_etnaviv, 'etnaviv_dri.so'],
10201e04c3fSmrg             [with_gallium_tegra, 'tegra_dri.so'],
1037ec681f3Smrg             [with_gallium_crocus, 'crocus_dri.so'],
1049f464c52Smaya             [with_gallium_iris, 'iris_dri.so'],
10501e04c3fSmrg             [with_gallium_i915, 'i915_dri.so'],
10601e04c3fSmrg             [with_gallium_r300, 'r300_dri.so'],
10701e04c3fSmrg             [with_gallium_r600, 'r600_dri.so'],
10801e04c3fSmrg             [with_gallium_svga, 'vmwgfx_dri.so'],
1099f464c52Smaya             [with_gallium_virgl, 'virtio_gpu_dri.so'],
1107ec681f3Smrg             [with_gallium_lima, 'lima_dri.so'],
1117ec681f3Smrg             [with_gallium_zink, 'zink_dri.so'],
1127ec681f3Smrg             [with_gallium_d3d12, 'd3d12_dri.so'],
1137ec681f3Smrg             [with_gallium_asahi, 'asahi_dri.so']]
11401e04c3fSmrg  if d[0]
11501e04c3fSmrg    gallium_dri_drivers += d[1]
11601e04c3fSmrg  endif
11701e04c3fSmrgendforeach
11801e04c3fSmrg
11901e04c3fSmrgmeson.add_install_script(
1207ec681f3Smrg  install_megadrivers_py.path(),
12101e04c3fSmrg  libgallium_dri.full_path(),
12201e04c3fSmrg  dri_drivers_path,
12301e04c3fSmrg  gallium_dri_drivers,
12401e04c3fSmrg)
125