[Mesa-dev] [PATCH] meson: better defaults for osx, windows and cygwin

Jon Turney jon.turney at dronecode.org.uk
Sat Feb 3 21:19:20 UTC 2018


On 03/02/2018 18:07, Dylan Baker wrote:
> Quoting Jon Turney (2018-02-03 05:49:40)
>> -  if not ['darwin', 'windows'].contains(host_machine.system())
>> +  if not ['darwin', 'windows', 'cygwin'].contains(host_machine.system())
>> +    # TODO: PPC, Sparc
>>       if ['x86', 'x86_64'].contains(host_machine.cpu_family())
>>         _drivers = 'i915,i965,r100,r200,nouveau'
>>       else
>>         error('Unknown architecture. Please pass -Ddri-drivers to set driver options. Patches gladly accepted to fix this.')
>>       endif
>>     else
>> -    error('Unknown OS. Please pass -Ddri-drivers to set driver options. Patches gladly accepted to fix this.')
>> +    # only swrast would make sense here, but gallium swrast is a much better default
>> +    _drivers = ''
> 
> I'm really not a fan of dumping the 'else error' case. This currently means that
> for example haiku will try to build something that they cannot support. I'd
> really rather just set appropriate defaults for OSes that are guaranteed
> supported and still let OSes that haven't been tested fall through to error. I
> also think that's a nice place for people trying to use mesa meson on a new
> platform, since they understand we haven't tested on their OS.

Good idea.  But that's not what the code currently does.  If it's not on 
the list of 'unknown' OSes (darwin, windows), any other OS e.g. haiku 
gets treated like linux...

Attached is a revised patch which is more explicit about what's a known 
OS.  I guess the BSDs probably should be added somewhere, but idk what's 
appropriate for them.


-------------- next part --------------
From e4e767a8d4d3e08651d1336f9896c6b7efa01be1 Mon Sep 17 00:00:00 2001
From: Jon Turney <jon.turney at dronecode.org.uk>
Date: Fri, 2 Feb 2018 22:25:48 +0000
Subject: [PATCH] meson: better defaults for osx, windows and cygwin

set suitable defaults for 'dri-drivers', 'gallium-drivers', 'vulkan-drivers'
and 'platforms' options for osx, windows and cygwin, adding cygwin where
appropriate.

v2: error() for unknown OS

Signed-off-by: Jon Turney <jon.turney at dronecode.org.uk>
---
 meson.build | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)

diff --git a/meson.build b/meson.build
index cb3b6587b4..56a466f764 100644
--- a/meson.build
+++ b/meson.build
@@ -92,13 +92,16 @@ with_dri_nouveau = false
 with_dri_swrast = false
 _drivers = get_option('dri-drivers')
 if _drivers == 'auto'
-  # TODO: PPC, Sparc
-  if not ['darwin', 'windows'].contains(host_machine.system())
+  if host_machine.system() == 'linux'
+    # TODO: PPC, Sparc
     if ['x86', 'x86_64'].contains(host_machine.cpu_family())
       _drivers = 'i915,i965,r100,r200,nouveau'
     else
       error('Unknown architecture. Please pass -Ddri-drivers to set driver options. Patches gladly accepted to fix this.')
     endif
+  elif ['darwin', 'windows', 'cygwin'].contains(host_machine.system())
+    # only swrast would make sense here, but gallium swrast is a much better default
+    _drivers = ''
   else
     error('Unknown OS. Please pass -Ddri-drivers to set driver options. Patches gladly accepted to fix this.')
   endif
@@ -132,7 +135,7 @@ with_gallium_virgl = false
 with_gallium_swr = false
 _drivers = get_option('gallium-drivers')
 if _drivers == 'auto'
-  if not ['darwin', 'windows'].contains(host_machine.system())
+  if host_machine.system() == 'linux'
     # TODO: PPC, Sparc
     if ['x86', 'x86_64'].contains(host_machine.cpu_family())
       _drivers = 'r300,r600,radeonsi,nouveau,virgl,svga,swrast'
@@ -141,6 +144,8 @@ if _drivers == 'auto'
     else
       error('Unknown architecture. Please pass -Dgallium-drivers to set driver options. Patches gladly accepted to fix this.')
     endif
+  elif ['darwin', 'windows', 'cygwin'].contains(host_machine.system())
+    _drivers = 'swrast'
   else
     error('Unknown OS. Please pass -Dgallium-drivers to set driver options. Patches gladly accepted to fix this.')
   endif
@@ -170,15 +175,17 @@ with_amd_vk = false
 with_any_vk = false
 _vulkan_drivers = get_option('vulkan-drivers')
 if _vulkan_drivers == 'auto'
-  if not ['darwin', 'windows'].contains(host_machine.system())
+  if host_machine.system() == 'linux'
     if host_machine.cpu_family().startswith('x86')
       _vulkan_drivers = 'amd,intel'
     else
       error('Unknown architecture. Please pass -Dvulkan-drivers to set driver options. Patches gladly accepted to fix this.')
     endif
-  else
+  elif ['darwin', 'windows', 'cygwin'].contains(host_machine.system())
     # No vulkan driver supports windows or macOS currently
     _vulkan_drivers = ''
+  else
+    error('Unknown OS. Please pass -Dvulkan-drivers to set driver options. Patches gladly accepted to fix this.')
   endif
 endif
 if _vulkan_drivers != ''
@@ -233,8 +240,10 @@ _platforms = get_option('platforms')
 if _platforms == 'auto'
   if system_has_kms_drm
     _platforms = 'x11,wayland,drm,surfaceless'
+  elif ['darwin', 'windows', 'cygwin'].contains(host_machine.system())
+    _platforms = 'x11,surfaceless'
   else
-    error('Unknown OS, no platforms enabled. Patches gladly accepted to fix this.')
+    error('Unknown OS. Please pass -Dplatforms to set platforms. Patches gladly accepted to fix this.')
   endif
 endif
 if _platforms != ''
-- 
2.16.1



More information about the mesa-dev mailing list