| 1 |
# Configuration file |
| 2 |
configure_file(output: 'config.h', configuration: conf) |
| 3 |
|
| 4 |
# List of generated sources: |
| 5 |
# - name of the generated file |
| 6 |
# - registry source file |
| 7 |
# - additional sources |
| 8 |
generated_sources = [ |
| 9 |
[ 'gl_generated_dispatch.c', gl_registry, [ 'dispatch_common.c', 'dispatch_common.h' ] ] |
| 10 |
] |
| 11 |
|
| 12 |
if build_egl |
| 13 |
generated_sources += [ [ 'egl_generated_dispatch.c', egl_registry, 'dispatch_egl.c' ] ] |
| 14 |
endif |
| 15 |
|
| 16 |
if build_glx |
| 17 |
generated_sources += [ [ 'glx_generated_dispatch.c', glx_registry, 'dispatch_glx.c' ] ] |
| 18 |
endif |
| 19 |
|
| 20 |
if build_wgl |
| 21 |
generated_sources += [ [ 'wgl_generated_dispatch.c', wgl_registry, 'dispatch_wgl.c' ] ] |
| 22 |
endif |
| 23 |
|
| 24 |
gen_sources = [ ] |
| 25 |
sources = [ ] |
| 26 |
|
| 27 |
foreach g: generated_sources |
| 28 |
gen_source = g[0] |
| 29 |
registry = g[1] |
| 30 |
source = g[2] |
| 31 |
|
| 32 |
generated = custom_target(gen_source, |
| 33 |
input: registry, |
| 34 |
output: [ gen_source ], |
| 35 |
command: [ |
| 36 |
gen_dispatch_py, |
| 37 |
'--source', |
| 38 |
'--no-header', |
| 39 |
'--outputdir=@OUTDIR@', |
| 40 |
'@INPUT@', |
| 41 |
]) |
| 42 |
|
| 43 |
gen_sources += [ generated ] |
| 44 |
sources += [ source ] |
| 45 |
endforeach |
| 46 |
|
| 47 |
epoxy_sources = sources + gen_sources |
| 48 |
|
| 49 |
common_ldflags = [] |
| 50 |
|
| 51 |
if host_system == 'linux' and cc.get_id() == 'gcc' |
| 52 |
common_ldflags += cc.get_supported_link_arguments([ '-Wl,-Bsymbolic-functions', '-Wl,-z,relro' ]) |
| 53 |
endif |
| 54 |
|
| 55 |
# Maintain compatibility with autotools; see: https://github.com/anholt/libepoxy/issues/108 |
| 56 |
darwin_versions = [1, '1.0'] |
| 57 |
|
| 58 |
epoxy_deps = [ dl_dep, ] |
| 59 |
if host_system == 'windows' |
| 60 |
epoxy_deps += [ opengl32_dep, gdi32_dep ] |
| 61 |
endif |
| 62 |
if enable_x11 |
| 63 |
epoxy_deps += [ x11_headers_dep, ] |
| 64 |
endif |
| 65 |
if build_egl |
| 66 |
epoxy_deps += [ elg_headers_dep, ] |
| 67 |
endif |
| 68 |
|
| 69 |
libepoxy = library( |
| 70 |
'epoxy', |
| 71 |
sources: epoxy_sources + epoxy_headers, |
| 72 |
version: '0.0.0', |
| 73 |
darwin_versions: darwin_versions, |
| 74 |
install: true, |
| 75 |
dependencies: epoxy_deps, |
| 76 |
include_directories: libepoxy_inc, |
| 77 |
c_args: common_cflags + visibility_cflags, |
| 78 |
link_args: common_ldflags, |
| 79 |
) |
| 80 |
|
| 81 |
epoxy_has_glx = build_glx ? '1' : '0' |
| 82 |
epoxy_has_egl = build_egl ? '1' : '0' |
| 83 |
epoxy_has_wgl = build_wgl ? '1' : '0' |
| 84 |
|
| 85 |
libepoxy_dep = declare_dependency( |
| 86 |
link_with: libepoxy, |
| 87 |
include_directories: libepoxy_inc, |
| 88 |
dependencies: epoxy_deps, |
| 89 |
sources: epoxy_headers, |
| 90 |
variables: { |
| 91 |
'epoxy_has_glx': epoxy_has_glx, |
| 92 |
'epoxy_has_egl': epoxy_has_egl, |
| 93 |
'epoxy_has_wgl': epoxy_has_wgl, |
| 94 |
}, |
| 95 |
) |
| 96 |
|
| 97 |
# We don't want to add these dependencies to the library, as they are |
| 98 |
# not needed when building Epoxy; we do want to add them to the generated |
| 99 |
# pkg-config file, for consumers of Epoxy |
| 100 |
gl_reqs = [] |
| 101 |
if gl_dep.found() and gl_dep.type_name() == 'pkgconfig' |
| 102 |
gl_reqs += 'gl' |
| 103 |
endif |
| 104 |
if build_egl and egl_dep.found() and egl_dep.type_name() == 'pkgconfig' |
| 105 |
gl_reqs += 'egl' |
| 106 |
endif |
| 107 |
|
| 108 |
pkg = import('pkgconfig') |
| 109 |
pkg.generate( |
| 110 |
libraries: libepoxy, |
| 111 |
name: 'epoxy', |
| 112 |
description: 'GL dispatch library', |
| 113 |
version: meson.project_version(), |
| 114 |
variables: [ |
| 115 |
'epoxy_has_glx=@0@'.format(epoxy_has_glx), |
| 116 |
'epoxy_has_egl=@0@'.format(epoxy_has_egl), |
| 117 |
'epoxy_has_wgl=@0@'.format(epoxy_has_wgl), |
| 118 |
], |
| 119 |
filebase: 'epoxy', |
| 120 |
requires_private: ' '.join(gl_reqs), |
| 121 |
) |