Add the right include paths for EGL and X11 headers

Libepoxy currently depends on all headers living under the same prefix.
This is not necessarily true: X11 headers can live in a separate prefix,
for instance under /opt/X11. This is also the case when cross-compiling to
a platform that sets up the build environment in non-standard ways.

We could add `x11_dep` and `egl_dep` to the libepoxy target dependencies,
but that could potentially add spurious linker flags and cause libepoxy to
depend on libraries it will dlopen() during normal operations.

To avoid that case, we use a partial_dep() object from Meson, and we limit
the dependency to compiler flags and inclusion paths.
macos/v1.5.9^2
Alex Richardson 3 years ago
parent 8db879f810
commit 9bf4788455
  1. 2
      meson.build
  2. 6
      src/meson.build

@ -165,9 +165,11 @@ endif
dl_dep = cc.find_library('dl', required: false) dl_dep = cc.find_library('dl', required: false)
gl_dep = dependency('gl', required: false) gl_dep = dependency('gl', required: false)
egl_dep = dependency('egl', required: false) egl_dep = dependency('egl', required: false)
elg_headers_dep = egl_dep.partial_dependency(compile_args: true, includes: true)
# Optional dependencies for tests # Optional dependencies for tests
x11_dep = dependency('x11', required: false) x11_dep = dependency('x11', required: false)
x11_headers_dep = x11_dep.partial_dependency(compile_args: true, includes: true)
# GLES v2 and v1 may have pkg-config files, courtesy of downstream # GLES v2 and v1 may have pkg-config files, courtesy of downstream
# packagers; let's check those first, and fall back to find_library() # packagers; let's check those first, and fall back to find_library()

@ -59,6 +59,12 @@ epoxy_deps = [ dl_dep, ]
if host_system == 'windows' if host_system == 'windows'
epoxy_deps += [ opengl32_dep, gdi32_dep ] epoxy_deps += [ opengl32_dep, gdi32_dep ]
endif endif
if enable_x11
epoxy_deps += [ x11_headers_dep, ]
endif
if build_egl
epoxy_deps += [ elg_headers_dep, ]
endif
libepoxy = library( libepoxy = library(
'epoxy', 'epoxy',

Loading…
Cancel
Save