[Mesa-dev] [PATCH v4 3/4] meson: Add build Intel "anv" vulkan driver

Dylan Baker dylan at pnwbakers.com
Tue Sep 26 23:38:12 UTC 2017


This allows building and installing the Intel "anv" Vulkan driver using
meson and ninja, the driver has been tested against the CTS and has
seems to pass the same series of tests (they both segfault when the CTS
tries to run wayland wsi tests).

There are still a mess of TODO, XXX, and FIXME comments in here. Those
are mostly for meson bugs I'm trying to fix, or for additional things to
implement for other drivers/features.

I have configured all intermediate libraries and optional tools to not
build by default, meaning they will only be built if they're pulled in
as a dependency of a target that will actually be installed) this allows
us to avoid massive if chains, while ensuring that only the bits that
need to be built are.

v2: - enable anv, x11, and wayland by default
    - add configure option to disable valgrind
v3: - fix typo in meson_options (Nicholas)
v4: - Remove dead code (Eric)
    - Remove change to generator that was from v0 (Eric)
    - replace if chain with loop (Eric)
    - Fix typos (Eric)
    - define HAVE_DLOPEN for both libdl and builtin dl cases (Eric)

Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
Reviewed-by: Eric Anholt <eric at anholt.net>
---
 include/meson.build                     |  22 ++
 meson.build                             | 418 ++++++++++++++++++++++++++++++++
 meson_options.txt                       |  30 +++
 src/compiler/glsl/meson.build           |  29 +++
 src/compiler/meson.build                |  57 +++++
 src/compiler/nir/meson.build            | 205 ++++++++++++++++
 src/egl/wayland/wayland-drm/meson.build |  21 ++
 src/gtest/meson.build                   |  26 ++
 src/intel/blorp/meson.build             |  37 +++
 src/intel/common/meson.build            |  44 ++++
 src/intel/compiler/meson.build          | 155 ++++++++++++
 src/intel/genxml/meson.build            |  59 +++++
 src/intel/isl/meson.build               | 105 ++++++++
 src/intel/meson.build                   |  31 +++
 src/intel/tools/meson.build             |  39 +++
 src/intel/vulkan/meson.build            | 182 ++++++++++++++
 src/mapi/glapi/gen/meson.build          |  19 ++
 src/meson.build                         |  48 ++++
 src/util/meson.build                    | 134 ++++++++++
 src/util/tests/hash_table/meson.build   |  32 +++
 src/vulkan/meson.build                  |  28 +++
 src/vulkan/util/meson.build             |  41 ++++
 src/vulkan/wsi/meson.build              |  71 ++++++
 23 files changed, 1833 insertions(+)
 create mode 100644 include/meson.build
 create mode 100644 meson.build
 create mode 100644 meson_options.txt
 create mode 100644 src/compiler/glsl/meson.build
 create mode 100644 src/compiler/meson.build
 create mode 100644 src/compiler/nir/meson.build
 create mode 100644 src/egl/wayland/wayland-drm/meson.build
 create mode 100644 src/gtest/meson.build
 create mode 100644 src/intel/blorp/meson.build
 create mode 100644 src/intel/common/meson.build
 create mode 100644 src/intel/compiler/meson.build
 create mode 100644 src/intel/genxml/meson.build
 create mode 100644 src/intel/isl/meson.build
 create mode 100644 src/intel/meson.build
 create mode 100644 src/intel/tools/meson.build
 create mode 100644 src/intel/vulkan/meson.build
 create mode 100644 src/mapi/glapi/gen/meson.build
 create mode 100644 src/meson.build
 create mode 100644 src/util/meson.build
 create mode 100644 src/util/tests/hash_table/meson.build
 create mode 100644 src/vulkan/meson.build
 create mode 100644 src/vulkan/util/meson.build
 create mode 100644 src/vulkan/wsi/meson.build

diff --git a/include/meson.build b/include/meson.build
new file mode 100644
index 00000000000..93def7e0ec2
--- /dev/null
+++ b/include/meson.build
@@ -0,0 +1,22 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+inc_drm_uapi = include_directories('drm-uapi')
+inc_vulkan = include_directories('vulkan')
diff --git a/meson.build b/meson.build
new file mode 100644
index 00000000000..0f5198bac72
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,418 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+project('mesa', ['c', 'cpp'], version : '17.3.0-devel', license : 'MIT',
+        default_options : ['c_std=c99'])
+
+with_dri3 = true  # XXX: need a switch for this
+with_vulkan_icd_dir = get_option('vulkan_icd_dir')
+with_tests = get_option('build-tests')
+with_valgrind = get_option('valgrind')
+
+# TODO: there are more platforms required for non-vulkan drivers
+with_platform_wayland = false
+with_platform_x11 = false
+_platforms = get_option('platforms')
+if _platforms != ''
+  _split = _platforms.split(',')
+  with_platform_x11 = _split.contains('x11')
+  with_platform_wayland = _split.contains('wayland')
+endif
+
+if with_vulkan_icd_dir == ''
+  with_vulkan_icd_dir = join_paths(get_option('datadir'), 'vulkan/icd.d')
+endif
+
+with_intel_vk = false
+with_amd_vk = false
+_vulkan_drivers = get_option('vulkan-drivers')
+if _vulkan_drivers != ''
+  _split = _vulkan_drivers.split(',')
+  with_intel_vk = _split.contains('intel')
+  with_amd_vk = _split.contains('amd')
+  if not (with_platform_x11 or with_platform_wayland)
+    error('Vulkan requires at least one platform (x11, wayland)')
+  endif
+endif
+
+prog_python2 = find_program('python2')
+
+cc = meson.get_compiler('c')
+if cc.get_id() == 'gcc' and cc.version().version_compare('< 4.4.6')
+  error('When using GCC version 4.2.0 or later required.')
+endif
+
+# Arguments for the preprocessor, put these in a separate array from the C and
+# C++ (cpp in meson terminology) arguments since they need to be added to the
+# default arguments for both C and C++.
+pre_args = ['-D__STDC_CONSTANT_MACROS', '-D__STDC_FORMAT_MACROS',
+            '-D__STDC_LIMIT_MACROS',
+            '-DVERSION="@0@"'.format(meson.project_version())]
+
+# Define DEBUG for debug and debugoptimized builds
+if get_option('buildtype').startswith('debug')
+  pre_args += '-DDEBUG'
+endif
+
+# Check for GCC style builtins
+foreach b : ['bswap32', 'bswap64', 'clz', 'clzll', 'ctz', 'expect', 'ffs',
+             'ffsll', 'popcount', 'popcountll', 'unreachable']
+  if cc.has_function(b)
+    pre_args += '-DHAVE___BUILTIN_ at 0@'.format(b.to_upper())
+  endif
+endforeach
+
+# check for GCC __attribute__ s
+foreach a : ['const', 'flatten', 'malloc', 'pure', 'unused',
+             'warn_unused_result', 'weak',]
+  if cc.compiles('int foo(void) __attribute__((@0@));'.format(a),
+                 name : '__attribute__((@0@))'.format(a))
+    pre_args += '-DHAVE_FUNC_ATTRIBUTE_ at 0@'.format(a.to_upper())
+  endif
+endforeach
+if cc.compiles('int foo(const char *p, ...) __attribute__((format(printf, 1, 2)));',
+               name : '__attribute__((format(...)))')
+  pre_args += '-DHAVE_FUNC_ATTRIBUTE_FORMAT'
+endif
+if cc.compiles('struct __attribute__((packed)) foo { int bar; };',
+               name : '__attribute__((packed))')
+  pre_args += '-DHAVE_FUNC_ATTRIBUTE_PACKED'
+endif
+if cc.compiles('int *foo(void) __attribute__((returns_nonnull));',
+               name : '__attribute__((returns_nonnull))')
+  pre_args += '-DHAVE_FUNC_ATTRIBUTE_NONNULL'
+endif
+if cc.compiles('''int foo_def(void) __attribute__((visibility("default")));
+                  int foo_hid(void) __attribute__((visibility("hidden")));
+                  int foo_int(void) __attribute__((visibility("internal")));
+                  int foo_pro(void) __attribute__((visibility("protected")));''',
+               name : '__attribute__((visibility(...)))')
+  pre_args += '-DHAVE_FUNC_ATTRIBUTE_VISBILITY'
+endif
+if cc.compiles('int foo(void) { return 0; } int bar(void) __attribute__((alias("foo")));',
+               name : '__attribute__((alias(...)))')
+  pre_args += '-DHAVE_FUNC_ATTRIBUTE_ALIAS'
+endif
+
+# TODO: this is very incomplete
+if host_machine.system() == 'linux'
+  pre_args += '-D_GNU_SOURCE'
+endif
+
+# Check for generic C arguments
+c_args = []
+foreach a : ['-Wall', '-Werror=implicit-function-declaration',
+             '-Werror=missing-prototypes', '-fno-math-errno',
+             '-fno-trapping-math', '-Qunused-arguments']
+  if cc.has_argument(a)
+    c_args += a
+  endif
+endforeach
+c_vis_args = []
+if cc.has_argument('-fvisibility=hidden')
+  c_vis_args += '-fvisibility=hidden'
+endif
+
+# Check for generic C++ arguments
+cpp = meson.get_compiler('cpp')
+cpp_args = []
+foreach a : ['-Wall', '-fno-math-errno', '-fno-trapping-math',
+             '-Qunused-arguments', '-Wno-non-virtual-dtor']
+  if cpp.has_argument(a)
+    cpp_args += a
+  endif
+endforeach
+cpp_vis_args = []
+if cpp.has_argument('-fvisibility=hidden')
+  cpp_vis_args += '-fvisibility=hidden'
+endif
+
+# Check for C and C++ arguments for MSVC2013 compatibility. These are only used
+# in parts of the mesa code base that need to compile with old versions of
+# MSVC, mainly common code
+c_msvc_compat_args = []
+cpp_msvc_compat_args = []
+foreach a : ['-Werror=pointer-arith', '-Werror=vla']
+  if cc.has_argument(a)
+    c_msvc_compat_args += a
+  endif
+  if cpp.has_argument(a)
+    cpp_msvc_compat_args += a
+  endif
+endforeach
+
+no_override_init_args = []
+foreach a : ['-Wno-override-init', '-Wno-initializer-overrides']
+  if cc.has_argument(a)
+    no_override_init_args += a
+  endif
+endforeach
+
+# TODO: SSE41 (which is only required for core mesa)
+
+# Check for GCC style atomics
+if cc.compiles('int main() { int n; return __atomic_load_n(&n, __ATOMIC_ACQUIRE); }',
+               name : 'GCC atomic builtins')
+  pre_args += '-DUSE_GCC_ATOMIC_BUILTINS'
+endif
+if not cc.links('''#include <stdint.h>
+                   uint64_t v;
+                   int main() {
+                     return __sync_add_and_fetch(&v, (uint64_t)1);
+                   }''',
+                name : 'GCC 64bit atomics')
+  pre_args += '-DMISSING_64_BIT_ATOMICS'
+endif
+
+# TODO: endian
+# TODO: powr8
+# TODO: shared/static? Is this even worth doing?
+
+# I don't think that I need to set any of the debug stuff, I think meson
+# handles that for us
+
+# TODO: ldflags
+
+# TODO: texture-float (gallium/mesa only)
+
+# TODO: cross-compiling. I don't think this is relavent to meson
+
+# TODO: assembly support. mesa and vc4
+
+# Check for standard headers and functions
+if cc.has_header_symbol('sys/sysmacros.h', 'major')
+  pre_args += '-DMAJOR_IN_SYSMACROS'
+elif cc.has_header_symbol('sys/mkdev.h', 'major')
+  pre_args += '-DMAJOR_IN_MKDEV'
+endif
+
+foreach h : ['xlocale.h', 'sys/sysctl.h']
+  if cc.has_header(h)
+    pre_args += '-DHAVE_ at 0@'.format(h.to_upper().underscorify())
+  endif
+endforeach
+
+foreach f : ['strtof', 'mkostemp', 'posix_memalign']
+  if cc.has_function(f)
+    pre_args += '-DHAVE_ at 0@'.format(f.to_upper())
+  endif
+endforeach
+
+# strtod locale support
+if cc.links('''
+    #define _GNU_SOURCE
+    #include <stdlib.h>
+    #include <locale.h>
+    #ifdef HAVE_XLOCALE_H
+    #include <xlocale.h>
+    #endif
+    int main() {
+      locale_t loc = newlocale(LC_CTYPE_MASK, "C", NULL);
+      const char *s = "1.0";
+      char *end;
+      double d = strtod_l(s, end, loc);
+      float f = strtod_l(s, end, loc);
+      freelocale(loc);
+      return 0;
+    }''',
+    extra_args : pre_args,
+    name : 'strtod has locale support')
+  pre_args += '-DHAVE_STRTOD_L'
+endif
+
+# Check for some linker flags
+ld_args_bsymbolic = []
+if cc.links('int main() { return 0; }', args : '-Wl,-Bsymbolic')
+  ld_args_bsymbolic += '-Wl,-Bsymbolic'
+endif
+ld_args_gc_sections = []
+if cc.links('static char unused() { return 5; } int main() { return 0; }',
+            args : '-Wl,--gc-sections')
+  ld_args_gc_sections += '-Wl,--gc-sections'
+endif
+
+# check for dl support
+if cc.has_function('dlopen')
+  dep_dl = []
+else
+  dep_dl = cc.find_library('dl')
+endif
+pre_args += '-DHAVE_DLOPEN'
+
+if not cc.has_function('dladdr', dependencies : dep_dl)
+  error('dl library doesn\'t have dladdr')
+endif
+
+if cc.has_function('dl_iterate_phdr')
+  pre_args += '-DHAVE_DL_ITERATE_PHDR'
+else
+  # TODO: this is required for vulkan
+endif
+
+# Determine whether or not the rt library is needed for time functions
+if cc.has_function('clock_gettime')
+  dep_clock = []
+else
+  dep_clock = cc.find_library('rt')
+endif
+
+# TODO: some of these may be conditional
+dep_zlib = dependency('zlib', version : '>= 1.2.3')
+dep_thread = dependency('threads')
+pre_args += '-DHAVE_PTHREAD'
+dep_elf = dependency('libelf')
+dep_expat = dependency('expat')
+# this only exists on linux so either this is linux and it will be found, or
+# its not linux and and wont
+dep_m = cc.find_library('m', required : false)
+
+# TODO: conditionalize libdrm requirement
+dep_libdrm = dependency('libdrm', version : '>= 2.4.75')
+pre_args += '-DHAVE_LIBDRM'
+
+# TODO: make this conditional
+dep_valgrind = dependency('valgrind', required : false)
+if dep_valgrind.found() and with_valgrind
+  pre_args += '-DHAVE_VALGRIND'
+endif
+
+# pthread stubs. Lets not and say we didn't
+
+# TODO: selinux
+
+# TODO: llvm-prefix and llvm-shared-libs
+
+# TODO: llvm dependency (that's all native now, yay!)
+
+# TODO: unwind (llvm [radeon, gallivm] and gallium)
+
+# TODO: flags for opengl, gles, dri
+
+# TODO: gallium-hud
+
+# TODO: glx provider
+
+# TODO: osmesa provider
+
+# TODO: flags for xa, egl, gbm, nin, xvmc, vdpau, omx, va, opencl,
+#       gallium-tests,
+
+# TODO: gallium drivers
+
+# TODO: libglvnd
+
+# TODO: symbol mangling
+
+# TODO: dri handling
+
+# TODO: shared-glapi
+
+# TODO: libgl requirements
+
+# TODO: GLX configuration
+
+# TODO: egl configuration
+
+if with_platform_wayland
+  prog_wl_scanner = find_program('wayland-scanner')
+  dep_wl_protocols = dependency('wayland-protocols', version : '>= 1.8')
+  dep_wayland_client = dependency('wayland-client', version : '>=1.11')
+  dep_wayland_server = dependency('wayland-server', version : '>=1.11')
+else
+  prog_wl_scanner = []
+  dep_wl_protocols = []
+  dep_wayland_client = []
+  dep_wayland_server = []
+endif
+
+dep_xcb_dri2 = []
+dep_xcb_dri3 = []
+if with_platform_x11
+  dep_xcb_dri2 = [
+    dependency('x11-xcb'),
+    dependency('xcb'),
+    dependency('xcb-dri2', version : '>= 1.8'),
+    dependency('xcb-xfixes'),
+  ]
+  if with_dri3
+    dep_xcb_dri3 = [
+      dep_xcb_dri2,
+      dependency('xcb-dri3'),
+      dependency('xcb-present'),
+      dependency('xcb-sync'),
+      dependency('xshmfence', version : '>= 1.1'),
+    ]
+  else
+    # TODO: dri3 is required for vulkan
+  endif
+endif
+
+# TODO: platforms for !vulkan
+
+# TODO: dri paths
+
+# TODO: dri drivers
+
+# TODO: osmesa
+
+# TODO: egl
+
+# TODO: xa
+
+# TODO: vallium G3DVL
+
+# TODO: nine
+
+# TODO: clover
+
+# TODO: egl sans x11
+
+# TODO: xvmc
+
+# TODO: gallium tests
+
+# TODO: various libdirs
+
+# TODO: swr
+
+# TODO: gallium driver dirs
+
+# FIXME: this is a workaround for #2326
+prog_touch = find_program('touch')
+dummy_cpp = custom_target(
+  'dummy_cpp',
+  output : 'dummy.cpp',
+  command : [prog_touch, '@OUTPUT@'],
+)
+
+foreach a : pre_args
+  add_project_arguments(a, language : ['c', 'cpp'])
+endforeach
+foreach a : c_args
+  add_project_arguments(a, language : ['c'])
+endforeach
+foreach a : cpp_args
+  add_project_arguments(a, language : ['cpp'])
+endforeach
+
+inc_include = include_directories('include')
+
+subdir('include')
+subdir('src')
diff --git a/meson_options.txt b/meson_options.txt
new file mode 100644
index 00000000000..0e0d04a0f8f
--- /dev/null
+++ b/meson_options.txt
@@ -0,0 +1,30 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+option('platforms',      type : 'string',  value : 'x11,wayland',
+       description : 'comma separated list of window systems to support. wayland, x11, surfaceless, drm, etc.')
+option('vulkan-drivers', type : 'string',  value : 'intel',
+       description : 'comma separated list of vulkan drivers to build.')
+option('vulkan_icd_dir', type : 'string',  value : '',
+       description : 'Location relative to prefix to put vulkan icds on install. Default: $datadir/vulkan/icd.d')
+option('valgrind',       type : 'boolean', value : true,
+       description : 'Build with valgrind support if possible')
+option('build-tests',    type : 'boolean', value : false,
+       description : 'Build unit tests. Currently this will build *all* unit tests, which may build more than expected.')
diff --git a/src/compiler/glsl/meson.build b/src/compiler/glsl/meson.build
new file mode 100644
index 00000000000..0a2537d4981
--- /dev/null
+++ b/src/compiler/glsl/meson.build
@@ -0,0 +1,29 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+# TODO: the rest of this file
+
+ir_expression_operation_h = custom_target(
+  'ir_expression_operation.h',
+  input : 'ir_expression_operation.py',
+  output : 'ir_expression_operation.h',
+  command : [prog_python2, '@INPUT@', 'enum'],
+  capture : true,
+)
diff --git a/src/compiler/meson.build b/src/compiler/meson.build
new file mode 100644
index 00000000000..9a40e2e3a1a
--- /dev/null
+++ b/src/compiler/meson.build
@@ -0,0 +1,57 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+inc_compiler = include_directories('.')
+inc_nir = include_directories('nir')
+inc_glsl = include_directories('glsl')
+
+subdir('glsl')
+
+files_libcompiler = files(
+  'builtin_type_macros.h',
+  'glsl_types.cpp',
+  'glsl_types.h',
+  'nir_types.cpp',
+  'nir_types.h',
+  'shader_enums.c',
+  'shader_enums.h',
+  'shader_info.h',
+)
+
+libcompiler = static_library(
+  'compiler',
+  [files_libcompiler, ir_expression_operation_h],
+  include_directories : [inc_mapi, inc_mesa, inc_compiler, inc_common],
+  c_args : [c_vis_args, c_msvc_compat_args, no_override_init_args],
+  cpp_args : [cpp_vis_args, cpp_msvc_compat_args],
+  build_by_default : false,
+)
+
+subdir('nir')
+
+spirv2nir = executable(
+  'spirv2nir',
+  [files('spirv/spirv2nir.c'), dummy_cpp],
+  dependencies : [dep_m, dep_thread],
+  include_directories : [inc_common, inc_nir, include_directories('spirv')],
+  link_with : [libnir, libmesa_util],
+  c_args : [c_vis_args, c_msvc_compat_args, no_override_init_args],
+  build_by_default : false,
+)
diff --git a/src/compiler/nir/meson.build b/src/compiler/nir/meson.build
new file mode 100644
index 00000000000..c260dca5467
--- /dev/null
+++ b/src/compiler/nir/meson.build
@@ -0,0 +1,205 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+nir_depends = files('nir_opcodes.py')
+
+nir_builder_opcodes_h = custom_target(
+  'nir_builder_opcodes.h',
+  input : 'nir_builder_opcodes_h.py',
+  output : 'nir_builder_opcodes.h',
+  command : [prog_python2, '@INPUT@'],
+  capture : true,
+  depend_files : nir_depends,
+)
+
+nir_constant_expressions_c = custom_target(
+  'nir_constant_expressions.c',
+  input : 'nir_constant_expressions.py',
+  output : 'nir_constant_expressions.c',
+  command : [prog_python2, '@INPUT@'],
+  capture : true,
+  depend_files : nir_depends,
+)
+
+nir_opcodes_h = custom_target(
+  'nir_opcodes.h',
+  input : 'nir_opcodes_h.py',
+  output : 'nir_opcodes.h',
+  command : [prog_python2, '@INPUT@'],
+  capture : true,
+  depend_files : nir_depends,
+)
+
+nir_opcodes_c = custom_target(
+  'nir_opcodes.c',
+  input : 'nir_opcodes_c.py',
+  output : 'nir_opcodes.c',
+  command : [prog_python2, '@INPUT@'],
+  capture : true,
+  depend_files : nir_depends,
+)
+
+nir_opt_algebraic_c = custom_target(
+  'nir_opt_algebraic.c',
+  input : 'nir_opt_algebraic.py',
+  output : 'nir_opt_algebraic.c',
+  command : [prog_python2, '@INPUT@'],
+  capture : true,
+  depend_files : files('nir_algebraic.py'),
+)
+
+spirv_info_c = custom_target(
+  'spirv_info.c',
+  input : files('../spirv/spirv_info_c.py', '../spirv/spirv.core.grammar.json'),
+  output : 'spirv_info.c',
+  command : [prog_python2, '@INPUT0@', '@INPUT1@', '@OUTPUT@'],
+)
+
+files_libnir = files(
+  'nir.c',
+  'nir.h',
+  'nir_builder.h',
+  'nir_clone.c',
+  'nir_constant_expressions.h',
+  'nir_control_flow.c',
+  'nir_control_flow.h',
+  'nir_control_flow_private.h',
+  'nir_dominance.c',
+  'nir_from_ssa.c',
+  'nir_gather_info.c',
+  'nir_gs_count_vertices.c',
+  'nir_inline_functions.c',
+  'nir_instr_set.c',
+  'nir_instr_set.h',
+  'nir_intrinsics.c',
+  'nir_intrinsics.h',
+  'nir_liveness.c',
+  'nir_loop_analyze.c',
+  'nir_loop_analyze.h',
+  'nir_lower_64bit_packing.c',
+  'nir_lower_alu_to_scalar.c',
+  'nir_lower_atomics.c',
+  'nir_lower_atomics_to_ssbo.c',
+  'nir_lower_bitmap.c',
+  'nir_lower_clamp_color_outputs.c',
+  'nir_lower_clip.c',
+  'nir_lower_clip_cull_distance_arrays.c',
+  'nir_lower_constant_initializers.c',
+  'nir_lower_double_ops.c',
+  'nir_lower_drawpixels.c',
+  'nir_lower_global_vars_to_local.c',
+  'nir_lower_gs_intrinsics.c',
+  'nir_lower_load_const_to_scalar.c',
+  'nir_lower_locals_to_regs.c',
+  'nir_lower_idiv.c',
+  'nir_lower_indirect_derefs.c',
+  'nir_lower_int64.c',
+  'nir_lower_io.c',
+  'nir_lower_io_to_temporaries.c',
+  'nir_lower_io_to_scalar.c',
+  'nir_lower_io_types.c',
+  'nir_lower_passthrough_edgeflags.c',
+  'nir_lower_patch_vertices.c',
+  'nir_lower_phis_to_scalar.c',
+  'nir_lower_read_invocation_to_scalar.c',
+  'nir_lower_regs_to_ssa.c',
+  'nir_lower_returns.c',
+  'nir_lower_samplers.c',
+  'nir_lower_samplers_as_deref.c',
+  'nir_lower_system_values.c',
+  'nir_lower_tex.c',
+  'nir_lower_to_source_mods.c',
+  'nir_lower_two_sided_color.c',
+  'nir_lower_uniforms_to_ubo.c',
+  'nir_lower_vars_to_ssa.c',
+  'nir_lower_var_copies.c',
+  'nir_lower_vec_to_movs.c',
+  'nir_lower_wpos_center.c',
+  'nir_lower_wpos_ytransform.c',
+  'nir_metadata.c',
+  'nir_move_vec_src_uses_to_dest.c',
+  'nir_normalize_cubemap_coords.c',
+  'nir_opt_conditional_discard.c',
+  'nir_opt_constant_folding.c',
+  'nir_opt_copy_prop_vars.c',
+  'nir_opt_copy_propagate.c',
+  'nir_opt_cse.c',
+  'nir_opt_dce.c',
+  'nir_opt_dead_cf.c',
+  'nir_opt_gcm.c',
+  'nir_opt_global_to_local.c',
+  'nir_opt_if.c',
+  'nir_opt_intrinsics.c',
+  'nir_opt_loop_unroll.c',
+  'nir_opt_move_comparisons.c',
+  'nir_opt_peephole_select.c',
+  'nir_opt_remove_phis.c',
+  'nir_opt_trivial_continues.c',
+  'nir_opt_undef.c',
+  'nir_phi_builder.c',
+  'nir_phi_builder.h',
+  'nir_print.c',
+  'nir_propagate_invariant.c',
+  'nir_remove_dead_variables.c',
+  'nir_repair_ssa.c',
+  'nir_search.c',
+  'nir_search.h',
+  'nir_search_helpers.h',
+  'nir_split_var_copies.c',
+  'nir_sweep.c',
+  'nir_to_lcssa.c',
+  'nir_validate.c',
+  'nir_vla.h',
+  'nir_worklist.c',
+  'nir_worklist.h',
+  '../spirv/GLSL.std.450.h',
+  '../spirv/nir_spirv.h',
+  '../spirv/spirv.h',
+  '../spirv/spirv_info.h',
+  '../spirv/spirv_to_nir.c',
+  '../spirv/vtn_alu.c',
+  '../spirv/vtn_cfg.c',
+  '../spirv/vtn_glsl450.c',
+  '../spirv/vtn_private.h',
+  '../spirv/vtn_variables.c',
+)
+
+libnir = static_library(
+  'nir',
+  [files_libnir, spirv_info_c, nir_opt_algebraic_c, nir_opcodes_c,
+   nir_opcodes_h, nir_constant_expressions_c, nir_builder_opcodes_h],
+  include_directories : [inc_common, inc_compiler, include_directories('../spirv')],
+  c_args : [c_vis_args, c_msvc_compat_args, no_override_init_args],
+  link_with : libcompiler,
+  build_by_default : false,
+)
+
+if with_tests
+  nir_control_flow_test = executable(
+    'nir_control_flow_test',
+    [files('tests/control_flow_tests.cpp'), nir_opcodes_h],
+    c_args : [c_vis_args, c_msvc_compat_args, no_override_init_args],
+    include_directories : [inc_common],
+    dependencies : [dep_thread],
+    link_with : [libmesa_util, libnir, libgtest],
+  )
+
+  test('nir_control_flow', nir_control_flow_test)
+endif
diff --git a/src/egl/wayland/wayland-drm/meson.build b/src/egl/wayland/wayland-drm/meson.build
new file mode 100644
index 00000000000..0a94626f287
--- /dev/null
+++ b/src/egl/wayland/wayland-drm/meson.build
@@ -0,0 +1,21 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+wayland_drm_xml = files('wayland-drm.xml')
diff --git a/src/gtest/meson.build b/src/gtest/meson.build
new file mode 100644
index 00000000000..b51504d400a
--- /dev/null
+++ b/src/gtest/meson.build
@@ -0,0 +1,26 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+libgtest = static_library(
+  'gtest',
+  files('src/gtest-all.cc', 'src/gtest_main.cc'),
+  include_directories : include_directories('include'),
+  build_by_default : false,
+)
diff --git a/src/intel/blorp/meson.build b/src/intel/blorp/meson.build
new file mode 100644
index 00000000000..9241535fd20
--- /dev/null
+++ b/src/intel/blorp/meson.build
@@ -0,0 +1,37 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+files_libblorp = files(
+  'blorp.c',
+  'blorp.h',
+  'blorp_blit.c',
+  'blorp_clear.c',
+  'blorp_nir_builder.h',
+  'blorp_genX_exec.h',
+  'blorp_priv.h',
+)
+
+libblorp = static_library(
+  'blorp',
+  [files_libblorp, nir_opcodes_h],
+  include_directories : [inc_common, inc_intel],
+  c_args : [c_vis_args, no_override_init_args],
+  build_by_default : false,
+)
diff --git a/src/intel/common/meson.build b/src/intel/common/meson.build
new file mode 100644
index 00000000000..90068ee7e5d
--- /dev/null
+++ b/src/intel/common/meson.build
@@ -0,0 +1,44 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+# TODO: android?
+
+files_libintel_common = files(
+  'gen_clflush.h',
+  'gen_debug.c',
+  'gen_debug.h',
+  'gen_decoder.c',
+  'gen_decoder.h',
+  'gen_device_info.c',
+  'gen_device_info.h',
+  'gen_l3_config.c',
+  'gen_l3_config.h',
+  'gen_urb_config.c',
+  'gen_sample_positions.h',
+)
+
+libintel_common = static_library(
+  ['intel_common', genX_xml_h],
+  files_libintel_common,
+  include_directories : [inc_common, inc_intel],
+  c_args : [c_vis_args, no_override_init_args],
+  dependencies : dep_libdrm,
+  build_by_default : false,
+)
diff --git a/src/intel/compiler/meson.build b/src/intel/compiler/meson.build
new file mode 100644
index 00000000000..e12fa22cf1b
--- /dev/null
+++ b/src/intel/compiler/meson.build
@@ -0,0 +1,155 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+libintel_compiler_files = files(
+  'brw_cfg.cpp',
+  'brw_cfg.h',
+  'brw_clip.h',
+  'brw_clip_line.c',
+  'brw_clip_point.c',
+  'brw_clip_tri.c',
+  'brw_clip_unfilled.c',
+  'brw_clip_util.c',
+  'brw_compile_clip.c',
+  'brw_compile_sf.c',
+  'brw_compiler.c',
+  'brw_compiler.h',
+  'brw_dead_control_flow.cpp',
+  'brw_dead_control_flow.h',
+  'brw_disasm.c',
+  'brw_eu.c',
+  'brw_eu_compact.c',
+  'brw_eu_defines.h',
+  'brw_eu_emit.c',
+  'brw_eu.h',
+  'brw_eu_util.c',
+  'brw_eu_validate.c',
+  'brw_fs_builder.h',
+  'brw_fs_cmod_propagation.cpp',
+  'brw_fs_combine_constants.cpp',
+  'brw_fs_copy_propagation.cpp',
+  'brw_fs.cpp',
+  'brw_fs_cse.cpp',
+  'brw_fs_dead_code_eliminate.cpp',
+  'brw_fs_generator.cpp',
+  'brw_fs.h',
+  'brw_fs_live_variables.cpp',
+  'brw_fs_live_variables.h',
+  'brw_fs_lower_conversions.cpp',
+  'brw_fs_lower_pack.cpp',
+  'brw_fs_nir.cpp',
+  'brw_fs_reg_allocate.cpp',
+  'brw_fs_register_coalesce.cpp',
+  'brw_fs_saturate_propagation.cpp',
+  'brw_fs_sel_peephole.cpp',
+  'brw_fs_surface_builder.cpp',
+  'brw_fs_surface_builder.h',
+  'brw_fs_validate.cpp',
+  'brw_fs_visitor.cpp',
+  'brw_inst.h',
+  'brw_interpolation_map.c',
+  'brw_ir_allocator.h',
+  'brw_ir_fs.h',
+  'brw_ir_vec4.h',
+  'brw_nir.h',
+  'brw_nir.c',
+  'brw_nir_analyze_boolean_resolves.c',
+  'brw_nir_analyze_ubo_ranges.c',
+  'brw_nir_attribute_workarounds.c',
+  'brw_nir_intrinsics.c',
+  'brw_nir_opt_peephole_ffma.c',
+  'brw_nir_tcs_workarounds.c',
+  'brw_packed_float.c',
+  'brw_predicated_break.cpp',
+  'brw_reg.h',
+  'brw_reg_type.c',
+  'brw_reg_type.h',
+  'brw_schedule_instructions.cpp',
+  'brw_shader.cpp',
+  'brw_shader.h',
+  'brw_vec4_builder.h',
+  'brw_vec4_cmod_propagation.cpp',
+  'brw_vec4_copy_propagation.cpp',
+  'brw_vec4.cpp',
+  'brw_vec4_cse.cpp',
+  'brw_vec4_dead_code_eliminate.cpp',
+  'brw_vec4_generator.cpp',
+  'brw_vec4_gs_visitor.cpp',
+  'brw_vec4_gs_visitor.h',
+  'brw_vec4.h',
+  'brw_vec4_live_variables.cpp',
+  'brw_vec4_live_variables.h',
+  'brw_vec4_nir.cpp',
+  'brw_vec4_gs_nir.cpp',
+  'brw_vec4_reg_allocate.cpp',
+  'brw_vec4_surface_builder.cpp',
+  'brw_vec4_surface_builder.h',
+  'brw_vec4_tcs.cpp',
+  'brw_vec4_tcs.h',
+  'brw_vec4_tes.cpp',
+  'brw_vec4_tes.h',
+  'brw_vec4_visitor.cpp',
+  'brw_vec4_vs_visitor.cpp',
+  'brw_vec4_vs.h',
+  'brw_vue_map.c',
+  'brw_wm_iz.cpp',
+  'gen6_gs_visitor.cpp',
+  'gen6_gs_visitor.h',
+  'intel_asm_annotation.c',
+  'intel_asm_annotation.h',
+)
+
+brw_nir_trig = custom_target(
+  'brw_nir_trig_workarounds.c',
+  input : 'brw_nir_trig_workarounds.py',
+  output : 'brw_nir_trig_workarounds.c',
+  command : [prog_python2, '@INPUT@', '-p',
+             join_paths(meson.source_root(), 'src/compiler/nir/')],
+  depend_files : files('../../compiler/nir/nir_algebraic.py'),
+  capture : true,
+)
+
+libintel_compiler = static_library(
+  'intel_compiler',
+  [libintel_compiler_files, brw_nir_trig, nir_opcodes_h, nir_builder_opcodes_h,
+   ir_expression_operation_h],
+  include_directories : [inc_common, inc_intel, inc_nir],
+  c_args : [c_vis_args, no_override_init_args],
+  cpp_args : [cpp_vis_args],
+  build_by_default : false,
+)
+
+if with_tests
+  # The last two tests are not C++ or gtest, pre comment in autotools make
+  foreach t : ['fs_cmod_propagation', 'fs_copy_propagation',
+               'fs_saturate_propagation', 'vf_float_conversions',
+               'vec4_register_coalesce', 'vec4_copy_propagation',
+               'vec4_cmod_propagation', 'eu_compact', 'eu_validate']
+    _exe = executable(
+      [t, nir_opcodes_h, ir_expression_operation_h],
+      'test_ at 0@.cpp'.format(t),
+      include_directories : [inc_common, inc_intel],
+      link_with : [libgtest, libintel_compiler, libintel_common, libnir,
+                   libmesa_util, libisl],
+      dependencies : [dep_thread, dep_dl],
+    )
+    test(t, _exe)
+  endforeach
+endif
diff --git a/src/intel/genxml/meson.build b/src/intel/genxml/meson.build
new file mode 100644
index 00000000000..30c0d8bf2f6
--- /dev/null
+++ b/src/intel/genxml/meson.build
@@ -0,0 +1,59 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+gen_xml_files = [
+  'gen4.xml',
+  'gen45.xml',
+  'gen5.xml',
+  'gen6.xml',
+  'gen7.xml',
+  'gen75.xml',
+  'gen8.xml',
+  'gen9.xml',
+  'gen10.xml',
+]
+
+genX_xml_h = custom_target(
+  'genX_xml.h',
+  input : ['gen_zipped_file.py', gen_xml_files],
+  output : 'genX_xml.h',
+  command : [prog_python2, '@INPUT@'],
+  capture : true,
+)
+
+genX_bits_h = custom_target(
+  'genX_bits.h',
+  input : ['gen_bits_header.py', gen_xml_files],
+  output : 'genX_bits.h',
+  command : [prog_python2, '@INPUT@', '-o', '@OUTPUT@'],
+)
+
+gen_xml_pack = []
+foreach f : gen_xml_files
+  _name = '@0 at _pack.h'.format(f.split('.')[0])
+  _xml = custom_target(
+    _name,
+    input : ['gen_pack_header.py', f],
+    output : _name,
+    command : [prog_python2, '@INPUT@'],
+    capture : true,
+  )
+  gen_xml_pack += _xml
+endforeach
diff --git a/src/intel/isl/meson.build b/src/intel/isl/meson.build
new file mode 100644
index 00000000000..789175e2564
--- /dev/null
+++ b/src/intel/isl/meson.build
@@ -0,0 +1,105 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+isl_gen_files = files(
+  'isl_emit_depth_stencil.c',
+  'isl_surface_state.c',
+)
+
+isl_gen4_files = files(
+  'isl_gen4.c',
+  'isl_gen4.h',
+)
+
+isl_gen6_files = files(
+  'isl_gen6.c',
+  'isl_gen6.h',
+)
+
+isl_gen7_files = files(
+  'isl_gen7.c',
+  'isl_gen7.h',
+)
+
+isl_gen8_files = files(
+  'isl_gen8.c',
+  'isl_gen8.h',
+)
+
+isl_gen9_files = files(
+  'isl_gen9.c',
+  'isl_gen9.h',
+)
+
+isl_gen_libs = []
+foreach g : [['40', isl_gen4_files], ['50', []], ['60', isl_gen6_files],
+             ['70', isl_gen7_files], ['75', []], ['80', isl_gen8_files],
+             ['90', isl_gen9_files], ['100', []]]
+  _gen = g[0]
+  _sources = g[1]
+  _lib = static_library(
+    'libisl_gen at 0@'.format(_gen),
+    [_sources, isl_gen_files, gen_xml_pack],
+    include_directories : [inc_common, inc_intel],
+    c_args : [c_vis_args, no_override_init_args,
+              '-DGEN_VERSIONx10=@0@'.format(_gen)],
+    build_by_default : false,
+  )
+  isl_gen_libs += _lib
+endforeach
+
+isl_format_layout_c = custom_target(
+  'isl_format_layout.c',
+  input : ['gen_format_layout.py', 'isl_format_layout.csv'],
+  output : 'isl_format_layout.c',
+  command : [prog_python2, '@INPUT0@', '--csv', '@INPUT1@', '--out', '@OUTPUT@'],
+)
+
+libisl_files = files(
+  'isl.c',
+  'isl.h',
+  'isl_drm.c',
+  'isl_genX_priv.h',
+  'isl_format.c',
+  'isl_priv.h',
+  'isl_storage_image.c',
+)
+
+libisl = static_library(
+  'isl',
+  [libisl_files, isl_format_layout_c, genX_bits_h],
+  include_directories : [inc_common, inc_intel, inc_drm_uapi],
+  link_with : isl_gen_libs,
+  c_args : [c_vis_args, no_override_init_args],
+  build_by_default : false,
+)
+
+if with_tests
+  isl_surf_get_image_offset_test = executable(
+    'isl_surf_get_image_offset_test',
+    'tests/isl_surf_get_image_offset_test.c',
+    dependencies : dep_m,
+    include_directories : [inc_common, inc_intel],
+    link_with : [libisl, libintel_common],
+    build_by_default : false,
+  )
+
+  test('isl_surf_get_imaage_offset', isl_surf_get_image_offset_test)
+endif
diff --git a/src/intel/meson.build b/src/intel/meson.build
new file mode 100644
index 00000000000..57676082c9d
--- /dev/null
+++ b/src/intel/meson.build
@@ -0,0 +1,31 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+inc_intel = include_directories('.')
+
+subdir('blorp')
+subdir('genxml')
+subdir('common')
+subdir('isl')
+subdir('compiler')
+subdir('tools')
+if with_intel_vk
+  subdir('vulkan')
+endif
diff --git a/src/intel/tools/meson.build b/src/intel/tools/meson.build
new file mode 100644
index 00000000000..91092fdb512
--- /dev/null
+++ b/src/intel/tools/meson.build
@@ -0,0 +1,39 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+aubinator = executable(
+  'aubinator',
+  files('aubinator.c', 'disasm.c', 'gen_disasm.h', 'intel_aub.h'),
+  dependencies : [dep_expat, dep_zlib, dep_dl, dep_thread, dep_m],
+  include_directories : [inc_common, inc_intel],
+  link_with : [libintel_common, libintel_compiler, libmesa_util],
+  c_args : [c_vis_args, no_override_init_args],
+  build_by_default : false,
+)
+
+aubinator_error_decode = executable(
+  'aubinator_error_decode',
+  files('aubinator_error_decode.c', 'disasm.c', 'gen_disasm.h'),
+  dependencies : [dep_expat, dep_zlib, dep_thread],
+  include_directories : [inc_common, inc_intel],
+  link_with : [libintel_common, libintel_compiler, libmesa_util],
+  c_args : [c_vis_args, no_override_init_args],
+  build_by_default : false,
+)
diff --git a/src/intel/vulkan/meson.build b/src/intel/vulkan/meson.build
new file mode 100644
index 00000000000..9f0ee558e8a
--- /dev/null
+++ b/src/intel/vulkan/meson.build
@@ -0,0 +1,182 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+anv_entrypoints = custom_target(
+  'anv_entrypoints.[ch]',
+  input : ['anv_entrypoints_gen.py', vk_api_xml, vk_android_native_buffer_xml],
+  output : ['anv_entrypoints.h', 'anv_entrypoints.c'],
+  command : [prog_python2, '@INPUT0@', '--xml', '@INPUT1@',
+             '--xml', '@INPUT2@', '--outdir', meson.current_build_dir()],
+  depend_files : files('anv_extensions.py'),
+)
+
+anv_extensions_c = custom_target(
+  'anv_extensions.c',
+  input : ['anv_extensions.py', vk_api_xml, vk_android_native_buffer_xml],
+  output : 'anv_extensions.c',
+  command : [prog_python2, '@INPUT0@', '--xml', '@INPUT1@',
+             '--xml', '@INPUT2@', '--out', '@OUTPUT@'],
+)
+
+intel_icd = custom_target(
+  'intel_icd',
+  input : 'anv_icd.py',
+  output : 'intel_icd. at 0@.json'.format(target_machine.cpu()),
+  command : [prog_python2, '@INPUT@',
+             '--lib-path', join_paths(get_option('prefix'), get_option('libdir')),
+             '--out', '@OUTPUT@'],
+  depend_files : files('anv_extensions.py'),
+  build_by_default : true,
+  install_dir : with_vulkan_icd_dir,
+  install : true,
+)
+
+# TODO: workaround for anv_entrypoints combining the .h and .c files in it's
+# output. See issue #2346
+block_entrypoints = custom_target(
+  'block_entrypoints',
+  command : [prog_touch, '@OUTPUT@'],
+  output : 'null',
+  depends : anv_entrypoints,
+)
+
+libanv_gen_libs = []
+anv_gen_files = files(
+  'genX_blorp_exec.c',
+  'genX_cmd_buffer.c',
+  'genX_gpu_memcpy.c',
+  'genX_pipeline.c',
+  'genX_query.c',
+  'genX_state.c',
+)
+foreach g : [['70', ['gen7_cmd_buffer.c']], ['75', ['gen7_cmd_buffer.c']],
+             ['80', ['gen8_cmd_buffer.c']], ['90', ['gen8_cmd_buffer.c']],
+             ['100', ['gen8_cmd_buffer.c']]]
+  _gen = g[0]
+  _files = g[1]
+  _lib = static_library(
+    'libanv_gen at 0@'.format(_gen),
+    [anv_gen_files, _files, block_entrypoints, nir_opcodes_h],
+    include_directories : [inc_common, inc_compiler, inc_drm_uapi, inc_intel,
+                           inc_vulkan_util, inc_vulkan_wsi],
+    c_args : [c_vis_args, no_override_init_args, '-msse2',
+              '-DGEN_VERSIONx10=@0@'.format(_gen)],
+    dependencies : [dep_libdrm, dep_valgrind],
+  )
+  libanv_gen_libs += _lib
+endforeach
+
+libanv_files = files(
+  'anv_allocator.c',
+  'anv_batch_chain.c',
+  'anv_blorp.c',
+  'anv_cmd_buffer.c',
+  'anv_debug_report.c',
+  'anv_descriptor_set.c',
+  'anv_device.c',
+  'anv_dump.c',
+  'anv_formats.c',
+  'anv_genX.h',
+  'anv_image.c',
+  'anv_intel.c',
+  'anv_nir.h',
+  'anv_nir_apply_pipeline_layout.c',
+  'anv_nir_lower_input_attachments.c',
+  'anv_nir_lower_multiview.c',
+  'anv_nir_lower_push_constants.c',
+  'anv_pass.c',
+  'anv_pipeline.c',
+  'anv_pipeline_cache.c',
+  'anv_private.h',
+  'anv_queue.c',
+  'anv_util.c',
+  'anv_wsi.c',
+  'vk_format_info.h',
+)
+
+anv_deps = []
+anv_flags = []
+
+if with_platform_x11
+  anv_deps += dep_xcb_dri3
+  anv_flags += [
+    '-DVK_USE_PLATFORM_XCB_KHR',
+    '-DVK_USE_PLATFORM_XLIB_KHR',
+  ]
+  libanv_files += files('anv_wsi_x11.c')
+endif
+
+if with_platform_wayland
+  anv_deps += dep_wayland_client
+  anv_flags += '-DVK_USE_PLATFORM_WAYLAND_KHR'
+  libanv_files += files('anv_wsi_wayland.c')
+endif
+
+libanv_common = static_library(
+  'anv_common',
+  [libanv_files, anv_entrypoints, anv_extensions_c, nir_opcodes_h],
+  include_directories : [inc_common, inc_intel, inc_compiler, inc_drm_uapi,
+                         inc_vulkan_util, inc_vulkan_wsi],
+  c_args : [c_vis_args, no_override_init_args, '-msse2', anv_flags],
+  dependencies : [dep_valgrind],
+)
+
+libvulkan_intel = shared_library(
+  'vulkan_intel',
+  [files('anv_gem.c'), block_entrypoints],
+  include_directories : [inc_common, inc_intel, inc_compiler, inc_drm_uapi,
+                         inc_vulkan_util, inc_vulkan_wsi],
+  link_whole : [libanv_common, libanv_gen_libs],
+  link_with : [libintel_compiler, libintel_common, libisl, libisl, libblorp,
+               libvulkan_util, libvulkan_wsi, libnir, libmesa_util],
+  dependencies : [dep_libdrm, dep_thread, dep_dl, dep_m, anv_deps, dep_valgrind],
+  c_args : [c_vis_args, no_override_init_args, '-msse2', anv_flags],
+  link_args : ['-Wl,--build-id=sha1', ld_args_bsymbolic, ld_args_gc_sections],
+  install : true,
+)
+
+if with_tests
+  libvulkan_intel_test = static_library(
+    'vulkan_intel_test',
+    [files('anv_gem_stubs.c'), block_entrypoints],
+    include_directories : [inc_common, inc_intel, inc_compiler, inc_drm_uapi,
+                           inc_vulkan_util, inc_vulkan_wsi],
+    link_whole : libanv_common,
+    link_with : [libanv_gen_libs, libintel_compiler, libintel_common,
+                 libisl, libblorp, libvulkan_util, libvulkan_wsi,
+                 libnir, libmesa_util],
+    dependencies : [dep_libdrm, dep_thread, dep_dl, dep_m, anv_deps,
+                    dep_valgrind],
+    c_args : [c_vis_args, no_override_init_args, '-msse2', anv_flags],
+  )
+
+  foreach t : ['block_pool_no_free', 'state_pool_no_free',
+               'state_pool_free_list_only', 'state_pool']
+    _exe = executable(
+      t,
+      ['tests/@0 at .c'.format(t), dummy_cpp, block_entrypoints],
+      link_with : libvulkan_intel_test,
+      dependencies : [dep_libdrm, dep_thread, dep_m, dep_valgrind],
+      include_directories : [inc_common, inc_intel, inc_compiler,
+                             inc_vulkan_util, inc_vulkan_wsi],
+    )
+    test('anv_ at 0@'.format(t), _exe)
+  endforeach
+endif
diff --git a/src/mapi/glapi/gen/meson.build b/src/mapi/glapi/gen/meson.build
new file mode 100644
index 00000000000..3612f1f6416
--- /dev/null
+++ b/src/mapi/glapi/gen/meson.build
@@ -0,0 +1,19 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
diff --git a/src/meson.build b/src/meson.build
new file mode 100644
index 00000000000..4c82eec70f1
--- /dev/null
+++ b/src/meson.build
@@ -0,0 +1,48 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+# TODO: libglsl_util
+
+# TODO: git_sha. There's a meson builtin for this
+
+inc_common = include_directories(
+  '../include', '.', 'mapi', 'mesa', 'gallium/include', 'gallium/auxiliary')
+inc_mesa = include_directories('mesa')
+inc_mapi = include_directories('mapi')
+
+subdir('gtest')
+subdir('util')
+#subdir('mapi/glapi/gen')
+# TODO: mapi
+# TODO: opengl
+# TODO: glx
+# TODO: osmesa
+subdir('compiler')
+subdir('egl/wayland/wayland-drm')
+subdir('vulkan')
+# TODO: amd
+subdir('intel')
+# TODO: vc4
+# TODO: opengl_common
+# TODO: dri_glx
+# TODO: gbm
+# TODO: egl
+# TODO: radv
+# TODO: gallium
diff --git a/src/util/meson.build b/src/util/meson.build
new file mode 100644
index 00000000000..d6aef8db55b
--- /dev/null
+++ b/src/util/meson.build
@@ -0,0 +1,134 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+# TODO: subdir('xmlpool')
+inc_util = include_directories('.')
+
+files_mesa_util = files(
+  'bitscan.c',
+  'bitscan.h',
+  'bitset.h',
+  'build_id.c',
+  'build_id.h',
+  'crc32.c',
+  'crc32.h',
+  'debug.c',
+  'debug.h',
+  'disk_cache.c',
+  'disk_cache.h',
+  'format_r11g11b10f.h',
+  'format_rgb9e5.h',
+  'format_srgb.h',
+  'half_float.c',
+  'half_float.h',
+  'hash_table.c',
+  'hash_table.h',
+  'list.h',
+  'macros.h',
+  'mesa-sha1.c',
+  'mesa-sha1.h',
+  'sha1/sha1.c',
+  'sha1/sha1.h',
+  'ralloc.c',
+  'ralloc.h',
+  'rand_xor.c',
+  'rand_xor.h',
+  'register_allocate.c',
+  'register_allocate.h',
+  'rgtc.c',
+  'rgtc.h',
+  'rounding.h',
+  'set.c',
+  'set.h',
+  'simple_list.h',
+  'slab.c',
+  'slab.h',
+  'strndup.h',
+  'strtod.c',
+  'strtod.h',
+  'texcompress_rgtc_tmp.h',
+  'u_atomic.c',
+  'u_atomic.h',
+  'u_dynarray.h',
+  'u_endian.h',
+  'u_queue.c',
+  'u_queue.h',
+  'u_string.h',
+  'u_thread.h',
+  'u_vector.c',
+  'u_vector.h',
+)
+
+install_data('drirc', install_dir : get_option('sysconfdir'))
+
+files_xmlconfig = files(
+  'xmlconfig.c',
+  'xmlconfig.h',
+)
+
+format_srgb = custom_target(
+  'format_srgb',
+  input : ['format_srgb.py'],
+  output : 'format_srgb.c',
+  command : [prog_python2, '@INPUT0@'],
+  capture : true,
+)
+
+libmesa_util = static_library(
+  'mesa_util',
+  [files_mesa_util, format_srgb],
+  include_directories : inc_common,
+  dependencies : [dep_zlib, dep_clock],
+  c_args : [c_msvc_compat_args, c_vis_args],
+  build_by_default : false
+)
+
+libxmlconfig = static_library(
+  'xmlconfig',
+  files_xmlconfig,
+  include_directories : inc_common,
+  dependencies : [dep_expat, dep_m],
+  c_args : [c_msvc_compat_args, c_vis_args,
+            '-DSYSCONFDIR="@0@"'.format(get_option('sysconfdir'))],
+  build_by_default : false,
+)
+
+if with_tests
+  u_atomic_test = executable(
+    'u_atomic_test',
+    files('u_atomic_test.c'),
+    include_directories : inc_common,
+    link_with : libmesa_util,
+    c_args : [c_msvc_compat_args],
+  )
+
+  roundeven_test = executable(
+    'roundeven_test',
+    files('roundeven_test.c'),
+    include_directories : inc_common,
+    c_args : [c_msvc_compat_args],
+    dependencies : [dep_m],
+  )
+
+  test('u_atomic', u_atomic_test)
+  test('roundeven', roundeven_test)
+
+  subdir('tests/hash_table')
+endif
diff --git a/src/util/tests/hash_table/meson.build b/src/util/tests/hash_table/meson.build
new file mode 100644
index 00000000000..43d8f43a83e
--- /dev/null
+++ b/src/util/tests/hash_table/meson.build
@@ -0,0 +1,32 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+foreach t : ['clear', 'collision', 'delete_and_lookup', 'delete_management',
+             'destroy_callback', 'insert_and_lookup', 'insert_many',
+             'null_destroy', 'random_entry', 'remove_null', 'replacement']
+  _test = executable(
+    '@0 at _test'.format(t),
+    files('@0 at .c'.format(t)),
+    dependencies : [dep_thread, dep_dl],
+    include_directories : [inc_include, inc_util],
+    link_with : libmesa_util,
+  )
+  test(t, _test)
+endforeach
diff --git a/src/vulkan/meson.build b/src/vulkan/meson.build
new file mode 100644
index 00000000000..3908005b8a0
--- /dev/null
+++ b/src/vulkan/meson.build
@@ -0,0 +1,28 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+vk_api_xml = files('registry/vk.xml')
+vk_android_native_buffer_xml = files('registry/vk_android_native_buffer.xml')
+
+inc_vulkan_util = include_directories('util')
+inc_vulkan_wsi = include_directories('wsi')
+
+subdir('util')
+subdir('wsi')
diff --git a/src/vulkan/util/meson.build b/src/vulkan/util/meson.build
new file mode 100644
index 00000000000..6b0ec1e5ef4
--- /dev/null
+++ b/src/vulkan/util/meson.build
@@ -0,0 +1,41 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+files_vulkan_util = files(
+  'vk_alloc.h',
+  'vk_util.c',
+  'vk_util.h',
+)
+
+vk_enum_to_str = custom_target(
+  'vk_enum_to_str',
+  input : ['gen_enum_to_str.py', vk_api_xml[0]],
+  output : ['vk_enum_to_str.c', 'vk_enum_to_str.h'],
+  command : [prog_python2, '@INPUT0@', '--xml', '@INPUT1@',
+             '--outdir', meson.current_build_dir()],
+)
+
+libvulkan_util = static_library(
+  'vulkan_util',
+  [files_vulkan_util, vk_enum_to_str],
+  include_directories : [inc_common, inc_vulkan],
+  c_args : [c_vis_args],
+  build_by_default : false,
+)
diff --git a/src/vulkan/wsi/meson.build b/src/vulkan/wsi/meson.build
new file mode 100644
index 00000000000..517f50f2158
--- /dev/null
+++ b/src/vulkan/wsi/meson.build
@@ -0,0 +1,71 @@
+# Copyright © 2017 Intel Corporation
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+wayland_drm_protocol_c = custom_target(
+  'wayland-drm-protocol.c',
+  input : wayland_drm_xml,
+  output : 'wayland-drm-protocol.c',
+  command : [prog_wl_scanner, 'code', '@INPUT@', '@OUTPUT@'],
+)
+
+wayland_drm_client_protocol_h = custom_target(
+  'wayland-drm-client-protocol.h',
+  input : wayland_drm_xml,
+  output : 'wayland-drm-client-protocol.h',
+  command : [prog_wl_scanner, 'client-header', '@INPUT@', '@OUTPUT@'],
+)
+
+vulkan_wsi_args = []
+vulkan_wsi_deps = []
+
+files_vulkan_wsi = files(
+  'wsi_common.h',
+  'wsi_common_queue.h',
+)
+if with_platform_x11
+  vulkan_wsi_args += ['-DVK_USE_PLATFORM_XCB_KHR', '-DVK_USE_PLATFORM_XLIB_KHR']
+  vulkan_wsi_deps += dep_xcb_dri3
+  files_vulkan_wsi += files(
+    'wsi_common_x11.c',
+    'wsi_common_x11.h',
+  )
+endif
+
+if with_platform_wayland
+  vulkan_wsi_deps += dep_wayland_client
+  vulkan_wsi_args += ['-DVK_USE_PLATFORM_WAYLAND_KHR']
+  files_vulkan_wsi += files(
+    'wsi_common_wayland.c',
+    'wsi_common_wayland.h',
+  )
+  files_vulkan_wsi += [
+    wayland_drm_client_protocol_h,
+    wayland_drm_protocol_c,
+  ]
+endif
+
+libvulkan_wsi = static_library(
+  'vulkan_wsi',
+  files_vulkan_wsi,
+  include_directories : [inc_common, inc_vulkan_util],
+  dependencies : [vulkan_wsi_deps, dep_libdrm],
+  c_args : [c_vis_args, vulkan_wsi_args],
+  build_by_default : false,
+)
-- 
2.14.1



More information about the mesa-dev mailing list