[Mesa-dev] [PATCH v4 17/49] meson: Add necessary defines for mesa_gallium on windows

Dylan Baker dylan at pnwbakers.com
Wed Aug 22 17:04:40 UTC 2018


v4: - Retain scons comments for windows specific defines

Reviewed-by: Eric Anholt <eric at anholt.net>
---
 src/mesa/meson.build | 16 ++++++++++++++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/src/mesa/meson.build b/src/mesa/meson.build
index ea884977db8..100b0d61487 100644
--- a/src/mesa/meson.build
+++ b/src/mesa/meson.build
@@ -730,11 +730,23 @@ libmesa_classic = static_library(
   build_by_default : false,
 )
 
+_mesa_gallium_args = []
+if with_platform_windows
+  _mesa_gallium_args += [
+    '-D_GDI32_',    # prevent gl* being declared __declspec(dllimport) in MS headers
+    '-DBUILD_GL32'  # declare gl* as __declspec(dllexport) in Mesa headers
+  ]
+  if not with_gles2
+    # prevent _glapi_* from being declared __declspec(dllimport)
+    _mesa_gallium_args += '-D_GLAPI_NO_EXPORTS'
+  endif
+endif
+
 libmesa_gallium = static_library(
   'mesa_gallium',
   [files_libmesa_common, files_libmesa_gallium],
-  c_args : [c_vis_args, c_msvc_compat_args],
-  cpp_args : [cpp_vis_args, cpp_msvc_compat_args],
+  c_args : [c_vis_args, c_msvc_compat_args, _mesa_gallium_args],
+  cpp_args : [cpp_vis_args, cpp_msvc_compat_args, _mesa_gallium_args],
   include_directories : [inc_common, inc_libmesa_asm, include_directories('main')],
   link_with : [libglsl, libmesa_sse41],
   dependencies : [idep_nir_headers, dep_vdpau],
-- 
2.18.0



More information about the mesa-dev mailing list