File: meson.build

package info (click to toggle)
clutter-gtk 1.8.4-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 2,604 kB
  • sloc: sh: 4,707; ansic: 3,177; makefile: 184; xml: 119; sed: 16
file content (189 lines) | stat: -rw-r--r-- 5,399 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
project('clutter-gtk', 'c', version: '1.8.4',
        license: 'LGPLv2.1+',
        default_options: [
          'buildtype=debugoptimized',
          'c_std=c99',
          'warning_level=1',
        ],
        meson_version: '>= 0.40.1')

add_project_arguments([ '-D_XOPEN_SOURCE=700' ], language: 'c')

cc = meson.get_compiler('c')
host_system = host_machine.system()

version = meson.project_version().split('.')
gtk_clutter_major_version = version[0].to_int()
gtk_clutter_minor_version = version[1].to_int()
gtk_clutter_micro_version = version[2].to_int()

gtk_clutter_api_version = '@0@.0'.format(gtk_clutter_major_version)

if gtk_clutter_minor_version.is_odd()
  gtk_clutter_interface_age = 0
else
  gtk_clutter_interface_age = gtk_clutter_micro_version
endif

gtk_clutter_api_name = '@0@-@1@'.format(meson.project_name(), gtk_clutter_api_version)
gtk_clutter_api_path = join_paths(gtk_clutter_api_name, meson.project_name())

gtk_clutter_prefix = get_option('prefix')
gtk_clutter_libdir = join_paths(gtk_clutter_prefix, get_option('libdir'))
gtk_clutter_includedir = join_paths(gtk_clutter_prefix, get_option('includedir'))
gtk_clutter_datadir = join_paths(gtk_clutter_prefix, get_option('datadir'))

# maintaining compatibility with the previous libtool versioning
# current = minor * 100 + micro - interface
# revision = interface
soversion = 0
current = 100 * gtk_clutter_minor_version + gtk_clutter_micro_version - gtk_clutter_interface_age
revision = gtk_clutter_interface_age
libversion = '@0@.@1@.@2@'.format(soversion, current, revision)

config_h = configuration_data()
config_h.set_quoted('GETTEXT_PACKAGE', 'cluttergtk-@0@'.format(gtk_clutter_api_version))

# Compiler flags
common_cflags = []
common_ldflags = []

if cc.get_id() == 'msvc'
  # Make MSVC more pedantic, this is a recommended pragma list
  # from _Win32_Programming_ by Rector and Newcomer.  Taken from
  # glib's msvc_recommended_pragmas.h--please see that file for
  # the meaning of the warning codes used here
  test_cflags = [
    '-we4002',
    '-we4003',
    '-w14010',
    '-we4013',
    '-w14016',
    '-we4020',
    '-we4021',
    '-we4027',
    '-we4029',
    '-we4033',
    '-we4035',
    '-we4045',
    '-we4047',
    '-we4049',
    '-we4053',
    '-we4071',
    '-we4150',
    '-we4819'
  ]
elif cc.get_id() == 'gcc' or cc.get_id() == 'clang'
  test_cflags = [
    '-ffast-math',
    '-fstrict-aliasing',
    '-Wpointer-arith',
    '-Wmissing-declarations',
    '-Wformat=2',
    '-Wstrict-prototypes',
    '-Wmissing-prototypes',
    '-Wnested-externs',
    '-Wold-style-definition',
    '-Wunused',
    '-Wuninitialized',
    '-Wshadow',
    '-Wmissing-noreturn',
    '-Wmissing-format-attribute',
    '-Wredundant-decls',
    '-Wlogical-op',
    '-Wcast-align',
    '-Wno-unused-local-typedefs',
    '-Werror=implicit',
    '-Werror=init-self',
    '-Werror=main',
    '-Werror=missing-braces',
    '-Werror=return-type',
    '-Werror=array-bounds',
    '-Werror=write-strings',
  ]
else
  test_cflags = []
endif

# Symbol visibility
if get_option('default_library') != 'static'
  if host_system == 'windows'
    config_h.set('DLL_EXPORT', true)
    config_h.set('CLUTTER_GTK_EXTERN', '__declspec(dllexport) extern')
    if cc.get_id() != 'msvc'
      test_cflags += ['-fvisibility=hidden']
    endif
  else
    config_h.set('CLUTTER_GTK_EXTERN', '__attribute__((visibility("default"))) extern')
    test_cflags += ['-fvisibility=hidden']
  endif
endif

foreach cflag: test_cflags
  if cc.has_argument(cflag)
    common_cflags += cflag
  endif
endforeach

if host_system == 'linux'
  foreach ldflag: [ '-Wl,-Bsymbolic-functions', '-Wl,-z,relro', '-Wl,-z,now' ]
    if cc.has_argument(ldflag)
      common_ldflags += ldflag
    endif
  endforeach
endif

if host_system == 'darwin'
  common_ldflags += [ '-compatibility_version=1', '-current_version=1.0', ]
endif

gtk_clutter_debug_cflags = []
if get_option('buildtype').startswith('debug')
  gtk_clutter_debug_cflags += '-DCLUTTER_GTK_ENABLE_DEBUG'
elif get_option('buildtype') == 'release'
  gtk_clutter_debug_cflags += '-DG_DISABLE_CAST_CHECKS'
endif

if gtk_clutter_minor_version.is_even()
  gtk_clutter_debug_cflags += [
    '-DGLIB_DISABLE_DEPRECATION_WARNINGS',
    '-DCLUTTER_DISABLE_DEPRECATION_WARNINGS',
    '-DGDK_DISABLE_DEPRECATION_WARNINGS',
  ]
endif

# Dependencies
clutter_req_version = '>= 1.23.7'
gtk_req_version = '>= 3.21.0'

mathlib_dep = cc.find_library('m', required: false)
clutter_dep = dependency('clutter-1.0', version: clutter_req_version)
gtk_dep = dependency('gtk+-3.0', version: gtk_req_version)

configure_file(output: 'config.h', configuration: config_h) 

pkgconf = configuration_data()
pkgconf.set('prefix', gtk_clutter_prefix)
pkgconf.set('exec_prefix', gtk_clutter_prefix)
pkgconf.set('libdir', gtk_clutter_libdir)
pkgconf.set('includedir', gtk_clutter_includedir)
pkgconf.set('CLUTTER_GTK_API_VERSION', gtk_clutter_api_version)
pkgconf.set('VERSION', meson.project_version())
configure_file(input: 'clutter-gtk.pc.in',
               output: 'clutter-gtk-@0@.pc'.format(gtk_clutter_api_version),
               configuration: pkgconf,
               install: true,
               install_dir: join_paths(gtk_clutter_libdir, 'pkgconfig'))

root_inc = include_directories('.')

gnome = import('gnome')

subdir('clutter-gtk')
subdir('po')

subdir('examples')

if get_option('enable_docs')
  subdir('doc')
endif