summaryrefslogtreecommitdiff
path: root/subprojects/gfm/meson.build
blob: ab93f9cf8db0fbc2304c1ff0e998ee34ef57ad44 (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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
project('gfm', 'c',
  meson_version: '>= 0.38.0',
)

c_args = []
gnome = import('gnome')

if not meson.is_subproject()
 message('WARNING: This project is only intended to be used as a subproject!')
endif

api_version = '0.1'

gfm_sources = [
  'gtkfilterlistmodel.c',
  'gtkflattenlistmodel.c',
  'gtkslicelistmodel.c',
  'gtksortlistmodel.c',
  'gtkrbtree.c',
]

gfm_headers = [
  'gtkfilterlistmodel.h',
  'gtkflattenlistmodel.h',
  'gtkslicelistmodel.h',
  'gtksortlistmodel.h',
  'gtkrbtreeprivate.h',
  'gtkintl.h',
]

gfm_introspection_headers = [
  'gtkfilterlistmodel.h',
  'gtkflattenlistmodel.h',
  'gtkslicelistmodel.h',
  'gtksortlistmodel.h',
]

pkglibdir = get_option('pkglibdir')
pkgdatadir = get_option('pkgdatadir')
pkggirdir = join_paths(pkgdatadir, 'gir-1.0')
pkgtypelibdir = join_paths(pkglibdir, 'girepository-1.0')

gfm_header_subdir = '.'
gfm_header_dir = join_paths(get_option('includedir'), gfm_header_subdir)

cc = meson.get_compiler('c')

gfm_deps = [
  dependency('gio-2.0', version: '>= 2.50'),
  dependency('gtk+-3.0'),
]

gfm_lib = shared_library('gfm-' + api_version,
  gfm_sources,
  dependencies: gfm_deps,
  c_args: ['-DGETTEXT_PACKAGE', '-DGTK_COMPILATION '],
  install: true,
  install_dir: pkglibdir
)

gfm_gir = gnome.generate_gir(gfm_lib,
  sources: gfm_sources + gfm_introspection_headers,
  nsversion: api_version,
  namespace: 'Gfm',
  symbol_prefix: 'gtk',
  extra_args: ['-DGETTEXT_PACKAGE', '-DGTK_COMPILATION '],
  identifier_prefix: 'Gtk',
  link_with: gfm_lib,
  includes: ['Gio-2.0', 'Gtk-3.0'],
  install: true,
  install_dir_gir: pkggirdir,
  install_dir_typelib: pkgtypelibdir,
)

pkg = import('pkgconfig')

pkg.generate(
  description: 'A shared library backporting a few GTK4 listmodels to GTK3',
    libraries: gfm_lib,
         name: 'gfm',
     filebase: 'gfm-' + api_version,
      version: meson.project_version(),
     requires: 'glib-2.0',
  install_dir: join_paths(pkglibdir, 'pkgconfig')
)