meson: Add support for building WGL on Windows

Currently only tested with MSVC.
This commit is contained in:
Nirbheek Chauhan 2016-10-27 07:29:36 +05:30
parent 49ab51dc7d
commit 6f707381c3

View file

@ -106,7 +106,7 @@ gl_winsys_deps = []
# other things we need. # other things we need.
gl_misc_deps = [] gl_misc_deps = []
# Other preprocessor arguments # Other preprocessor arguments
gl_cpp_args = ['-DGST_USE_UNSTABLE_API'] gl_cpp_args = ['-DGST_USE_UNSTABLE_API', '-DGST_EXPORTS']
enabled_gl_apis = [] enabled_gl_apis = []
enabled_gl_platforms = [] enabled_gl_platforms = []
@ -166,8 +166,8 @@ else
need_platform_glx = 'yes' need_platform_glx = 'yes'
# elif platform == 'cgl' # elif platform == 'cgl'
# need_platform_cgl = 'yes' # need_platform_cgl = 'yes'
# elif platform == 'wgl' elif platform == 'wgl'
# need_platform_wgl = 'yes' need_platform_wgl = 'yes'
# elif platform == 'eagl' # elif platform == 'eagl'
# need_platform_eagl = 'yes' # need_platform_eagl = 'yes'
else else
@ -197,8 +197,8 @@ else
need_win_x11 = 'yes' need_win_x11 = 'yes'
elif winsys == 'wayland' elif winsys == 'wayland'
need_win_wayland = 'yes' need_win_wayland = 'yes'
# elif winsys == 'win32' elif winsys == 'win32'
# need_win_win32 = 'yes' need_win_win32 = 'yes'
# elif winsys == 'cocoa' # elif winsys == 'cocoa'
# need_win_cocoa = 'yes' # need_win_cocoa = 'yes'
# elif winsys == 'eagl' # elif winsys == 'eagl'
@ -227,13 +227,13 @@ glx_dep = unneeded_dep
if need_api_opengl != 'no' or need_platform_glx != 'no' if need_api_opengl != 'no' or need_platform_glx != 'no'
gl_dep = dependency('gl', required : false) gl_dep = dependency('gl', required : false)
if not gl_dep.found() if not gl_dep.found()
# if host_machine.system() == 'windows' if host_machine.system() == 'windows'
# gl_dep = cc.find_library('opengl32', required : false) gl_dep = cc.find_library('opengl32', required : false)
# elif host_machine.system() == 'darwin' # elif host_machine.system() == 'darwin'
# gl_dep = cc.find_library('OpenGL', required : false) # gl_dep = cc.find_library('OpenGL', required : false)
# else else
gl_dep = cc.find_library('GL', required : false) gl_dep = cc.find_library('GL', required : false)
# endif endif
if not gl_dep.found() and need_api_opengl == 'yes' if not gl_dep.found() and need_api_opengl == 'yes'
error ('Could not find requested OpenGL library') error ('Could not find requested OpenGL library')
@ -257,6 +257,9 @@ if need_api_opengl != 'no' or need_platform_glx != 'no'
# include <OpenGL/gl3.h> # include <OpenGL/gl3.h>
# endif # endif
#else #else
# if _MSC_VER
# include <windows.h>
# endif
# include <GL/gl.h> # include <GL/gl.h>
# if __WIN32__ || _WIN32 # if __WIN32__ || _WIN32
# include <GL/glext.h> # include <GL/glext.h>
@ -378,9 +381,9 @@ if need_platform_egl != 'no'
#include <EGL/egl.h> #include <EGL/egl.h>
#include <EGL/eglext.h> #include <EGL/eglext.h>
''' '''
enabled_gl_platforms += 'egl'
endif endif
enabled_gl_platforms += 'egl'
endif endif
# wayland checks # wayland checks
@ -490,19 +493,25 @@ if need_platform_wgl == 'yes'
endif endif
# XXX: untested # XXX: untested
#if need_platform_wgl != 'no' and need_win_win32 != 'no' if need_platform_wgl != 'no' and need_win_win32 != 'no'
# gdi_dep = cc.find_library('gdi32', required : false) gdi_dep = cc.find_library('gdi32', required : false)
# # FIXME: Revert back to has_header once it gains prefix support
# if cc.has_header('GL/wglext.h') and gdi_dep.found() and gl_dep.found() wglext_h = cc.has_header_symbol('GL/wglext.h', 'WGL_WGLEXT_VERSION',
# gl_platform_deps += gdi_dep prefix : '#include <windows.h>
# gl_sources += [ #include <GL/gl.h>')
# 'win32/gstglwindow_win32.c',
# 'win32/gstglwindow_win32.c', if wglext_h and gdi_dep.found() and gl_dep.found()
# ] gl_platform_deps += gdi_dep
# enabled_gl_winsys += 'win32' gl_sources += [
# enabled_gl_platforms += 'wgl' 'win32/win32_message_source.c',
# endif 'win32/gstglwindow_win32.c',
#endif 'win32/gstglwindow_win32.c',
]
enabled_gl_winsys += 'win32'
gl_winsys_deps += gdi_dep
enabled_gl_platforms += 'wgl'
endif
endif
if host_machine.system() == 'darwin' if host_machine.system() == 'darwin'
# FIXME: how to know if we're on iOS or OS X? # FIXME: how to know if we're on iOS or OS X?
@ -580,8 +589,8 @@ if build_gstgl
install : true, install : true,
dependencies : [gstbase_dep, gstvideo_dep, gmodule_dep, dependencies : [gstbase_dep, gstvideo_dep, gmodule_dep,
gl_lib_deps, gl_platform_deps, gl_winsys_deps, gl_misc_deps], gl_lib_deps, gl_platform_deps, gl_winsys_deps, gl_misc_deps],
# FIXME: This symbol list is generated on Linux, so this is wrong for Windows # Don't need vs_module_defs for gstgl because we do symbol exporting in the
vs_module_defs: vs_module_defs_dir + 'libgstgl.def', # function definitions via __declspec(dllexport/import)
) )
# TODO: generate gir # TODO: generate gir