Skip to content

Commit

Permalink
meson: explicitly test for glad2 version
Browse files Browse the repository at this point in the history
Building fails if the user only has glad1 installed, but not glad2, with
this error: argument --api: Invalid api-string: "gl:core,gles2,egl"

And if the user has neither glad1 nor glad2, it just fails with the
unhelpful "module not found". Improve both by explicitly testing for
this in the build system.
  • Loading branch information
haasn committed Jul 30, 2022
1 parent b8928ff commit eeab271
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/include/glad/meson.build
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
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,
Expand Down

0 comments on commit eeab271

Please sign in to comment.