meson.build 4.02 KB
Newer Older
1
project('IGT gpu tests', 'c',
2
	version : '1.20',
3 4 5 6
        default_options: [
          'warning_level=2',
          'c_std=gnu99',
        ],
7 8
	license : 'MIT',
	meson_version : '>0.40.0')
9 10 11

cc = meson.get_compiler('c')

Daniel Vetter's avatar
Daniel Vetter committed
12 13 14 15 16
cc_args = [
	'-Wno-unused-parameter',
	'-Wno-sign-compare',
	'-Wno-missing-field-initializers',
	'-Wno-clobbered',
17
# Macros asserting on the range of their arguments triggers this.
Daniel Vetter's avatar
Daniel Vetter committed
18
	'-Wno-type-limits',
19
# igt_assert(0) in switch statements triggers a bunch of this.
Daniel Vetter's avatar
Daniel Vetter committed
20 21 22 23 24 25 26 27
	'-Wimplicit-fallthrough=0',
]

foreach cc_arg : cc_args
  if cc.has_argument(cc_arg)
    add_global_arguments(cc_arg, language : 'c')
  endif
endforeach
28

29
inc = include_directories('include/drm-uapi', 'lib', '.')
30

Daniel Vetter's avatar
Daniel Vetter committed
31 32
inc_for_gtkdoc = include_directories('lib')

33
config = configuration_data()
34 35 36 37 38 39 40 41

libdrm = dependency('libdrm', version : '>=2.4.82')
libdrm_intel = dependency('libdrm_intel', required : false)
libdrm_nouveau = dependency('libdrm_nouveau', required : false)
libdrm_amdgpu = dependency('libdrm_amdgpu', required : false)

pciaccess = dependency('pciaccess', version : '>=0.10')
libkmod = dependency('libkmod')
42
libprocps = dependency('libprocps', required : true)
43
libunwind = dependency('libunwind', required : true)
44 45 46

valgrind = dependency('valgrind', required : false)
if valgrind.found()
47
	config.set('HAVE_VALGRIND', 1)
48 49 50 51 52 53
endif

cairo = dependency('cairo', version : '>1.12.0', required : false)

libudev = dependency('libudev', required : false)
if libudev.found()
54
	config.set('HAVE_UDEV', 1)
55 56 57 58
endif

glib = dependency('glib-2.0', required : false)
if glib.found()
59
	config.set('HAVE_GLIB', 1)
60 61 62 63 64 65 66 67 68 69
endif

gsl = dependency('gsl', required : false)
alsa = dependency('alsa', required : false)

pixman = dependency('pixman-1', required : false)
xmlrpc = dependency('xmlrpc', required : false)
xmlrpc_util = dependency('xmlrpc_util', required : false)
xmlrpc_client = dependency('xmlrpc_client', required : false)

70 71 72 73
xmlrpc_cmd = find_program('xmlrpc-c-config', required : false)
if not xmlrpc.found() and xmlrpc_cmd.found()
	libs_cmd = run_command(xmlrpc_cmd, 'client', '--libs')
	cflags_cmd = run_command(xmlrpc_cmd, 'client', '--cflags')
74 75 76 77 78 79 80 81 82

	if libs_cmd.returncode() == 0 and cflags_cmd.returncode() == 0
		xmlrpc = declare_dependency(compile_args: cflags_cmd.stdout().strip().split(),
					   link_args : libs_cmd.stdout().strip().split())
		xmlrpc_util = declare_dependency()
		xmlrpc_client = declare_dependency()
	endif
endif

83 84 85
if pixman.found() and xmlrpc.found() and xmlrpc_util.found() and xmlrpc_client.found()
	chamelium = declare_dependency(dependencies : [ pixman, xmlrpc,
	  xmlrpc_util, xmlrpc_client])
86
	config.set('HAVE_CHAMELIUM', 1)
87 88 89 90 91 92 93 94 95 96 97
else
	chamelium = dependency('', required: false)
endif

pthreads = dependency('threads')
math = cc.find_library('m')
realtime = cc.find_library('rt')
dlsym = cc.find_library('dl')
zlib = cc.find_library('z')

if cc.has_header('linux/kd.h')
98
	config.set('HAVE_LINUX_KD_H', 1)
99 100
endif
if cc.has_header('sys/kd.h')
101
	config.set('HAVE_SYS_KD_H', 1)
102 103
endif
if cc.has_header('libgen.h')
104
	config.set('HAVE_LIBGEN_H', 1)
105 106
endif
if cc.has_header('sys/io.h')
107
	config.set('HAVE_SYS_IO_H', 1)
108 109 110
endif
if cc.has_header('cpuid.h')
	# FIXME: Do we need the example link test from configure.ac?
111
	config.set('HAVE_CPUID_H', 1)
112 113 114 115
endif

if cc.has_member('struct sysinfo', 'totalram',
		prefix : '#include <sys/sysinfo.h>')
116
	config.set('HAVE_STRUCT_SYSINFO_TOTALRAM', 1)
117 118 119 120 121
endif

add_project_arguments('-D_GNU_SOURCE', language : 'c')
add_project_arguments('-include', 'config.h', language : 'c')

122 123 124 125 126
config.set('PACKAGE_NAME', meson.project_name())
config.set_quoted('PACKAGE_VERSION', meson.project_version())
config.set_quoted('PACKAGE', meson.project_name())
config.set('PACKAGE_STRING', meson.project_name() + ' ' + meson.project_version())
config.set_quoted('TARGET_CPU_PLATFORM', host_machine.cpu_family())
127

128
configure_file(output: 'config.h', install: false, configuration: config)
129 130 131 132 133 134 135

subdir('lib')
subdir('tests')
subdir('benchmarks')
subdir('tools')
if libdrm_intel.found()
	subdir('assembler')
136 137 138
	if ['x86', 'x86_64'].contains(host_machine.cpu_family())
		subdir('overlay')
	endif
139
endif
Daniel Vetter's avatar
Daniel Vetter committed
140
subdir('man')
Daniel Vetter's avatar
Daniel Vetter committed
141
subdir('docs')