meson: build src/glx/windows
authorJon Turney <jon.turney@dronecode.org.uk>
Mon, 20 Nov 2017 22:05:47 +0000 (22:05 +0000)
committerJon Turney <jon.turney@dronecode.org.uk>
Thu, 30 Nov 2017 15:09:21 +0000 (15:09 +0000)
Signed-off-by: Jon Turney <jon.turney@dronecode.org.uk>
Reviewed-by: Dylan Baker <dylan@pnwbakers.com>
Acked-by: Eric Engestrom <eric.engestrom@imgtec.com>
src/glx/meson.build
src/glx/windows/meson.build [new file with mode: 0644]

index deef3ed..a7eb48a 100644 (file)
@@ -18,8 +18,7 @@
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 # SOFTWARE.
 
-# TODO: 
-#subdir('windows')
+subdir('windows')
 
 files_libglx = files(
   'clientattrib.c',
@@ -63,6 +62,8 @@ files_libglx = files(
 )
 
 extra_libs_libglx = []
+extra_deps_libgl = []
+extra_ld_args_libgl = []
 
 if with_dri
   files_libglx += files(
@@ -99,11 +100,15 @@ if with_dri_platform == 'apple'
   files_libglx += files('applegl_glx.c')
 elif with_dri_platform == 'windows'
   files_libglx += files('driwindows_glx.c')
-  # TODO
-  #extra_libs_libglx += [
-    #libwindowsdri,
-    #libwindowsglx,
-  #]
+  extra_libs_libglx += [
+    libwindowsdri,
+    libwindowsglx,
+  ]
+  extra_deps_libgl = [
+    meson.get_compiler('c').find_library('gdi32'),
+    meson.get_compiler('c').find_library('opengl32')
+  ]
+  extra_ld_args_libgl = '-Wl,--disable-stdcall-fixup'
 endif
 
 dri_driver_dir = join_paths(get_option('prefix'), dri_drivers_path)
@@ -139,7 +144,7 @@ libglx = static_library(
   ],
   c_args : [c_vis_args, gl_lib_cargs,
             '-DGL_LIB_NAME="lib@0@.so.@1@"'.format(gl_lib_name, gl_lib_version.split('.')[0])],
-  link_with : [libloader, libloader_dri3_helper, libmesa_util, libxmlconfig],
+  link_with : [libloader, libloader_dri3_helper, libmesa_util, libxmlconfig, extra_libs_libglx],
   dependencies : [dep_libdrm, dep_dri2proto, dep_glproto, dep_x11, dep_glvnd],
   build_by_default : false,
 )
@@ -161,9 +166,9 @@ if with_glx == 'dri'
     ],
     link_with : [libglapi_static, libglapi],
     link_whole : libglx,
-    link_args : [ld_args_bsymbolic, ld_args_gc_sections],
+    link_args : [ld_args_bsymbolic, ld_args_gc_sections, extra_ld_args_libgl],
     dependencies : [dep_libdrm, dep_dl, dep_m, dep_thread, dep_x11,
-                    dep_xcb_dri2, dep_xcb_dri3],
+                    dep_xcb_dri2, dep_xcb_dri3, extra_deps_libgl],
     version : gl_lib_version,
     install : true,
   )
diff --git a/src/glx/windows/meson.build b/src/glx/windows/meson.build
new file mode 100644 (file)
index 0000000..153f41a
--- /dev/null
@@ -0,0 +1,68 @@
+# Copyright © 2017 Jon Turney
+
+# Permission is hereby granted, free of charge, to any person obtaining a copy
+# of this software and associated documentation files (the "Software"), to deal
+# in the Software without restriction, including without limitation the rights
+# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+# copies of the Software, and to permit persons to whom the Software is
+# furnished to do so, subject to the following conditions:
+
+# The above copyright notice and this permission notice shall be included in
+# all copies or substantial portions of the Software.
+
+# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+# SOFTWARE.
+
+# protocol defines for the Windows-DRI server extension
+
+files_windowsdriproto = files(
+ 'windowsdriconst.h',
+ 'windowsdristr.h',
+ )
+
+install_headers(
+  files_windowsdriproto,
+  subdir: 'X11/extensions',
+)
+
+pkg.generate(
+  name : 'windowsdriproto',
+  description : 'Windows-DRI extension headers',
+  version : '1.0.0',
+)
+
+# library for using the Windows-DRI server extension
+files_libwindowsdri = files(
+  'xwindowsdri.c',
+  'xwindowsdri.h',
+)
+
+libwindowsdri = static_library(
+  'driwindows',
+  [files_libwindowsdri, files_windowsdriproto],
+  dependencies: dep_xext,
+  build_by_default: false,
+)
+
+# library for native GL on windows
+files_libwindowsglx = files(
+  'windowsgl.c',
+  'windowsgl.h',
+  'windowsgl_internal.h',
+  'windows_drawable.c',
+  'wgl.c',
+  'wgl.h',
+)
+
+libwindowsglx = static_library(
+  'glxwindows',
+  [files_libwindowsglx, files_windowsdriproto],
+  include_directories: [inc_include, inc_src, inc_glapi],
+  c_args : [c_vis_args],
+  build_by_default: false,
+)