summaryrefslogtreecommitdiff
path: root/meson.build
blob: 0858354f1b0d7255a11c41b99fe5806740941195 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
project('IGT gpu tests', 'c',
	version : '1.19',
        default_options: [
          'warning_level=2',
          'c_std=gnu99',
        ],
	license : 'MIT',
	meson_version : '>0.40.0')

cc = meson.get_compiler('c')

cc_args = [
	'-Wno-unused-parameter',
	'-Wno-sign-compare',
	'-Wno-missing-field-initializers',
	'-Wno-clobbered',
# Macros asserting on the range of their arguments triggers this.
	'-Wno-type-limits',
# igt_assert(0) in switch statements triggers a bunch of this.
	'-Wimplicit-fallthrough=0',
]

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

inc = include_directories('lib', '.')

config_h = configuration_data()

libdrm = dependency('libdrm', version : '>=2.4.82')
libdrm_intel = dependency('libdrm_intel', required : false)
libdrm_vc4 = dependency('libdrm_vc4', 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')
libprocps = dependency('libprocps', required : false)
if libprocps.found()
	config_h.set('HAVE_PROCPS', 1)
endif

valgrind = dependency('valgrind', required : false)
if valgrind.found()
	config_h.set('HAVE_VALGRIND', 1)
endif

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

libudev = dependency('libudev', required : false)
if libudev.found()
	config_h.set('HAVE_UDEV', 1)
endif

glib = dependency('glib-2.0', required : false)
if glib.found()
	config_h.set('HAVE_GLIB', 1)
endif

libunwind = dependency('libunwind')
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)

if pixman.found() and xmlrpc.found() and xmlrpc_util.found() and xmlrpc_client.found()
	chamelium = declare_dependency(dependencies : [ pixman, xmlrpc,
	  xmlrpc_util, xmlrpc_client])
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')
	config_h.set('HAVE_LINUX_KD_H', 1)
endif
if cc.has_header('sys/kd.h')
	config_h.set('HAVE_SYS_KD_H', 1)
endif
if cc.has_header('libgen.h')
	config_h.set('HAVE_LIBGEN_H', 1)
endif
if cc.has_header('sys/io.h')
	config_h.set('HAVE_SYS_IO_H', 1)
endif
if cc.has_header('cpuid.h')
	# FIXME: Do we need the example link test from configure.ac?
	config_h.set('HAVE_CPUID_H', 1)
endif

if cc.has_member('struct sysinfo', 'totalram',
		prefix : '#include <sys/sysinfo.h>')
	config_h.set('HAVE_STRUCT_SYSINFO_TOTALRAM', 1)
endif

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

config_h.set_quoted('PACKAGE_VERSION', meson.project_version())
config_h.set_quoted('PACKAGE', meson.project_name())
config_h.set_quoted('TARGET_CPU_PLATFORM', host_machine.cpu_family())

configure_file(output: 'config.h', install: false, configuration: config_h)

subdir('lib')
subdir('tests')
subdir('benchmarks')
subdir('tools')
if libdrm_intel.found()
	subdir('assembler')
	subdir('overlay')
endif
subdir('man')