summaryrefslogtreecommitdiff
path: root/src/meson.build
blob: 05d4f7b833f9fb63c54bbcf9de97e905c9c2912f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
common_sources = [
  'dispatch_common.c',
  'dispatch_common.h',
]

# Configuration file
configure_file(output: 'config.h', configuration: conf)

gl_generated = custom_target('gl_generated_dispatch.c',
                             input: gl_registry,
                             output: [
                               'gl_generated_dispatch.c',
                             ],
                             command: [
                               python,
                               gen_dispatch_py,
                               '--source',
                               '--no-header',
                               '--outputdir=' + meson.current_build_dir(),
                               '@INPUT@',
                             ])

gen_sources = [ gl_generated ]
sources = common_sources 

if build_egl
  egl_generated = custom_target('egl_generated_dispatch.c',
                                input: egl_registry,
                                output: [
                                  'egl_generated_dispatch.c',
                                ],
                                command: [
                                  python,
                                  gen_dispatch_py,
                                  '--source',
                                  '--no-header',
                                  '--outputdir=' + meson.current_build_dir(),
                                  '@INPUT@',
                                ])
  gen_sources += [ egl_generated ]                              
  sources += [ 'dispatch_egl.c' ]
endif

if build_glx
  glx_generated = custom_target('glx_generated_dispatch.c',
                                input: glx_registry,
                                output: [
                                  'glx_generated_dispatch.c',
                                ],
                                command: [
                                  python,
                                  gen_dispatch_py,
                                  '--source',
                                  '--no-header',
                                  '--outputdir=' + meson.current_build_dir(),
                                  '@INPUT@',
                                ])
  gen_sources += [ glx_generated ]
  sources += [ 'dispatch_glx.c' ]
endif

if build_wgl
  wgl_generated = custom_target('wgl_generated_dispatch.c',
                                input: wgl_registry,
                                output: [
                                  'wgl_generated_dispatch.c',
                                ],
                                command: [
                                  python,
                                  gen_dispatch_py,
                                  '--source',
                                  '--no-header',
                                  '--outputdir=' + meson.current_build_dir(),
                                  '@INPUT@',
                                ])
  gen_sources += [ wgl_generated ]
  sources += [ 'dispatch_wgl.c' ]
endif

epoxy_sources = common_sources + sources + gen_sources
epoxy_headers = gen_headers
foreach h: headers
  epoxy_headers += join_paths(meson.source_root(), 'include/epoxy/@0@'.format(h))
endforeach

if cc.get_id() == 'gcc'
  common_ldflags = [ '-Wl,-Bsymbolic', ]
else
  common_ldflags = []
endif

epoxy_deps = [ dl_dep, ]
if host_system == 'windows'
  epoxy_deps += [ opengl32_dep, gdi32_dep ]
endif

# Allow building a static version of epoxy
libtype = get_option('default_library')

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,
                                   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,
                                   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)