From 0bbecc5a8548883f76a7147ac7879f05a01770dc Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Wed, 15 Nov 2017 10:43:20 -0800 Subject: [PATCH] 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_` 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 Reviewed-by: Eric Engestrom --- src/gallium/drivers/etnaviv/meson.build | 5 ++++ src/gallium/drivers/freedreno/meson.build | 5 ++++ src/gallium/drivers/i915/meson.build | 5 ++++ src/gallium/drivers/llvmpipe/meson.build | 8 +++++++ src/gallium/drivers/nouveau/meson.build | 5 ++++ src/gallium/drivers/r300/meson.build | 5 ++++ src/gallium/drivers/r600/meson.build | 5 ++++ src/gallium/drivers/radeonsi/meson.build | 9 ++++++++ src/gallium/drivers/softpipe/meson.build | 5 ++++ src/gallium/drivers/svga/meson.build | 5 ++++ src/gallium/drivers/vc4/meson.build | 5 ++++ src/gallium/drivers/vc5/meson.build | 5 ++++ src/gallium/drivers/virgl/meson.build | 5 ++++ src/gallium/meson.build | 28 +++++++++++++++++++++++ src/gallium/winsys/imx/drm/meson.build | 5 ++++ src/gallium/winsys/pl111/drm/meson.build | 5 ++++ 16 files changed, 110 insertions(+) diff --git a/src/gallium/drivers/etnaviv/meson.build b/src/gallium/drivers/etnaviv/meson.build index 01cb45240fc..0c7dbe29a74 100644 --- a/src/gallium/drivers/etnaviv/meson.build +++ b/src/gallium/drivers/etnaviv/meson.build @@ -100,3 +100,8 @@ etnaviv_compiler = executable( dependencies : [dep_libdrm_etnaviv, dep_lmsensors], build_by_default : false, ) + +driver_etnaviv = declare_dependency( + compile_args : '-DGALLIUM_ETNAVIV', + link_with : [libetnaviv, libetnavivdrm], +) diff --git a/src/gallium/drivers/freedreno/meson.build b/src/gallium/drivers/freedreno/meson.build index 444e6234f38..daae8efdd66 100644 --- a/src/gallium/drivers/freedreno/meson.build +++ b/src/gallium/drivers/freedreno/meson.build @@ -220,6 +220,11 @@ libfreedreno = static_library( dependencies : [dep_libdrm, dep_libdrm_freedreno], ) +driver_freedreno = declare_dependency( + compile_args : '-DGALLIUM_FREEDRENO', + link_with : [libfreedrenowinsys, libfreedreno], +) + ir3_compiler = executable( 'ir3_compiler', 'ir3/ir3_cmdline.c', diff --git a/src/gallium/drivers/i915/meson.build b/src/gallium/drivers/i915/meson.build index 17f0f6adf8f..77f44a979dc 100644 --- a/src/gallium/drivers/i915/meson.build +++ b/src/gallium/drivers/i915/meson.build @@ -68,3 +68,8 @@ libi915 = static_library( c_args : [c_vis_args], include_directories : [inc_include, inc_src, inc_gallium, inc_gallium_aux], ) + +driver_i915 = declare_dependency( + compile_args : '-DGALLIUM_I915', + link_with : [libi915, libi915drm], +) diff --git a/src/gallium/drivers/llvmpipe/meson.build b/src/gallium/drivers/llvmpipe/meson.build index 9d0edb0ac33..597245ee814 100644 --- a/src/gallium/drivers/llvmpipe/meson.build +++ b/src/gallium/drivers/llvmpipe/meson.build @@ -100,6 +100,14 @@ libllvmpipe = static_library( 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 foreach t : ['lp_test_format', 'lp_test_arit', 'lp_test_blend', 'lp_test_conv', 'lp_test_printf'] diff --git a/src/gallium/drivers/nouveau/meson.build b/src/gallium/drivers/nouveau/meson.build index b62494b2966..5d679e1c5a6 100644 --- a/src/gallium/drivers/nouveau/meson.build +++ b/src/gallium/drivers/nouveau/meson.build @@ -221,3 +221,8 @@ nouveau_compiler = executable( link_with : [libnouveau, libgallium, libmesa_util], build_by_default : false, ) + +driver_nouveau = declare_dependency( + compile_args : '-DGALLIUM_NOUVEAU', + link_with : [libnouveauwinsys, libnouveau], +) diff --git a/src/gallium/drivers/r300/meson.build b/src/gallium/drivers/r300/meson.build index dac0bc833e5..90fa5949fa4 100644 --- a/src/gallium/drivers/r300/meson.build +++ b/src/gallium/drivers/r300/meson.build @@ -129,6 +129,11 @@ libr300 = static_library( dependencies : [dep_libdrm_radeon, dep_llvm], ) +driver_r300 = declare_dependency( + compile_args : '-DGALLIUM_R300', + link_with : [libr300, libradeonwinsys], +) + if with_tests test('r300_compiler_test', executable( 'r300_compiler_test', diff --git a/src/gallium/drivers/r600/meson.build b/src/gallium/drivers/r600/meson.build index 411b550331d..2132dbb33ad 100644 --- a/src/gallium/drivers/r600/meson.build +++ b/src/gallium/drivers/r600/meson.build @@ -126,3 +126,8 @@ libr600 = static_library( ], dependencies: [dep_libdrm_radeon, dep_elf, dep_llvm], ) + +driver_r600 = declare_dependency( + compile_args : '-DGALLIUM_R600', + link_with : [libr600, libradeonwinsys], +) diff --git a/src/gallium/drivers/radeonsi/meson.build b/src/gallium/drivers/radeonsi/meson.build index c4915d06086..58132bf0720 100644 --- a/src/gallium/drivers/radeonsi/meson.build +++ b/src/gallium/drivers/radeonsi/meson.build @@ -79,3 +79,12 @@ libradeonsi = static_library( cpp_args : [cpp_vis_args], dependencies : dep_llvm, ) + +driver_radeonsi = declare_dependency( + compile_args : '-DGALLIUM_RADEONSI', + sources : si_driinfo_h, + link_with : [ + libradeonsi, libradeon, libradeonwinsys, libamdgpuwinsys, libamd_common, + libnir, + ], +) diff --git a/src/gallium/drivers/softpipe/meson.build b/src/gallium/drivers/softpipe/meson.build index df23533c72c..a345ff62ec9 100644 --- a/src/gallium/drivers/softpipe/meson.build +++ b/src/gallium/drivers/softpipe/meson.build @@ -82,3 +82,8 @@ libsoftpipe = static_library( include_directories : [inc_gallium_aux, inc_gallium, inc_include, inc_src], c_args : [c_vis_args, c_msvc_compat_args], ) + +driver_swrast = declare_dependency( + compile_args : '-DGALLIUM_SOFTPIPE', + link_with : libsoftpipe +) diff --git a/src/gallium/drivers/svga/meson.build b/src/gallium/drivers/svga/meson.build index d9a7da95a33..2976212fdfb 100644 --- a/src/gallium/drivers/svga/meson.build +++ b/src/gallium/drivers/svga/meson.build @@ -86,3 +86,8 @@ libsvga = static_library( include_directories('include') ], ) + +driver_svga = declare_dependency( + compile_args : '-DGALLIUM_VMWGFX', + link_with : [libsvga, libsvgadrm], +) diff --git a/src/gallium/drivers/vc4/meson.build b/src/gallium/drivers/vc4/meson.build index 572d4b4fa9a..9b816cc8fd5 100644 --- a/src/gallium/drivers/vc4/meson.build +++ b/src/gallium/drivers/vc4/meson.build @@ -112,3 +112,8 @@ libvc4 = static_library( dependencies : [dep_simpenrose, dep_libdrm, dep_valgrind], build_by_default : false, ) + +driver_vc4 = declare_dependency( + compile_args : '-DGALLIUM_VC4', + link_with : [libvc4, libvc4winsys, libbroadcom_cle, libnir], +) diff --git a/src/gallium/drivers/vc5/meson.build b/src/gallium/drivers/vc5/meson.build index 61059a15560..c09fcde5b45 100644 --- a/src/gallium/drivers/vc5/meson.build +++ b/src/gallium/drivers/vc5/meson.build @@ -62,3 +62,8 @@ libvc5 = static_library( cpp_args : [cpp_vis_args], dependencies : [dep_v3dv3, dep_libdrm, dep_valgrind], ) + +driver_vc5 = declare_dependency( + compile_args : '-DGALLIUM_VC5', + link_with : [libvc5, libvc5winsys, libbroadcom_cle, libbroadcom_vc5, libnir], +) diff --git a/src/gallium/drivers/virgl/meson.build b/src/gallium/drivers/virgl/meson.build index 8284f548927..16d185c5723 100644 --- a/src/gallium/drivers/virgl/meson.build +++ b/src/gallium/drivers/virgl/meson.build @@ -37,3 +37,8 @@ libvirgl = static_library( include_directories : inc_common, dependencies : dep_libdrm, ) + +driver_virgl = declare_dependency( + compile_args : '-DGALLIUM_VIRGL', + link_with : [libvirgl, libvirgldrm, libvirglvtest], +) diff --git a/src/gallium/meson.build b/src/gallium/meson.build index 4aa10826204..7ef1ffcdf06 100644 --- a/src/gallium/meson.build +++ b/src/gallium/meson.build @@ -37,59 +37,87 @@ if with_gallium_softpipe if with_llvm subdir('drivers/llvmpipe') endif +else + driver_swrast = declare_dependency() endif if with_gallium_r300 or with_gallium_radeonsi or with_gallium_r600 subdir('winsys/radeon/drm') endif if with_gallium_r300 subdir('drivers/r300') +else + driver_r300 = declare_dependency() endif if with_gallium_r600 subdir('drivers/r600') +else + driver_r600 = declare_dependency() endif if with_gallium_radeonsi subdir('winsys/amdgpu/drm') subdir('drivers/radeon') subdir('drivers/radeonsi') +else + driver_radeonsi = declare_dependency() endif if with_gallium_nouveau subdir('winsys/nouveau/drm') subdir('drivers/nouveau') +else + driver_nouveau = declare_dependency() endif if with_gallium_freedreno subdir('winsys/freedreno/drm') subdir('drivers/freedreno') +else + driver_freedreno = declare_dependency() endif if with_gallium_pl111 subdir('winsys/pl111/drm') +else + driver_pl111 = declare_dependency() endif if with_gallium_vc4 subdir('winsys/vc4/drm') subdir('drivers/vc4') +else + driver_vc4 = declare_dependency() endif if with_gallium_vc5 subdir('winsys/vc5/drm') subdir('drivers/vc5') +else + driver_vc5 = declare_dependency() endif if with_gallium_etnaviv subdir('winsys/etnaviv/drm') subdir('drivers/etnaviv') +else + driver_etnaviv = declare_dependency() endif if with_gallium_imx subdir('winsys/imx/drm') +else + driver_imx = declare_dependency() endif if with_gallium_i915 subdir('winsys/i915/drm') subdir('drivers/i915') +else + driver_i915 = declare_dependency() endif if with_gallium_svga subdir('winsys/svga/drm') subdir('drivers/svga') +else + driver_svga = declare_dependency() endif if with_gallium_virgl subdir('winsys/virgl/drm') subdir('winsys/virgl/vtest') subdir('drivers/virgl') +else + driver_virgl = declare_dependency() endif # TODO: SWR # TODO: clover diff --git a/src/gallium/winsys/imx/drm/meson.build b/src/gallium/winsys/imx/drm/meson.build index 468345476ec..a4af4688694 100644 --- a/src/gallium/winsys/imx/drm/meson.build +++ b/src/gallium/winsys/imx/drm/meson.build @@ -26,3 +26,8 @@ libimxdrm = static_library( include_directories('../..'), ], ) + +driver_imx = declare_dependency( + c_args : '-DGALLIUM_IMX', + link_with : libimxdrm, +) diff --git a/src/gallium/winsys/pl111/drm/meson.build b/src/gallium/winsys/pl111/drm/meson.build index 952c0b46700..2c981e8c343 100644 --- a/src/gallium/winsys/pl111/drm/meson.build +++ b/src/gallium/winsys/pl111/drm/meson.build @@ -28,3 +28,8 @@ libpl111winsys = static_library( c_args : [c_vis_args], dependencies: dep_libdrm, ) + +driver_pl111 = declare_dependency( + c_args : '-DGALLIUM_PL111', + link_with : libpl111winsys, +) -- 2.30.2