meson.build 4.73 KB
Newer Older
1
gobject_install_headers = files(
2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21
  'gobject-autocleanups.h',
  'glib-types.h',
  'gbinding.h',
  'gboxed.h',
  'gclosure.h',
  'genums.h',
  'gmarshal.h',
  'gobject.h',
  'gparam.h',
  'gparamspecs.h',
  'gsignal.h',
  'gsourceclosure.h',
  'gtype.h',
  'gtypemodule.h',
  'gtypeplugin.h',
  'gvalue.h',
  'gvaluearray.h',
  'gvaluecollector.h',
  'gvaluetypes.h',
  'gobjectnotifyqueue.c', # sic
22
)
23
install_headers(gobject_install_headers, subdir : 'glib-2.0/gobject')
24

25
gobject_sources = files(
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
  'gatomicarray.c',
  'gbinding.c',
  'gboxed.c',
  'gclosure.c',
  'genums.c',
  'gmarshal.c',
  'gobject.c',
  'gparam.c',
  'gparamspecs.c',
  'gsignal.c',
  'gsourceclosure.c',
  'gtype.c',
  'gtypemodule.c',
  'gtypeplugin.c',
  'gvalue.c',
  'gvaluearray.c',
  'gvaluetransform.c',
  'gvaluetypes.c',
44
)
45

46 47 48 49 50 51 52 53 54 55
if host_system == 'windows'
  gobject_win_rc = configure_file(
    input: 'gobject.rc.in',
    output: 'gobject.rc',
    configuration: glibconfig_conf,
  )
  gobject_win_res = windows.compile_resources(gobject_win_rc)
  gobject_sources += [gobject_win_res]
endif

56 57 58 59 60 61 62 63
if enable_dtrace
  gobject_dtrace_obj = dtrace_obj_gen.process('gobject_probes.d')
  gobject_dtrace_hdr = dtrace_hdr_gen.process('gobject_probes.d')
else
  gobject_dtrace_obj = []
  gobject_dtrace_hdr = []
endif

64 65 66 67
python_tools = [
  'glib-genmarshal',
  'glib-mkenums',
]
68

69 70
python_tools_conf = configuration_data()
python_tools_conf.set('VERSION', glib_version)
71
python_tools_conf.set('PYTHON', python_name)
72 73 74 75 76 77 78 79 80 81 82 83

foreach tool: python_tools
  tool_bin = configure_file(
    input : tool + '.in',
    output : tool,
    configuration : python_tools_conf,
    install : true,
    install_dir : glib_bindir,
  )

  # Set variables for later use
  set_variable(tool.underscorify(), tool_bin)
84 85
  # Provide tools for others when we're a subproject and they use the Meson GNOME module
  meson.override_find_program(tool, tool_bin)
86
endforeach
87

88 89 90 91 92 93
# Generate a header file containing the GObject enum types for the enums defined
# in libglib.
#
# For now, we only include gunicode.h here, since GScriptType is needed for
# Pango. More headers can be added as needed in future.
#
94 95
# We can't use gnome.mkenums() because the GNOME module looks for glib-mkenums
# in PATH, which means you can't bootstrap glib with its own glib-mkenums.
96 97 98 99 100 101
glib_enumtypes_input_headers = files(
  '../glib/gunicode.h',
)

glib_enumtypes_h = custom_target('glib_enumtypes_h',
  output : 'glib-enumtypes.h',
102
  capture : true,
103
  input : glib_enumtypes_input_headers,
104 105 106
  install : true,
  install_dir : join_paths(get_option('includedir'), 'glib-2.0/gobject'),
  command : [python, glib_mkenums,
107
             '--template', files('glib-enumtypes.h.template'),
108 109
             '@INPUT@'])

110 111
glib_enumtypes_c = custom_target('glib_enumtypes_c',
  output : 'glib-enumtypes.c',
112
  capture : true,
113 114
  input : glib_enumtypes_input_headers,
  depends : [glib_enumtypes_h],
115
  command : [python, glib_mkenums,
116
             '--template', files('glib-enumtypes.c.template'),
117 118
             '@INPUT@'])

119
glib_enumtypes_dep = declare_dependency(sources : [glib_enumtypes_h])
120 121

libgobject = library('gobject-2.0',
122
  gobject_dtrace_obj, gobject_dtrace_hdr, glib_enumtypes_h, glib_enumtypes_c,
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144
  sources : gobject_sources,
  version : library_version,
  soversion : soversion,
  darwin_versions : darwin_versions,
  install : true,
  include_directories : [configinc],
  dependencies : [libffi_dep, libglib_dep],
  c_args : ['-DG_LOG_DOMAIN="GLib-GObject"', '-DGOBJECT_COMPILATION'] + glib_hidden_visibility_args,
  link_args : glib_link_flags,
)

pkg.generate(libgobject,
  requires : ['glib-2.0'],
  version : glib_version,
  install_dir : glib_pkgconfigreldir,
  filebase : 'gobject-2.0',
  name : 'GObject',
  description : 'GLib Type, Object, Parameter and Signal Library',
)

libgobject_dep = declare_dependency(link_with : libgobject,
  include_directories : [gobjectinc],
145
  dependencies : [libglib_dep, glib_enumtypes_dep])
146

147 148 149 150
executable('gobject-query', 'gobject-query.c',
  install : true,
  dependencies : [libglib_dep, libgobject_dep])

151
install_data('gobject_gdb.py', install_dir : join_paths(glib_pkgdatadir, 'gdb'))
152 153 154 155 156 157
gdb_conf = configuration_data()
gdb_conf.set('datadir', glib_datadir)
configure_file(
  input: 'libgobject-gdb.py.in',
  output: 'libgobject-2.0.so.@0@-gdb.py'.format(library_version),
  configuration: gdb_conf,
158
  install_dir: gdb_install_dir,
159 160
)

161 162 163 164 165 166 167 168
if enable_systemtap
  gobject_stp = configure_file(input : 'gobject.stp.in',
    output : '@0@.stp'.format(libgobject.full_path().split('/').get(-1)),
    configuration : stp_cdata,
    install_dir : tapset_install_dir,
    install : true)
endif

169 170 171 172 173
# Don’t build the tests unless we can run them (either natively or in an exe wrapper)
build_tests = not meson.is_cross_build() or (meson.is_cross_build() and meson.has_exe_wrapper())
if build_tests
  subdir('tests')
endif