summaryrefslogtreecommitdiff
path: root/hw/xwin/glx/meson.build
blob: e9969536d3a0dc6f2208fea3d82dd34e102cb549 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
python3 = import('python3')

# XWin requires OpenGL spec files in order to generate wrapper code for native GL functions
py3 = python3.find_python()
if run_command(py3, '-c', 'import lxml;').returncode() != 0
    error('python3 lxml module not found')
endif

khronos_spec_dir = dependency('khronos-opengl-registry').get_pkgconfig_variable('specdir')

gen_gl_wrappers_opts= ['-nodebug']
gen_gl_wrappers_cmd = ['env', 'PYTHONPATH=' + khronos_spec_dir, py3, files('./gen_gl_wrappers.py'), gen_gl_wrappers_opts]

wgl_wrappers = custom_target(
    'gen_wgl_wrappers',
    command: [gen_gl_wrappers_cmd, '-registry', '@INPUT@', '-prefix', 'wgl', '-wrapper', '-preresolve', '-outfile', '@OUTPUT@'],
    input: join_paths(khronos_spec_dir, 'wgl.xml'),
    output: 'generated_wgl_wrappers.ic',
    depend_files: join_paths(khronos_spec_dir, 'reg.py'),
)

gl_shim = custom_target(
    'gen_gl_shim',
    command: [gen_gl_wrappers_cmd, '-registry', '@INPUT@', '-shim', '-outfile', '@OUTPUT@'],
    input: join_paths(khronos_spec_dir, 'gl.xml'),
    output: 'generated_gl_shim.ic',
    depend_files: join_paths(khronos_spec_dir, 'reg.py'),
)

gl_thunks = custom_target(
    'gen_gl_thunks',
    command: [gen_gl_wrappers_cmd, '-registry', '@INPUT@', '-thunk', '-outfile', '@OUTPUT@'],
    input: join_paths(khronos_spec_dir, 'gl.xml'),
    output: 'generated_gl_thunks.ic',
    depend_files: join_paths(khronos_spec_dir, 'reg.py'),
)

gl_thunks_def = custom_target(
    'gen_gl_thunks_def',
    command: [gen_gl_wrappers_cmd, '-registry', '@INPUT@', '-thunkdefs', '-outfile', '@OUTPUT@'],
    input: join_paths(khronos_spec_dir, 'gl.xml'),
    output: 'generated_gl_thunks.def',
    depend_files: join_paths(khronos_spec_dir, 'reg.py'),
)

srcs_windows_glx = [
    'winpriv.c',
    'winpriv.h',
    'glwindows.h',
    'glshim.c',
    gl_shim,
    'indirect.c',
    'indirect.h',
    'wgl_ext_api.c',
    wgl_wrappers,
    'wgl_ext_api.h',
]

if build_windowsdri
    srcs_windows_glx += [
        'dri_helpers.c',
        'dri_helpers.h',
    ]
endif

xwin_glx_c_args = []
xwin_glx_c_args += '-DHAVE_XWIN_CONFIG_H'
xwin_glx_c_args += '-DXWIN_GLX_WINDOWS'

xwin_glx = static_library(
    'XwinGLX',
    srcs_windows_glx,
    include_directories: [
        inc,
        top_srcdir_inc,
        include_directories('../'),
    ],
    dependencies: pixman_dep,
    c_args: xwin_glx_c_args,
)

srcs_wgl_thunk = [
    'glthunk.c',
    gl_thunks,
]

WGLthunk = shared_library(
    'nativeGLthunk',
    srcs_wgl_thunk,
    include_directories: [
        inc,
        top_srcdir_inc,
    ],
    c_args: xwin_glx_c_args + [
      '-Wno-unused-function',
      '-Wno-missing-prototypes',
      '-Wno-missing-declarations',
    ],
    link_args: ['-lopengl32'],
    vs_module_defs: gl_thunks_def,
    install: true,
)