File: meson.build

package info (click to toggle)
graphene 1.8.4-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 1,184 kB
  • sloc: ansic: 12,764; xml: 74; python: 32; makefile: 14; sh: 3
file content (202 lines) | stat: -rw-r--r-- 4,927 bytes parent folder | download
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
headers = [
  'graphene-box.h',
  'graphene-euler.h',
  'graphene-frustum.h',
  'graphene-macros.h',
  'graphene-matrix.h',
  'graphene-plane.h',
  'graphene-point.h',
  'graphene-point3d.h',
  'graphene-quad.h',
  'graphene-quaternion.h',
  'graphene-ray.h',
  'graphene-rect.h',
  'graphene-size.h',
  'graphene-sphere.h',
  'graphene-triangle.h',
  'graphene-types.h',
  'graphene-vec2.h',
  'graphene-vec3.h',
  'graphene-vec4.h',
  'graphene-version-macros.h',
]

simd_headers = [
  'graphene-simd4f.h',
  'graphene-simd4x4f.h',
]

private_headers = [
  'graphene-alloc-private.h',
  'graphene-line-segment-private.h',
  'graphene-private.h',
  'graphene-vectors-private.h',
]

sources = [
  'graphene-alloc.c',
  'graphene-box.c',
  'graphene-euler.c',
  'graphene-frustum.c',
  'graphene-matrix.c',
  'graphene-plane.c',
  'graphene-point.c',
  'graphene-point3d.c',
  'graphene-quad.c',
  'graphene-quaternion.c',
  'graphene-ray.c',
  'graphene-rect.c',
  'graphene-size.c',
  'graphene-sphere.c',
  'graphene-triangle.c',
  'graphene-vectors.c'
]

simd_sources = [
  'graphene-simd4f.c',
  'graphene-simd4x4f.c',
]

if build_gobject
  headers += [ 'graphene-gobject.h' ]
  sources += [ 'graphene-gobject.c' ]
endif

# Internal configuration header
configure_file(
  output: 'config.h',
  configuration: conf,
)

# External configuration header
graphene_config_h = configure_file(
  input: 'graphene-config.h.meson',
  output: 'graphene-config.h',
  configuration: graphene_conf,
  install: true,
  install_dir: join_paths(graphene_libdir, graphene_api_path, 'include'),
)

# Version header
version_conf = configuration_data()
version_conf.set('GRAPHENE_VERSION', graphene_version)
version_conf.set('GRAPHENE_MAJOR_VERSION', graphene_major_version)
version_conf.set('GRAPHENE_MINOR_VERSION', graphene_minor_version)
version_conf.set('GRAPHENE_MICRO_VERSION', graphene_micro_version)

configure_file(
  input: 'graphene-version.h.in',
  output: 'graphene-version.h',
  configuration: version_conf,
  install: true,
  install_dir: join_paths(graphene_includedir, graphene_api_path),
)

install_headers(headers + simd_headers + [ 'graphene.h' ], subdir: graphene_api_path)

# pkg name, extra requires
pkgconfig_files = [
  [ graphene_api_path, [], ],
]

platform_deps = []

if build_gobject
  pkgconfig_files += [
    [ graphene_gobject_api_path, gobject ],
  ]

  platform_deps += gobject
endif

libgraphene = library(
  graphene_api_path,
  sources: sources + simd_sources + private_headers,
  version: libversion,
  soversion: soversion,
  install: true,
  dependencies: [ mathlib, threadlib ] + platform_deps,
  c_args: extra_args + common_cflags + debug_flags + [
    '-DGRAPHENE_COMPILATION',
  ],
  link_args: common_ldflags,
)

foreach simd: [ 'sse2', 'gcc', 'neon', 'scalar', ]
  set_variable('has_' + simd, graphene_simd.contains(simd) ? '1' : '0')
endforeach

pkgconfig = import('pkgconfig')
foreach p: pkgconfig_files
  pkg_name = p[0]
  pkg_requires = p[1]

  pkgconfig.generate(
    libgraphene,
    name: 'Graphene',
    description: 'Math classes for graphic libraries',
    url: 'https://ebassi.github.io/graphene',
    version: meson.project_version(),
    filebase: pkg_name,
    variables: [
      'graphene_has_sse2=@0@'.format(has_sse2),
      'graphene_has_gcc=@0@'.format(has_gcc),
      'graphene_has_neon=@0@'.format(has_neon),
      'graphene_has_scalar=@0@'.format(has_scalar),
    ],
    subdirs: graphene_api_path,
    requires: pkg_requires,
    extra_cflags: [
      '-I${libdir}/@0@/include'.format(graphene_api_path),
    ] + sse2_cflags + neon_cflags,
  )
endforeach

graphene_dep_sources = []

# Introspection
if build_gir
  python = python3.find_python()
  identfilter_py = join_paths(meson.current_source_dir(), 'identfilter.py')

  gir_extra_args = [
    '--identifier-filter-cmd=@0@ @1@'.format(python.path(), identfilter_py),
    '--accept-unprefixed',
    '--quiet',
    '--warn-all',
    '-DGRAPHENE_COMPILATION',
  ]

  graphene_gir = gnome.generate_gir(libgraphene,
    sources: [graphene_config_h] + headers + sources,
    namespace: 'Graphene',
    nsversion: graphene_api_version,
    identifier_prefix: 'Graphene',
    symbol_prefix: 'graphene',
    export_packages: graphene_gobject_api_path,
    includes: [ 'GObject-2.0' ],
    header: 'graphene-gobject.h',
    install: true,
    extra_args: gir_extra_args,
  )
  graphene_dep_sources += graphene_gir
endif

# Dependency for tests and benchmarks and subproject usage
graphene_inc = include_directories('.')
graphene_dep = declare_dependency(
  sources: graphene_dep_sources,
  link_with: libgraphene,
  include_directories: [ graphene_inc ],
  dependencies: [ mathlib, threadlib ] + platform_deps,
)

# tests and benchmarks depend on GLib, so we only build them if GObject is enabled
if build_gobject
  if get_option('tests')
    subdir('tests')
  endif
  if get_option('benchmarks')
    subdir('bench')
  endif
endif