tests: Mark gdbus-threading test as slow
[glib.git] / glib / meson.build
blob76d354c2a777d48f45a854463f2c402ca3595acb
1 configure_file(input : 'glibconfig.h.in', output : 'glibconfig.h',
2   install : true,
3   install_dir : join_paths(get_option('libdir'), 'glib-2.0/include'),
4   configuration : glibconfig_conf)
6 subdir('libcharset')
7 if not use_system_pcre
8   subdir('pcre')
9 endif
10 if have_good_vsnprintf and have_good_snprintf
11   gnulib_lib = []
12 else
13   subdir('gnulib')
14 endif
16 glib_headers = files(
17   'glib.h',
18   'glib-unix.h',
19   'glib-object.h',
21 install_headers(glib_headers, subdir : 'glib-2.0')
23 glib_deprecated_headers = files(
24   'deprecated/gallocator.h',
25   'deprecated/gcache.h',
26   'deprecated/gcompletion.h',
27   'deprecated/gmain.h',
28   'deprecated/grel.h',
29   'deprecated/gthread.h',
31 install_headers(glib_deprecated_headers, subdir : 'glib-2.0/glib/deprecated')
33 glib_sub_headers = files(
34   'glib-autocleanups.h',
35   'galloca.h',
36   'garray.h',
37   'gasyncqueue.h',
38   'gatomic.h',
39   'gbacktrace.h',
40   'gbase64.h',
41   'gbitlock.h',
42   'gbookmarkfile.h',
43   'gbytes.h',
44   'gcharset.h',
45   'gchecksum.h',
46   'gconvert.h',
47   'gdataset.h',
48   'gdate.h',
49   'gdatetime.h',
50   'gdir.h',
51   'genviron.h',
52   'gerror.h',
53   'gfileutils.h',
54   'ggettext.h',
55   'ghash.h',
56   'ghmac.h',
57   'ghook.h',
58   'ghostutils.h',
59   'gi18n.h',
60   'gi18n-lib.h',
61   'giochannel.h',
62   'gkeyfile.h',
63   'glist.h',
64   'gmacros.h',
65   'gmain.h',
66   'gmappedfile.h',
67   'gmarkup.h',
68   'gmem.h',
69   'gmessages.h',
70   'gnode.h',
71   'goption.h',
72   'gpattern.h',
73   'gpoll.h',
74   'gprimes.h',
75   'gqsort.h',
76   'gquark.h',
77   'gqueue.h',
78   'grand.h',
79   'grefcount.h',
80   'gregex.h',
81   'gscanner.h',
82   'gsequence.h',
83   'gshell.h',
84   'gslice.h',
85   'gslist.h',
86   'gspawn.h',
87   'gstdio.h',
88   'gstrfuncs.h',
89   'gtestutils.h',
90   'gstring.h',
91   'gstringchunk.h',
92   'gthread.h',
93   'gthreadpool.h',
94   'gtimer.h',
95   'gtimezone.h',
96   'gtrashstack.h',
97   'gtree.h',
98   'gtypes.h',
99   'guuid.h',
100   'gunicode.h',
101   'gurifuncs.h',
102   'gutils.h',
103   'gvarianttype.h',
104   'gvariant.h',
105   'gversion.h',
106   'gversionmacros.h',
107   'gwin32.h',
108   'gprintf.h',
110 install_headers(glib_sub_headers, subdir : 'glib-2.0/glib')
112 deprecated_sources = files(
113   'deprecated/gallocator.c',
114   'deprecated/gcache.c',
115   'deprecated/gcompletion.c',
116   'deprecated/grel.c',
117   'deprecated/gthread-deprecated.c'
120 glib_sources = files(
121   'garray.c',
122   'gasyncqueue.c',
123   'gatomic.c',
124   'gbacktrace.c',
125   'gbase64.c',
126   'gbitlock.c',
127   'gbookmarkfile.c',
128   'gbytes.c',
129   'gcharset.c',
130   'gchecksum.c',
131   'gconvert.c',
132   'gdataset.c',
133   'gdate.c',
134   'gdatetime.c',
135   'gdir.c',
136   'genviron.c',
137   'gerror.c',
138   'gfileutils.c',
139   'ggettext.c',
140   'ghash.c',
141   'ghmac.c',
142   'ghook.c',
143   'ghostutils.c',
144   'giochannel.c',
145   'gkeyfile.c',
146   'glib-init.c',
147   'glib-private.c',
148   'glist.c',
149   'gmain.c',
150   'gmappedfile.c',
151   'gmarkup.c',
152   'gmem.c',
153   'gmessages.c',
154   'gnode.c',
155   'goption.c',
156   'gpattern.c',
157   'gpoll.c',
158   'gprimes.c',
159   'gqsort.c',
160   'gquark.c',
161   'gqueue.c',
162   'grand.c',
163   'grefcount.c',
164   'gregex.c',
165   'gscanner.c',
166   'gsequence.c',
167   'gshell.c',
168   'gslice.c',
169   'gslist.c',
170   'gstdio.c',
171   'gstrfuncs.c',
172   'gstring.c',
173   'gstringchunk.c',
174   'gtestutils.c',
175   'gthread.c',
176   'gthreadpool.c',
177   'gtimer.c',
178   'gtimezone.c',
179   'gtranslit.c',
180   'gtrashstack.c',
181   'gtree.c',
182   'guniprop.c',
183   'gutf8.c',
184   'gunibreak.c',
185   'gunicollate.c',
186   'gunidecomp.c',
187   'gurifuncs.c',
188   'gutils.c',
189   'guuid.c',
190   'gvariant.c',
191   'gvariant-core.c',
192   'gvariant-parser.c',
193   'gvariant-serialiser.c',
194   'gvarianttypeinfo.c',
195   'gvarianttype.c',
196   'gversion.c',
197   'gwakeup.c',
198   'gprintf.c',
201 if host_system == 'windows'
202   glib_win_rc = configure_file(
203     input: 'glib.rc.in',
204     output: 'glib.rc',
205     configuration: glibconfig_conf,
206   )
207   glib_win_res = windows.compile_resources(glib_win_rc)
208   glib_sources += [glib_win_res]
209   glib_sources += files('gwin32.c', 'gspawn-win32.c', 'giowin32.c')
210   platform_deps = [winsock2, cc.find_library('winmm')]
211 else
212   glib_sources += files('glib-unix.c', 'gspawn.c', 'giounix.c')
213   platform_deps = []
214 endif
216 glib_sources += files('gthread-@0@.c'.format(threads_implementation))
218 if enable_dtrace
219   glib_dtrace_obj = dtrace_obj_gen.process('glib_probes.d')
220   glib_dtrace_hdr = dtrace_hdr_gen.process('glib_probes.d')
221 else
222   glib_dtrace_obj = []
223   glib_dtrace_hdr = []
224 endif
226 pcre_static_args = []
228 if use_pcre_static_flag
229   pcre_static_args = ['-DPCRE_STATIC']
230 endif
232 libglib = library('glib-2.0',
233   glib_dtrace_obj, glib_dtrace_hdr,
234   sources : [deprecated_sources, glib_sources],
235   version : library_version,
236   soversion : soversion,
237   install : true,
238   # intl.lib is not compatible with SAFESEH
239   link_args : [noseh_link_args, glib_link_flags, win32_ldflags],
240   include_directories : configinc,
241   link_with : [charset_lib, gnulib_lib],
242   dependencies : [pcre, thread_dep, libintl, librt] + libiconv + platform_deps,
243   c_args : ['-DG_LOG_DOMAIN="GLib"', '-DGLIB_COMPILATION'] + pcre_static_args + glib_hidden_visibility_args
246 libglib_dep = declare_dependency(
247   link_with : libglib,
248   # thread_dep doesn't get pulled in from libglib atm,
249   # see https://github.com/mesonbuild/meson/issues/1426
250   dependencies : [thread_dep, libintl],
251   # We sadly need to export configinc here because everyone includes <glib/*.h>
252   include_directories : [configinc, glibinc])
254 pkg.generate(libraries : [libglib, libintl],
255   libraries_private : [osx_ldflags, win32_ldflags],
256   subdirs : ['glib-2.0'],
257   extra_cflags : ['-I${libdir}/glib-2.0/include'] + win32_cflags,
258   variables : ['bindir=' + join_paths('${prefix}', get_option('bindir')),
259                'glib_genmarshal=' + join_paths('${bindir}', 'glib-genmarshal'),
260                'gobject_query=' + join_paths('${bindir}', 'gobject-query'),
261                'glib_mkenums=' + join_paths('${bindir}', 'glib-mkenums')],
262   version : glib_version,
263   install_dir : glib_pkgconfigreldir,
264   filebase : 'glib-2.0',
265   name : 'GLib',
266   description : 'C Utility Library',
269 # On Windows, glib needs a spawn helper for g_spawn* API
270 if host_system == 'windows'
271   if host_machine.cpu_family() == 'x86'
272     executable('gspawn-win32-helper', 'gspawn-win32-helper.c',
273       install : true,
274       gui_app : true,
275       include_directories : configinc,
276       dependencies : [libglib_dep])
277     executable('gspawn-win32-helper-console', 'gspawn-win32-helper.c',
278       install : true,
279       c_args : ['-DHELPER_CONSOLE'],
280       include_directories : configinc,
281       dependencies : [libglib_dep])
282   else
283     executable('gspawn-win64-helper', 'gspawn-win32-helper.c',
284       install : true,
285       gui_app : true,
286       include_directories : configinc,
287       dependencies : [libglib_dep])
288     executable('gspawn-win64-helper-console', 'gspawn-win32-helper.c',
289       install : true,
290       c_args : ['-DHELPER_CONSOLE'],
291       include_directories : configinc,
292       dependencies : [libglib_dep])
293   endif
294 else
295   gtester = executable('gtester', 'gtester.c',
296     install : true,
297     include_directories : configinc,
298     dependencies : [libglib_dep])
299 endif
301 install_data('gtester-report', install_dir : get_option('bindir'))
303 install_data('glib_gdb.py', install_dir : join_paths(glib_pkgdatadir, 'gdb'))
305 gdb_conf = configuration_data()
306 gdb_conf.set('datadir', glib_datadir)
307 # This is also used in gobject/meson.build
308 if host_system != 'windows'
309   # XXX: We add a leading './' because glib_libdir is an absolute path and we
310   # need it to be a relative path so that join_paths appends it to the end.
311   gdb_install_dir = join_paths(glib_datadir, 'gdb', 'auto-load', './' + glib_libdir)
312 else
313   # FIXME: Cannot install on Windows because the path will contain a drive
314   # letter and colons are not allowed in paths.
315   gdb_install_dir = false
316 endif
317 configure_file(
318   input: 'libglib-gdb.py.in',
319   output: 'libglib-2.0.so.@0@-gdb.py'.format(library_version),
320   configuration: gdb_conf,
321   install_dir: gdb_install_dir,
324 if enable_systemtap
325   glib_stp = configure_file(input : 'glib.stp.in',
326     output : '@0@.stp'.format(libglib.full_path().split('/').get(-1)),
327     configuration : stp_cdata,
328     install_dir : tapset_install_dir,
329     install : true)
330 endif
332 subdir('tests')