Added few more stubs so that control reaches to DestroyDevice().
[mesa.git] / meson.build
index f7ed6c73af61e8af970c60f9c0ff4d0c6bdca0ba..9cbf6a7f7e772adb876053746bd71ab5fd89d2a2 100644 (file)
@@ -262,6 +262,7 @@ endif
 with_intel_vk = _vulkan_drivers.contains('intel')
 with_amd_vk = _vulkan_drivers.contains('amd')
 with_freedreno_vk = _vulkan_drivers.contains('freedreno')
+with_libresoc_vk = _vulkan_drivers.contains('libre-soc')
 with_swrast_vk = _vulkan_drivers.contains('swrast')
 with_any_vk = _vulkan_drivers.length() != 0
 
@@ -427,8 +428,10 @@ else
 endif
 
 # Android uses emutls for versions <= P/28. For USE_ELF_TLS we need ELF TLS.
-if not ['windows', 'freebsd'].contains(host_machine.system()) and (not with_platform_android or get_option('platform-sdk-version') >= 29)
+use_elf_tls = false
+if not ['windows', 'freebsd', 'openbsd'].contains(host_machine.system()) and (not with_platform_android or get_option('platform-sdk-version') >= 29)
   pre_args += '-DUSE_ELF_TLS'
+  use_elf_tls = true
 endif
 
 if with_glx != 'disabled'
@@ -794,23 +797,10 @@ if _opencl != 'disabled'
   dep_clc = dependency('libclc')
   with_gallium_opencl = true
   with_opencl_icd = _opencl == 'icd'
-
-  with_opencl_spirv = get_option('opencl-spirv')
-  if with_opencl_spirv
-    dep_spirv_tools = dependency('SPIRV-Tools', required : true, version : '>= 2018.0')
-    # LLVMSPIRVLib is available at https://github.com/KhronosGroup/SPIRV-LLVM-Translator
-    dep_llvmspirvlib = dependency('LLVMSPIRVLib', required : true, version : '>= 0.2.1')
-  else
-    dep_spirv_tools = null_dep
-    dep_llvmspirvlib = null_dep
-  endif
 else
   dep_clc = null_dep
-  dep_spirv_tools = null_dep
-  dep_llvmspirvlib = null_dep
   with_gallium_opencl = false
   with_opencl_icd = false
-  with_opencl_spirv = false
 endif
 
 gl_pkgconfig_c_flags = []
@@ -945,7 +935,7 @@ elif host_machine.system() == 'sunos'
   pre_args += '-D__EXTENSIONS__'
 elif host_machine.system() == 'windows'
   pre_args += [
-    '-D_WINDOWS', '-D_WIN32_WINNT=0x0601', '-DWINVER=0x0601',
+    '-D_WINDOWS', '-D_WIN32_WINNT=0x0A00', '-DWINVER=0x0A00',
     '-DPIPE_SUBSYSTEM_WINDOWS_USER',
     '-D_USE_MATH_DEFINES',  # XXX: scons doesn't use this for mingw
   ]
@@ -962,6 +952,8 @@ elif host_machine.system() == 'windows'
   else
     pre_args += ['-D__MSVCRT_VERSION__=0x0700']
   endif
+elif host_machine.system() == 'openbsd'
+  pre_args += '-D_ISOC11_SOURCE'
 endif
 
 # Check for generic C arguments
@@ -986,6 +978,8 @@ if cc.get_id() == 'msvc'
                '/wd4624',  # destructor was implicitly defined as deleted [from LLVM]
                '/wd4309',  # 'initializing': truncation of constant value
                '/wd4838',  # conversion from 'int' to 'const char' requires a narrowing conversion
+               '/we4020',  # Error when passing the wrong number of parameters
+               '/we4024',  # Error when passing different type of parameter
               ]
     if cc.has_argument(a)
       c_args += a
@@ -1213,7 +1207,7 @@ if not ['linux'].contains(host_machine.system())
   endif
 endif
 
-foreach h : ['xlocale.h', 'linux/futex.h', 'endian.h', 'dlfcn.h', 'execinfo.h', 'sys/shm.h', 'cet.h']
+foreach h : ['xlocale.h', 'linux/futex.h', 'endian.h', 'dlfcn.h', 'execinfo.h', 'sys/shm.h', 'cet.h', 'pthread_np.h']
   if cc.check_header(h)
     pre_args += '-DHAVE_@0@'.format(h.to_upper().underscorify())
   endif
@@ -1352,12 +1346,6 @@ if dep_thread.found() and host_machine.system() != 'windows'
       args : '-D_GNU_SOURCE')
     pre_args += '-DHAVE_PTHREAD_SETAFFINITY'
   endif
-  if cc.has_function(
-      'pthread_setaffinity_np',
-      dependencies : dep_thread,
-      prefix : '#include <pthread_np.h>')
-    pre_args += '-DPTHREAD_SETAFFINITY_IN_NP_HEADER'
-  endif
 endif
 if host_machine.system() != 'windows'
   dep_expat = dependency('expat', fallback : ['expat', 'expat_dep'])
@@ -1454,7 +1442,8 @@ if with_gallium_opencl
   ]
 endif
 
-if with_amd_vk or with_gallium_radeonsi
+with_opencl_spirv = _opencl != 'disabled' and get_option('opencl-spirv')
+if with_amd_vk or with_gallium_radeonsi or with_opencl_spirv
   _llvm_version = '>= 8.0.0'
 elif with_gallium_swr
   _llvm_version = '>= 6.0.0'
@@ -1548,6 +1537,30 @@ elif with_gallium_opencl
   error('The OpenCL "Clover" state tracker requires LLVM, but LLVM is disabled.')
 endif
 
+if with_opencl_spirv
+  chosen_llvm_version_array = dep_llvm.version().split('.')
+  chosen_llvm_version_major = chosen_llvm_version_array[0].to_int()
+  chosen_llvm_version_minor = chosen_llvm_version_array[1].to_int()
+
+  # Require an SPIRV-LLVM-Translator version compatible with the chosen LLVM
+  # one.
+  _llvmspirvlib_version = [
+    # This first version check is still needed as maybe LLVM 8.0 was picked but
+    # we do not want to accept SPIRV-LLVM-Translator 8.0.0.1 as that version does
+    # not have the required API and those are only available starting from
+    # 8.0.1.3.
+    '>= 8.0.1.3',
+    '>= @0@.@1@'.format(chosen_llvm_version_major, chosen_llvm_version_minor),
+    '< @0@.@1@'.format(chosen_llvm_version_major, chosen_llvm_version_minor + 1) ]
+
+  dep_spirv_tools = dependency('SPIRV-Tools', required : true, version : '>= 2018.0')
+  # LLVMSPIRVLib is available at https://github.com/KhronosGroup/SPIRV-LLVM-Translator
+  dep_llvmspirvlib = dependency('LLVMSPIRVLib', required : true, version : _llvmspirvlib_version)
+else
+  dep_spirv_tools = null_dep
+  dep_llvmspirvlib = null_dep
+endif
+
 if (with_amd_vk or with_gallium_radeonsi or with_gallium_opencl or
     (with_gallium_r600 and with_llvm))
   dep_elf = dependency('libelf', required : false)
@@ -1714,7 +1727,7 @@ if with_platform_x11
     dep_x11 = dependency('x11')
     dep_xext = dependency('xext')
     dep_xdamage = dependency('xdamage', version : '>= 1.1')
-    dep_xfixes = dependency('xfixes')
+    dep_xfixes = dependency('xfixes', version : '>= 2.0')
     dep_xcb_glx = dependency('xcb-glx', version : '>= 1.8.1')
     dep_xcb_shm = dependency('xcb-shm')
   endif
@@ -1770,10 +1783,10 @@ endif
 _sensors = get_option('lmsensors')
 if _sensors == 'true'
   _sensors = 'enabled'
-  warning('sensors option "true" deprecated, please use "enabled" instead.')
+  warning('lmsensors option "true" deprecated, please use "enabled" instead.')
 elif _sensors == 'false'
   _sensors = 'disabled'
-  warning('sensors option "false" deprecated, please use "disabled" instead.')
+  warning('lmsensors option "false" deprecated, please use "disabled" instead.')
 endif
 if _sensors != 'disabled'
   dep_lmsensors = cc.find_library('sensors', required : _sensors == 'enabled')
@@ -1835,6 +1848,12 @@ if dep_dl.found()
   gl_priv_libs += '-ldl'
 endif
 
+# FIXME: autotools lists this as incomplete
+gbm_priv_libs = []
+if dep_dl.found()
+  gbm_priv_libs += '-ldl'
+endif
+
 pkg = import('pkgconfig')
 
 if host_machine.system() == 'windows'