meson: Generate the pkg-config file

Instead of using a template file, and filling in the blanks, we can use
the Meson pkgconfig module to generate the pkg-config file mostly from
the library object itself — including dependencies and flags.

The template file remains in tree for the Autotools build.
macos/v1.5.9
Emmanuele Bassi 7 years ago
parent 0d6aaa20ea
commit b1119d8fcf
  1. 6
      meson.build
  2. 63
      src/meson.build

@ -231,12 +231,6 @@ if dl_dep.found()
pkgconf.set('DLOPEN_LIBS', '-ldl')
endif
configure_file(input: 'epoxy.pc.in',
output: 'epoxy.pc',
configuration: pkgconf,
install: true,
install_dir: join_paths(epoxy_libdir, 'pkgconfig'))
# Python
python = import('python3').find_python()
if not python.found()

@ -67,31 +67,38 @@ if host_system == 'windows'
epoxy_deps += [ opengl32_dep, gdi32_dep ]
endif
# Allow building a static version of epoxy
if libtype != 'shared'
libepoxy_static = static_library('epoxy',
sources: epoxy_sources + epoxy_headers,
install: true,
dependencies: epoxy_deps,
include_directories: libepoxy_inc,
c_args: common_cflags + visibility_cflags,
link_args: common_ldflags)
libepoxy = libepoxy_static
endif
if libtype != 'static'
libepoxy_shared = shared_library('epoxy',
sources: epoxy_sources + epoxy_headers,
version: '0.0.0',
install: true,
dependencies: epoxy_deps,
include_directories: libepoxy_inc,
c_args: common_cflags + visibility_cflags,
link_args: common_ldflags)
libepoxy = libepoxy_shared
endif
libepoxy_dep = declare_dependency(link_with: libepoxy,
include_directories: libepoxy_inc,
dependencies: epoxy_deps,
sources: epoxy_headers)
libepoxy = library(
'epoxy',
sources: epoxy_sources + epoxy_headers,
version: '0.0.0',
install: true,
dependencies: epoxy_deps,
include_directories: libepoxy_inc,
c_args: common_cflags + visibility_cflags,
link_args: common_ldflags,
)
libepoxy_dep = declare_dependency(
link_with: libepoxy,
include_directories: libepoxy_inc,
dependencies: epoxy_deps,
sources: epoxy_headers,
)
epoxy_has_glx = build_glx ? '1' : '0'
epoxy_has_egl = build_egl ? '1' : '0'
epoxy_has_wgl = build_wgl ? '1' : '0'
pkg = import('pkgconfig')
pkg.generate(
libraries: libepoxy,
name: 'epoxy',
description: 'GL dispatch library',
version: meson.project_version(),
variables: [
'epoxy_has_glx=@0@'.format(epoxy_has_glx),
'epoxy_has_egl=@0@'.format(epoxy_has_egl),
'epoxy_has_wgl=@0@'.format(epoxy_has_wgl),
],
filebase: 'epoxy',
)

Loading…
Cancel
Save