The python installer on Windows installs two `python.exe`, one for
python2 and one for python3 and no `python2.exe` nor `python3.exe`.

This seems utterly broken to me, but luckily for us meson handles this
craziness for us, but only since version 0.46.

This is higher than we require for now, but since we only need this on
Windows, I suggest bumping the required version only on windows, and
leaving all the other OSes as is.

(Note: some future version of Meson (0.48 probably) will handle this
 internally in the find_program() call.)

Reported-by: Alexander Ashevchenko <sav...@ukr.net>
Cc: Mathieu Bridon <boche...@daitauha.fr>
Signed-off-by: Eric Engestrom <eric.engest...@intel.com>
Reviewed-by: Dylan Baker <dylan.c.ba...@intel.com>
---
 meson.build | 31 ++++++++++++++++++++++++++++++-
 1 file changed, 30 insertions(+), 1 deletion(-)

diff --git a/meson.build b/meson.build
index dfb7fe8c900..f63fd9b6926 100644
--- a/meson.build
+++ b/meson.build
@@ -710,7 +710,15 @@ if with_platform_haiku
   pre_args += '-DHAVE_HAIKU_PLATFORM'
 endif
 
-prog_python2 = find_program('python2')
+if build_machine.system() == 'windows'
+  if meson.version().version_compare('< 0.46')
+    error('Windows requires Meson 0.46+; please update and try again.')
+  else
+    prog_python2 = import('python').find_installation('python2')
+  endif
+else
+  prog_python2 = find_program('python2')
+endif
 has_mako = run_command(prog_python2, '-c', 'import mako')
 if has_mako.returncode() != 0
   error('Python (2.x) mako module required to build mesa.')
@@ -879,6 +887,27 @@ else
   endforeach
 endif
 
+# set linker arguments
+if host_machine.system() == 'windows'
+  if cc.get_id() == 'msvc'
+    add_project_link_arguments(
+      '/fixed:no',
+      '/incremental:no',
+      '/dynamicbase',
+      '/nxcompat',
+      language : ['c', 'cpp'],
+    )
+  else
+    add_project_link_arguments(
+      '-Wl,--nxcompat',
+      '-Wl,--dynamicbase',
+      '-static-libgcc',
+      '-static-libstdc++',
+      language : ['c', 'cpp'],
+    )
+  endif
+endif
+
 if host_machine.cpu_family().startswith('x86') and cc.get_id() != 'msvc'
   pre_args += '-DUSE_SSE41'
   with_sse41 = true
-- 
2.18.0

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to