[i-g-t] meson: build a full dependency for lib_igt_perf
diff mbox

Message ID 20171129130644.10293-1-daniel.vetter@ffwll.ch
State New
Headers show

Commit Message

Daniel Vetter Nov. 29, 2017, 1:06 p.m. UTC
meson prefers packages dependencies over passing arount static
libraries, because those also include linker flags, include dirs and
everything else.

While at it pull the special cases out from the common build stanzas
like we do with other special cases.

Just a bit of ocd to keep everything polished.

Cc: Tvrtko Ursulin <tvrtko.ursulin@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
 benchmarks/meson.build |  9 +++------
 lib/meson.build        |  5 ++++-
 overlay/meson.build    |  4 ++--
 tests/meson.build      | 11 +++++------
 4 files changed, 14 insertions(+), 15 deletions(-)

Patch
diff mbox

diff --git a/benchmarks/meson.build b/benchmarks/meson.build
index fa7f07643a97..4afd204f82b2 100644
--- a/benchmarks/meson.build
+++ b/benchmarks/meson.build
@@ -12,7 +12,6 @@  benchmark_progs = [
 	'gem_prw',
 	'gem_set_domain',
 	'gem_syslatency',
-	'gem_wsim',
 	'kms_vblank',
 	'prime_lookup',
 	'vgem_mmap',
@@ -31,11 +30,9 @@  endif
 foreach prog : benchmark_progs
 	# FIXME meson doesn't like binaries with the same name
 	# meanwhile just suffix with _bench
-	link = []
-	if prog == 'gem_wsim'
-		link += lib_igt_perf
-	endif
 	executable(prog + '_bench', prog + '.c',
-		   link_with : link,
 		   dependencies : test_deps)
 endforeach
+
+executable('gem_wsim_bench', 'gem_wsim.c',
+	   dependencies : test_deps + [ lib_igt_perf ])
diff --git a/lib/meson.build b/lib/meson.build
index 29d89cf09b58..d06d85b438b2 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -180,8 +180,11 @@  lib_igt = declare_dependency(link_with : lib_igt_build,
 
 igt_deps = [ lib_igt ] + lib_deps
 
-lib_igt_perf = static_library('igt_perf',
+lib_igt_perf_build = static_library('igt_perf',
 	['igt_perf.c']
 )
 
+lib_igt_perf = declare_dependency(link_with : lib_igt_perf_build,
+				  include_directories : inc)
+
 subdir('tests')
diff --git a/overlay/meson.build b/overlay/meson.build
index 6b479eb89890..afacff5ecf60 100644
--- a/overlay/meson.build
+++ b/overlay/meson.build
@@ -21,7 +21,8 @@  dri2proto = dependency('dri2proto', version : '>= 2.6', required : false)
 cairo_xlib = dependency('cairo-xlib', required : false)
 xrandr = dependency('xrandr', version : '>=1.3', required : false)
 
-gpu_overlay_deps = [ realtime, math, cairo, pciaccess, libdrm, libdrm_intel ]
+gpu_overlay_deps = [ realtime, math, cairo, pciaccess, libdrm,
+	libdrm_intel, lib_igt_perf ]
 
 both_x11_src = ''
 
@@ -55,6 +56,5 @@  if xrandr.found() and cairo.found()
 			include_directories : inc,
 			c_args : gpu_overlay_cflags,
 			dependencies : gpu_overlay_deps,
-			link_with : lib_igt_perf,
 			install : true)
 endif
diff --git a/tests/meson.build b/tests/meson.build
index 088c37ec9b15..58fe0b0557a3 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -193,7 +193,6 @@  test_progs = [
 	'kms_vblank',
 	'meta_test',
 	'perf',
-	'perf_pmu',
 	'pm_backlight',
 	'pm_lpsp',
 	'pm_rc6_residency',
@@ -263,17 +262,17 @@  libexecdir = join_paths(get_option('prefix'), get_option('libexecdir'), 'intel-g
 test_executables = []
 
 foreach prog : test_progs
-	link = []
-	if prog == 'perf_pmu'
-		link += lib_igt_perf
-	endif
 	test_executables += executable(prog, prog + '.c',
 		   dependencies : test_deps,
 		   install_dir : libexecdir,
-		   link_with : link,
 		   install : true)
 endforeach
 
+test_executables += executable('perf_pmu', 'perf_pmu.c',
+	   dependencies : test_deps + [ lib_igt_perf ],
+	   install_dir : libexecdir,
+	   install : true)
+
 executable('testdisplay', ['testdisplay.c', 'testdisplay_hotplug.c'],
 	   dependencies : test_deps,
 	   install_dir : libexecdir,