meson.build 1.94 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
nice_gen_sources = []
nice_link_args = []

# libnice.def
libnice_def = custom_target('libnice.def',
    command: [find_program('gen-def.py'), '@INPUT@'],
    input: 'libnice.sym',
    output: 'libnice.def',
    capture: true)

# map file
mapfile = custom_target('libnice.map',
    command: [find_program('gen-map.py'), '@INPUT@'],
    input: 'libnice.sym',
    output: 'libnice.map',
    capture: true)
# We need to check with a file that exists at configure time!
if cc.has_link_argument('-Wl,--version-script,@0@/libnice.ver'.format(meson.current_source_dir()))
  nice_link_args += ['-Wl,--version-script,@0@'.format(mapfile.full_path())]
endif

libnice = library('nice',
  link_whole: [libagent, libsocket, libstun, librandom],
Nirbheek Chauhan's avatar
Nirbheek Chauhan committed
24
  dependencies: nice_deps,
25 26 27 28 29 30 31 32 33 34 35
  version : libversion,
  soversion : soversion,
  vs_module_defs: libnice_def,
  link_args: nice_link_args,
  link_depends: mapfile,
  install: true)

install_headers('nice.h', subdir: 'nice')
nice_include = include_directories('.')

# introspection
36
build_gir = gir.found() and not get_option('introspection').disabled()
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54
if build_gir
  nice_gen_sources += [
    gnome.generate_gir(libnice,
      sources : [agent_headers, agent_sources],
      namespace : 'Nice',
      nsversion : '0.1',
      identifier_prefix : 'Nice',
      symbol_prefix: 'nice',
      export_packages: 'nice',
      includes: ['GObject-2.0', 'Gio-2.0'],
      extra_args: ['--accept-unprefixed'],
      install: true)
  ]
endif

libnice_dep = declare_dependency(link_with : libnice,
  include_directories : [agent_include, nice_include],
  # Everything that uses libnice needs this built to compile
55 56
  sources : nice_gen_sources,
  dependencies: nice_deps)
57 58 59 60 61 62 63 64 65

# pkg-config file
pkg = import('pkgconfig')
upnp_enabled_string = gupnp_igd_dep.found() ? 'true' : 'false'
pkg.generate(libnice,
  name: 'libnice',
  filebase: 'nice',
  subdirs: 'nice',
  description: 'ICE library',
66
  libraries: gio_dep,
67
  variables: ['upnp_enabled=@0@'.format(upnp_enabled_string)])