1python3 = import('python3') 2 3# XWin requires OpenGL spec files in order to generate wrapper code for native GL functions 4py3 = python3.find_python() 5if run_command(py3, '-c', 'import lxml;').returncode() != 0 6 error('python3 lxml module not found') 7endif 8 9khronos_spec_dir = dependency('khronos-opengl-registry').get_pkgconfig_variable('specdir') 10 11gen_gl_wrappers_opts= ['-nodebug'] 12gen_gl_wrappers_cmd = ['env', 'PYTHONPATH=' + khronos_spec_dir, py3, files('./gen_gl_wrappers.py'), gen_gl_wrappers_opts] 13 14wgl_wrappers = custom_target( 15 'gen_wgl_wrappers', 16 command: [gen_gl_wrappers_cmd, '-registry', '@INPUT@', '-prefix', 'wgl', '-wrapper', '-preresolve', '-outfile', '@OUTPUT@'], 17 input: join_paths(khronos_spec_dir, 'wgl.xml'), 18 output: 'generated_wgl_wrappers.ic', 19 depend_files: join_paths(khronos_spec_dir, 'reg.py'), 20) 21 22gl_shim = custom_target( 23 'gen_gl_shim', 24 command: [gen_gl_wrappers_cmd, '-registry', '@INPUT@', '-shim', '-outfile', '@OUTPUT@'], 25 input: join_paths(khronos_spec_dir, 'gl.xml'), 26 output: 'generated_gl_shim.ic', 27 depend_files: join_paths(khronos_spec_dir, 'reg.py'), 28) 29 30gl_thunks = custom_target( 31 'gen_gl_thunks', 32 command: [gen_gl_wrappers_cmd, '-registry', '@INPUT@', '-thunk', '-outfile', '@OUTPUT@'], 33 input: join_paths(khronos_spec_dir, 'gl.xml'), 34 output: 'generated_gl_thunks.ic', 35 depend_files: join_paths(khronos_spec_dir, 'reg.py'), 36) 37 38gl_thunks_def = custom_target( 39 'gen_gl_thunks_def', 40 command: [gen_gl_wrappers_cmd, '-registry', '@INPUT@', '-thunkdefs', '-outfile', '@OUTPUT@'], 41 input: join_paths(khronos_spec_dir, 'gl.xml'), 42 output: 'generated_gl_thunks.def', 43 depend_files: join_paths(khronos_spec_dir, 'reg.py'), 44) 45 46srcs_windows_glx = [ 47 'winpriv.c', 48 'winpriv.h', 49 'glwindows.h', 50 'glshim.c', 51 gl_shim, 52 'indirect.c', 53 'indirect.h', 54 'wgl_ext_api.c', 55 wgl_wrappers, 56 'wgl_ext_api.h', 57] 58 59if build_windowsdri 60 srcs_windows_glx += [ 61 'dri_helpers.c', 62 'dri_helpers.h', 63 ] 64endif 65 66xwin_glx_c_args = [] 67xwin_glx_c_args += '-DHAVE_XWIN_CONFIG_H' 68xwin_glx_c_args += '-DXWIN_GLX_WINDOWS' 69 70xwin_glx = static_library( 71 'XwinGLX', 72 srcs_windows_glx, 73 include_directories: [ 74 inc, 75 top_dir_inc, 76 include_directories('../'), 77 ], 78 dependencies: common_dep, 79 c_args: xwin_glx_c_args, 80) 81 82srcs_wgl_thunk = [ 83 'glthunk.c', 84 gl_thunks, 85] 86 87WGLthunk = shared_library( 88 'nativeGLthunk', 89 srcs_wgl_thunk, 90 include_directories: [ 91 inc, 92 top_dir_inc, 93 ], 94 c_args: xwin_glx_c_args + [ 95 '-Wno-unused-function', 96 '-Wno-missing-prototypes', 97 '-Wno-missing-declarations', 98 ], 99 link_args: ['-lopengl32'], 100 vs_module_defs: gl_thunks_def, 101 install: true, 102) 103