meson.build revision f71742df
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'
53  foreach f: [ '-Wl,-Bsymbolic', '-Wl,-z,relro', '-Wl,-z,now', ]
54    if cc.has_argument(f)
55      common_ldflags += f
56    endif
57  endforeach
58endif
59
60# Maintain compatibility with autotools; see: https://github.com/anholt/libepoxy/issues/108
61if host_system == 'darwin'
62  common_ldflags += [ '-compatibility_version=1', '-current_version=1.0', ]
63endif
64
65epoxy_deps = [ dl_dep, ]
66if host_system == 'windows'
67  epoxy_deps += [ opengl32_dep, gdi32_dep ]
68endif
69
70# Allow building a static version of epoxy
71if libtype != 'shared'
72  libepoxy_static = static_library('epoxy',
73                                   sources: epoxy_sources + epoxy_headers,
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  libepoxy = libepoxy_static
80endif
81
82if libtype != 'static'
83  libepoxy_shared = shared_library('epoxy',
84                                   sources: epoxy_sources + epoxy_headers,
85                                   version: '0.0.0',
86                                   install: true,
87                                   dependencies: epoxy_deps,
88                                   include_directories: libepoxy_inc,
89                                   c_args: common_cflags + visibility_cflags,
90                                   link_args: common_ldflags)
91  libepoxy = libepoxy_shared
92endif
93
94libepoxy_dep = declare_dependency(link_with: libepoxy,
95                                  include_directories: libepoxy_inc,
96                                  dependencies: epoxy_deps,
97                                  sources: epoxy_headers)
98