meson: Add windows defines to glapi
authorDylan Baker <dylan@pnwbakers.com>
Wed, 18 Apr 2018 20:22:35 +0000 (13:22 -0700)
committerDylan Baker <dylan@pnwbakers.com>
Thu, 10 Oct 2019 23:33:04 +0000 (16:33 -0700)
These are needed to control the export or symbols due to differences
between the way windows and *nix handle symbol exports.

Reviewed-by: Eric Anholt <eric@anholt.net> (v2)
Acked-by: Kristian H. Kristensen <hoegsberg@google.com>
v5: - key NO_EXPORT off of shared-glapi instead of gles

src/mapi/es1api/meson.build
src/mapi/es2api/meson.build
src/mapi/glapi/meson.build
src/mapi/shared-glapi/meson.build

index 150f62f46d148fb3effd2bfecefd0bc2392cac8a..79f379707904d3dc3f7f22db85c90d6f31c38e53 100644 (file)
@@ -27,11 +27,19 @@ es1_glapi_mapi_tmp_h = custom_target(
   capture : true,
 )
 
+_es1_c_args = []
+if with_platform_windows
+  _es1_c_args += ['-D_GDI32_', '-DBUILD_GL32']
+endif
+
 libglesv1_cm = shared_library(
   'GLESv1_CM' + get_option('gles-lib-suffix'),
   ['../entry.c', es1_glapi_mapi_tmp_h],
   c_args : [
-    c_msvc_compat_args, c_vis_args, '-DMAPI_MODE_BRIDGE',
+    c_msvc_compat_args,
+    c_vis_args,
+    _es1_c_args,
+    '-DMAPI_MODE_BRIDGE',
     '-DMAPI_ABI_HEADER="@0@"'.format(es1_glapi_mapi_tmp_h.full_path()),
     gcc_lto_quirk,
   ],
index 97e4ad25de66b2a17f7293cffd2c493ff7151b02..4be142e846d4294fa9fd364e2c92c426550e711f 100644 (file)
@@ -27,11 +27,19 @@ es2_glapi_mapi_tmp_h = custom_target(
   capture : true,
 )
 
+_es2_c_args = []
+if with_platform_windows
+  _es2_c_args += ['-D_GDI32_', '-DBUILD_GL32']
+endif
+
 libgles2 = shared_library(
   'GLESv2' + get_option('gles-lib-suffix'),
   ['../entry.c', es2_glapi_mapi_tmp_h],
   c_args : [
-    c_msvc_compat_args, c_vis_args, '-DMAPI_MODE_BRIDGE',
+    c_msvc_compat_args,
+    c_vis_args,
+    _es2_c_args,
+    '-DMAPI_MODE_BRIDGE',
     '-DMAPI_ABI_HEADER="@0@"'.format(es2_glapi_mapi_tmp_h.full_path()),
     gcc_lto_quirk,
   ],
index 817dd57241dc7358a6dfe8b4fa662be64faf89a7..1b8b685f207eee43feef8483cd2cba2ae9fe8a4e 100644 (file)
@@ -25,7 +25,7 @@ inc_glapi = include_directories('.')
 static_glapi_files = []
 static_glapi_args = []
 
-if ['apple', 'windows'].contains(with_dri_platform)
+if with_dri and ['apple', 'windows'].contains(with_dri_platform)
   static_glapi_files += [glapi_gentable_c, glapitable_h]
 endif
 
@@ -46,8 +46,19 @@ if with_shared_glapi
     '-DMAPI_ABI_HEADER="@0@"'.format(glapi_mapi_tmp_h.full_path()),
     gcc_lto_quirk,
   ]
+  if with_platform_windows
+    static_glapi_args += ['-D_GDI32_', '-DBUILD_GL32']
+  endif
 else
   static_glapi_args += '-DMAPI_MODE_UTIL'
+  if with_platform_windows
+    static_glapi_args += ['-D_GDI32_', '-DBUILD_GL32', '-DKHRONOS_DLL_EXPORTS']
+    if with_shared_glapi
+      static_glapi_args += '-D_GLAPI_DLL_EXPORTS'
+    else
+      static_glapi_args += '-D_GLAPI_NO_EXPORTS'
+    endif
+  endif
   static_glapi_files += files(
     'glapi_dispatch.c',
     'glapi_entrypoint.c',
index 1847e17383b3b7504b70dd926ce4425d2ad69824..ea97e1b943720da7541a008c228027a3ef341ae1 100644 (file)
@@ -36,11 +36,19 @@ shared_glapi_mapi_tmp_h = custom_target(
   capture : true,
 )
 
+_glapi_c_args = []
+if with_platform_windows
+  _glapi_c_args += ['-D_GLAPI_DLL_EXPORTS']
+endif
+
 libglapi = shared_library(
   'glapi',
   [files_mapi_glapi, files_mapi_util, shared_glapi_mapi_tmp_h],
   c_args : [
-    c_msvc_compat_args, c_vis_args, '-DMAPI_MODE_GLAPI',
+    _glapi_c_args,
+    c_msvc_compat_args,
+    c_vis_args,
+    '-DMAPI_MODE_GLAPI',
     '-DMAPI_ABI_HEADER="@0@"'.format(shared_glapi_mapi_tmp_h.full_path()),
     gcc_lto_quirk,
   ],