meson: define driver dependencies
authorDylan Baker <dylan@pnwbakers.com>
Wed, 15 Nov 2017 18:43:20 +0000 (10:43 -0800)
committerDylan Baker <dylan@pnwbakers.com>
Mon, 4 Dec 2017 22:35:36 +0000 (14:35 -0800)
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>
16 files changed:
src/gallium/drivers/etnaviv/meson.build
src/gallium/drivers/freedreno/meson.build
src/gallium/drivers/i915/meson.build
src/gallium/drivers/llvmpipe/meson.build
src/gallium/drivers/nouveau/meson.build
src/gallium/drivers/r300/meson.build
src/gallium/drivers/r600/meson.build
src/gallium/drivers/radeonsi/meson.build
src/gallium/drivers/softpipe/meson.build
src/gallium/drivers/svga/meson.build
src/gallium/drivers/vc4/meson.build
src/gallium/drivers/vc5/meson.build
src/gallium/drivers/virgl/meson.build
src/gallium/meson.build
src/gallium/winsys/imx/drm/meson.build
src/gallium/winsys/pl111/drm/meson.build

index 01cb45240fc07a795c6517ae1604228cfb3f6773..0c7dbe29a7420b323b5f16940431292467d0322f 100644 (file)
@@ -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],
+)
index 444e6234f38898029c4f50052747287502cc04b1..daae8efdd666aaa70dc2075ea497c9df8b644f16 100644 (file)
@@ -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',
index 17f0f6adf8fdb2fab449d8d30344df022284a578..77f44a979dc96bdd5db35394b749cace7159f90f 100644 (file)
@@ -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],
+)
index 9d0edb0ac33bd47a6053514d4718fb8cf9bfbc58..597245ee814cd81b150a77bcb8d9d37321dc3cbb 100644 (file)
@@ -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']
index b62494b2966b87837a75b9e9de1fff07095341d0..5d679e1c5a63321e6c413dc415050a0b130e1033 100644 (file)
@@ -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],
+)
index dac0bc833e5f28dd0e97be6959817919277db8a4..90fa5949fa481a2d994455168bede2483ce5965e 100644 (file)
@@ -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',
index 411b550331d0fb39ce417576863ab30cd6ed8285..2132dbb33ad2161829eb4a01e82554b62db4e1aa 100644 (file)
@@ -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],
+)
index c4915d060861b5f46ea665cc676001be6b0b0e2b..58132bf0720a8a73a9e8d3ba21135168df06eacc 100644 (file)
@@ -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,
+  ],
+)
index df23533c72cbac5b45ee3cf35f3b1b32bb1d08e5..a345ff62ec9493040ef14e1965fb5bafec79cdbc 100644 (file)
@@ -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
+)
index d9a7da95a330c2afa4661f2e057509191c33d449..2976212fdfba418c12ad7e8def44b9dd897df19e 100644 (file)
@@ -86,3 +86,8 @@ libsvga = static_library(
     include_directories('include')
   ],
 )
+
+driver_svga = declare_dependency(
+  compile_args : '-DGALLIUM_VMWGFX',
+  link_with : [libsvga, libsvgadrm],
+)
index 572d4b4fa9aaa15723a3a1781c1b9b36405b5094..9b816cc8fd53a5450ae7920c773a30d165fd63bd 100644 (file)
@@ -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],
+)
index 61059a15560a0ebea25907849f32362a4c17ca9c..c09fcde5b45f3e5eafed4a161e22260dc3b286b0 100644 (file)
@@ -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],
+)
index 8284f54892794d4663440cc17eae379c7c3bde83..16d185c57232aa94259aad0f6164531ff90daf0a 100644 (file)
@@ -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],
+)
index 4aa108262047dbd741e970a2555be9d0da9fa906..7ef1ffcdf0674de30ca37ca91788fbace25a6e21 100644 (file)
@@ -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
index 468345476eca8aaea6e25cf56b84c338dea86259..a4af4688694d6ed9c3009931e60e62506faac711 100644 (file)
@@ -26,3 +26,8 @@ libimxdrm = static_library(
     include_directories('../..'),
   ],
 )
+
+driver_imx = declare_dependency(
+  c_args : '-DGALLIUM_IMX',
+  link_with : libimxdrm,
+)
index 952c0b46700f5ddcf7e968e856e22a1ca09ceced..2c981e8c3432130fd5b099138be63edd540c3a59 100644 (file)
@@ -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,
+)