summaryrefslogtreecommitdiff
path: root/data/meson.build
blob: d4e3bf487b4dc935030291b27db257580f5cfb88 (plain)
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
# data

# Input: install_prefix, install_libdir, install_datadir, install_includedir,
#        install_pkgconfigdir, cairomm_pcname, cairomm_api_version,
#        cairomm_requires, cairo_dep, msvc14x_toolset_ver
# Output: -

pkg_conf_data = configuration_data()
pkg_conf_data.set('prefix', install_prefix)
pkg_conf_data.set('exec_prefix', '${prefix}')
pkg_conf_data.set('libdir', '${exec_prefix}' / install_libdir)
pkg_conf_data.set('datarootdir', '${prefix}' / install_datadir)
pkg_conf_data.set('datadir', '${datarootdir}')
pkg_conf_data.set('includedir', '${prefix}' / install_includedir)
pkg_conf_data.set('PACKAGE_VERSION', meson.project_version())
pkg_conf_data.set('CAIROMM_MODULE_NAME', cairomm_pcname)
pkg_conf_data.set('CAIROMM_API_VERSION', cairomm_api_version)
pkg_conf_data.set('CAIROMM_MODULES', cairomm_requires)
pkg_conf_data.set('CAIROMM_EXTRA_LIBS', cairomm_extra_libs)
pkg_conf_data.set('MSVC_TOOLSET_VER', msvc14x_toolset_ver)

configure_file(
  input: cairomm_pcname + '.pc.in',
  output: '@BASENAME@',
  configuration: pkg_conf_data,
  install_dir: install_pkgconfigdir,
  install: true,
)

foreach cairomm_mod : ['ft', 'pdf', 'png', 'ps', 'quartz', 'quartz-font',
    'quartz-image', 'svg', 'win32', 'win32-font', 'xlib', 'xlib-xrender']

  # Install the module only if there is a corresponding cairo module.
  if cairo_dep.type_name() == 'pkgconfig'
    do_install = dependency('cairo-' + cairomm_mod, required: false).found()
  elif cairo_dep.type_name() == 'internal'
    do_install = dependency('cairo-' + cairomm_mod, fallback: 'cairo',
                            required: false).found()
  else
    if cairomm_mod == 'png'
      do_install = cpp_compiler.has_function('cairo_surface_write_to_png',
                                             prefix: '#include <cairo.h>',
                                             dependencies: cairo_dep)
    elif cairomm_mod == 'quartz-font'
      do_install = cpp_compiler.has_function('cairo_quartz_font_face_create_for_cgfont',
                                             prefix: '#include <cairo-quartz.h>',
                                             dependencies: cairo_dep)
    elif cairomm_mod == 'win32-font'
      do_install = cpp_compiler.has_function('cairo_win32_font_face_create_for_hfont',
                                             prefix: '#include <cairo-win32.h>',
                                             dependencies: cairo_dep)
    else
      do_install = cpp_compiler.has_header('cairo-@0@.h'.format(cairomm_mod))
    endif
  endif
  configure_file(
    input: 'cairomm-' + cairomm_mod + '-' + cairomm_api_version + '.pc.in',
    output: '@BASENAME@',
    configuration: pkg_conf_data,
    install_dir: install_pkgconfigdir,
    install: do_install,
  )
endforeach