summaryrefslogtreecommitdiffstats
path: root/src/opengl/include/glad/meson.build
blob: 05b3f02324ba3b3123bc066446eee2f1f617c0b6 (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
glad_check = run_command([ python, '-c', 'import glad; print(glad.__version__)' ],
  env: python_env,
  capture: true,
  check: false,
)

glad_ver = glad_check.returncode() == 0 ? glad_check.stdout().strip() : 'none'
glad_req = '>= 2.0'

if not glad_ver.version_compare(glad_req)
  error(f'glad (required: @glad_req@, found: @glad_ver@) was not found in ' +
        'PYTHONPATH or `3rdparty`. Please run `git submodule update --init` ' +
        'followed by `meson --wipe`.')
endif

glad = custom_target('gl.h',
  output: 'gl.h',
  env: python_env,
  command: [
    python, '-m', 'glad', '--out-path=@OUTDIR@/../../',
    '--reproducible', '--merge', '--api=gl:core,gles2,egl',
    '--extensions=' + ','.join(gl_extensions), 'c', '--header-only', '--mx'
  ] + (opengl_link.allowed() ? ['--loader'] : [])
)

glad_dep = declare_dependency(
  include_directories: include_directories('..'),
  sources: glad,
)