From 9a7d8509efe4ac509b082cbffa24e52a7697926c Mon Sep 17 00:00:00 2001 From: Daniel Vetter Date: Tue, 5 Sep 2017 14:36:14 +0200 Subject: meson: basic build system support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Why? Because it's fast. Like really, really fast. Some data (from a snb laptop, so rather lower-powered): - Incremental build after $ touch lib/igt_core.c with meson: 0.6s It notices that the symbol list of the libigt.so hasn't changed and doesn't bother re-linking the almost 300 binaries we have. make -j 6 for the same scenario takes 44s. - Incremental build with nothing changed: make: 0.7s, meson: 0.2s This means stuff like --disable-git-hash is entirely pointless with meson, it's faster than a make ever can be (with 0.6s). - Reconfigure stage: ninja reconfigure 0.8s vs. ./configure 8.6s) - Running tests, after a full build: ninja test 6s vs. make check 24s - Full build (i.e. including ./autogen.sh respectively meson build), including tests, from a pristine git checkout. automake 2m49s vs. meson 44s. Cc: Ville Syrjälä Cc: Eric Anholt Cc: Daniel Stone Acked-by: Jani Nikula Acked-by: Arkadiusz Hiler Acked-by: Petri Latvala Acked-by: Daniel Stone Acked-by: Radoslaw Szwichtenberg Signed-off-by: Daniel Vetter --- meson.build | 105 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 105 insertions(+) create mode 100644 meson.build (limited to 'meson.build') diff --git a/meson.build b/meson.build new file mode 100644 index 00000000..fee64fcd --- /dev/null +++ b/meson.build @@ -0,0 +1,105 @@ +project('IGT gpu tests', 'c', + version : '1.19', + default_options: [ + 'warning_level=2', + 'c_std=gnu99', + ], + license : 'MIT') + +cc = meson.get_compiler('c') + +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 ') + 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 -- cgit v1.2.3