meson: define driver dependencies

This allow us to encapsulate the compiler and linkage requirements of
each driver in a reusable way. The result will be that each target that
needs a specific driver can simply add `driver_<name>` to its
dependencies line and the necessary libraries and compiler args will be
added. This will allow for a lot of code de-duplication between gallium
targets.

Signed-off-by: Dylan Baker <dylanx.c.baker@intel.com>
Reviewed-by: Eric Engestrom <eric.engestrom@imgtec.com>
This commit is contained in:
Dylan Baker 2017-11-15 10:43:20 -08:00
parent 831d2fb012
commit 0bbecc5a85
16 changed files with 110 additions and 0 deletions

View file

@ -100,3 +100,8 @@ etnaviv_compiler = executable(
dependencies : [dep_libdrm_etnaviv, dep_lmsensors], dependencies : [dep_libdrm_etnaviv, dep_lmsensors],
build_by_default : false, build_by_default : false,
) )
driver_etnaviv = declare_dependency(
compile_args : '-DGALLIUM_ETNAVIV',
link_with : [libetnaviv, libetnavivdrm],
)

View file

@ -220,6 +220,11 @@ libfreedreno = static_library(
dependencies : [dep_libdrm, dep_libdrm_freedreno], dependencies : [dep_libdrm, dep_libdrm_freedreno],
) )
driver_freedreno = declare_dependency(
compile_args : '-DGALLIUM_FREEDRENO',
link_with : [libfreedrenowinsys, libfreedreno],
)
ir3_compiler = executable( ir3_compiler = executable(
'ir3_compiler', 'ir3_compiler',
'ir3/ir3_cmdline.c', 'ir3/ir3_cmdline.c',

View file

@ -68,3 +68,8 @@ libi915 = static_library(
c_args : [c_vis_args], c_args : [c_vis_args],
include_directories : [inc_include, inc_src, inc_gallium, inc_gallium_aux], include_directories : [inc_include, inc_src, inc_gallium, inc_gallium_aux],
) )
driver_i915 = declare_dependency(
compile_args : '-DGALLIUM_I915',
link_with : [libi915, libi915drm],
)

View file

@ -100,6 +100,14 @@ libllvmpipe = static_library(
dependencies : dep_llvm, dependencies : dep_llvm,
) )
# This overwrites the softpipe driver dependency, but itself depends on the
# softpipe dependency.
driver_swrast = declare_dependency(
compile_args : '-DGALLIUM_LLVMPIPE',
link_with : libllvmpipe,
dependencies : driver_swrast,
)
if with_tests and with_gallium_softpipe and with_llvm if with_tests and with_gallium_softpipe and with_llvm
foreach t : ['lp_test_format', 'lp_test_arit', 'lp_test_blend', foreach t : ['lp_test_format', 'lp_test_arit', 'lp_test_blend',
'lp_test_conv', 'lp_test_printf'] 'lp_test_conv', 'lp_test_printf']

View file

@ -221,3 +221,8 @@ nouveau_compiler = executable(
link_with : [libnouveau, libgallium, libmesa_util], link_with : [libnouveau, libgallium, libmesa_util],
build_by_default : false, build_by_default : false,
) )
driver_nouveau = declare_dependency(
compile_args : '-DGALLIUM_NOUVEAU',
link_with : [libnouveauwinsys, libnouveau],
)

View file

@ -129,6 +129,11 @@ libr300 = static_library(
dependencies : [dep_libdrm_radeon, dep_llvm], dependencies : [dep_libdrm_radeon, dep_llvm],
) )
driver_r300 = declare_dependency(
compile_args : '-DGALLIUM_R300',
link_with : [libr300, libradeonwinsys],
)
if with_tests if with_tests
test('r300_compiler_test', executable( test('r300_compiler_test', executable(
'r300_compiler_test', 'r300_compiler_test',

View file

@ -126,3 +126,8 @@ libr600 = static_library(
], ],
dependencies: [dep_libdrm_radeon, dep_elf, dep_llvm], dependencies: [dep_libdrm_radeon, dep_elf, dep_llvm],
) )
driver_r600 = declare_dependency(
compile_args : '-DGALLIUM_R600',
link_with : [libr600, libradeonwinsys],
)

View file

@ -79,3 +79,12 @@ libradeonsi = static_library(
cpp_args : [cpp_vis_args], cpp_args : [cpp_vis_args],
dependencies : dep_llvm, dependencies : dep_llvm,
) )
driver_radeonsi = declare_dependency(
compile_args : '-DGALLIUM_RADEONSI',
sources : si_driinfo_h,
link_with : [
libradeonsi, libradeon, libradeonwinsys, libamdgpuwinsys, libamd_common,
libnir,
],
)

View file

@ -82,3 +82,8 @@ libsoftpipe = static_library(
include_directories : [inc_gallium_aux, inc_gallium, inc_include, inc_src], include_directories : [inc_gallium_aux, inc_gallium, inc_include, inc_src],
c_args : [c_vis_args, c_msvc_compat_args], c_args : [c_vis_args, c_msvc_compat_args],
) )
driver_swrast = declare_dependency(
compile_args : '-DGALLIUM_SOFTPIPE',
link_with : libsoftpipe
)

View file

@ -86,3 +86,8 @@ libsvga = static_library(
include_directories('include') include_directories('include')
], ],
) )
driver_svga = declare_dependency(
compile_args : '-DGALLIUM_VMWGFX',
link_with : [libsvga, libsvgadrm],
)

View file

@ -112,3 +112,8 @@ libvc4 = static_library(
dependencies : [dep_simpenrose, dep_libdrm, dep_valgrind], dependencies : [dep_simpenrose, dep_libdrm, dep_valgrind],
build_by_default : false, build_by_default : false,
) )
driver_vc4 = declare_dependency(
compile_args : '-DGALLIUM_VC4',
link_with : [libvc4, libvc4winsys, libbroadcom_cle, libnir],
)

View file

@ -62,3 +62,8 @@ libvc5 = static_library(
cpp_args : [cpp_vis_args], cpp_args : [cpp_vis_args],
dependencies : [dep_v3dv3, dep_libdrm, dep_valgrind], dependencies : [dep_v3dv3, dep_libdrm, dep_valgrind],
) )
driver_vc5 = declare_dependency(
compile_args : '-DGALLIUM_VC5',
link_with : [libvc5, libvc5winsys, libbroadcom_cle, libbroadcom_vc5, libnir],
)

View file

@ -37,3 +37,8 @@ libvirgl = static_library(
include_directories : inc_common, include_directories : inc_common,
dependencies : dep_libdrm, dependencies : dep_libdrm,
) )
driver_virgl = declare_dependency(
compile_args : '-DGALLIUM_VIRGL',
link_with : [libvirgl, libvirgldrm, libvirglvtest],
)

View file

@ -37,59 +37,87 @@ if with_gallium_softpipe
if with_llvm if with_llvm
subdir('drivers/llvmpipe') subdir('drivers/llvmpipe')
endif endif
else
driver_swrast = declare_dependency()
endif endif
if with_gallium_r300 or with_gallium_radeonsi or with_gallium_r600 if with_gallium_r300 or with_gallium_radeonsi or with_gallium_r600
subdir('winsys/radeon/drm') subdir('winsys/radeon/drm')
endif endif
if with_gallium_r300 if with_gallium_r300
subdir('drivers/r300') subdir('drivers/r300')
else
driver_r300 = declare_dependency()
endif endif
if with_gallium_r600 if with_gallium_r600
subdir('drivers/r600') subdir('drivers/r600')
else
driver_r600 = declare_dependency()
endif endif
if with_gallium_radeonsi if with_gallium_radeonsi
subdir('winsys/amdgpu/drm') subdir('winsys/amdgpu/drm')
subdir('drivers/radeon') subdir('drivers/radeon')
subdir('drivers/radeonsi') subdir('drivers/radeonsi')
else
driver_radeonsi = declare_dependency()
endif endif
if with_gallium_nouveau if with_gallium_nouveau
subdir('winsys/nouveau/drm') subdir('winsys/nouveau/drm')
subdir('drivers/nouveau') subdir('drivers/nouveau')
else
driver_nouveau = declare_dependency()
endif endif
if with_gallium_freedreno if with_gallium_freedreno
subdir('winsys/freedreno/drm') subdir('winsys/freedreno/drm')
subdir('drivers/freedreno') subdir('drivers/freedreno')
else
driver_freedreno = declare_dependency()
endif endif
if with_gallium_pl111 if with_gallium_pl111
subdir('winsys/pl111/drm') subdir('winsys/pl111/drm')
else
driver_pl111 = declare_dependency()
endif endif
if with_gallium_vc4 if with_gallium_vc4
subdir('winsys/vc4/drm') subdir('winsys/vc4/drm')
subdir('drivers/vc4') subdir('drivers/vc4')
else
driver_vc4 = declare_dependency()
endif endif
if with_gallium_vc5 if with_gallium_vc5
subdir('winsys/vc5/drm') subdir('winsys/vc5/drm')
subdir('drivers/vc5') subdir('drivers/vc5')
else
driver_vc5 = declare_dependency()
endif endif
if with_gallium_etnaviv if with_gallium_etnaviv
subdir('winsys/etnaviv/drm') subdir('winsys/etnaviv/drm')
subdir('drivers/etnaviv') subdir('drivers/etnaviv')
else
driver_etnaviv = declare_dependency()
endif endif
if with_gallium_imx if with_gallium_imx
subdir('winsys/imx/drm') subdir('winsys/imx/drm')
else
driver_imx = declare_dependency()
endif endif
if with_gallium_i915 if with_gallium_i915
subdir('winsys/i915/drm') subdir('winsys/i915/drm')
subdir('drivers/i915') subdir('drivers/i915')
else
driver_i915 = declare_dependency()
endif endif
if with_gallium_svga if with_gallium_svga
subdir('winsys/svga/drm') subdir('winsys/svga/drm')
subdir('drivers/svga') subdir('drivers/svga')
else
driver_svga = declare_dependency()
endif endif
if with_gallium_virgl if with_gallium_virgl
subdir('winsys/virgl/drm') subdir('winsys/virgl/drm')
subdir('winsys/virgl/vtest') subdir('winsys/virgl/vtest')
subdir('drivers/virgl') subdir('drivers/virgl')
else
driver_virgl = declare_dependency()
endif endif
# TODO: SWR # TODO: SWR
# TODO: clover # TODO: clover

View file

@ -26,3 +26,8 @@ libimxdrm = static_library(
include_directories('../..'), include_directories('../..'),
], ],
) )
driver_imx = declare_dependency(
c_args : '-DGALLIUM_IMX',
link_with : libimxdrm,
)

View file

@ -28,3 +28,8 @@ libpl111winsys = static_library(
c_args : [c_vis_args], c_args : [c_vis_args],
dependencies: dep_libdrm, dependencies: dep_libdrm,
) )
driver_pl111 = declare_dependency(
c_args : '-DGALLIUM_PL111',
link_with : libpl111winsys,
)