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