summaryrefslogtreecommitdiffstats
path: root/subprojects/libgd/libgd/meson.build
blob: 6ba7871f6459912d947fa25720d551e0d5c4d3cc (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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
gnome = import('gnome')

sources = [
  'gd.h',
  'gd-types-catalog.c'
]
built_sources = []
c_args = []
private_c_args = [
  '-DG_LOG_DOMAIN="libgd"',
  '-DG_DISABLE_DEPRECATED',
]

if (get_option('with-gtk-hacks') or
    get_option('with-main-box') or
    get_option('with-main-icon-box') or
    get_option('with-main-view'))
  sources += [
    'gd-icon-utils.c',
    'gd-icon-utils.h',
  ]
  c_args += '-DLIBGD_GTK_HACKS=1'
endif

if (get_option('with-main-box') or
    get_option('with-main-icon-box'))
  sources += [
    'gd-main-box-child.c',
    'gd-main-box-child.h',
    'gd-main-box-generic.c',
    'gd-main-box-generic.h',
    'gd-main-box-item.c',
    'gd-main-box-item.h'
  ]
  c_args += '-DLIBGD__BOX_COMMON=1'

  if (get_option('with-main-box') or
      get_option('with-main-icon-box'))
    sources += [
      'gd-main-icon-box.c',
      'gd-main-icon-box.h',
      'gd-main-icon-box-child.c',
      'gd-main-icon-box-child.h',
      'gd-main-icon-box-icon.c',
      'gd-main-icon-box-icon.h',
      'gd-icon-utils.c',
      'gd-icon-utils.h',
    ]
    c_args += '-DLIBGD_MAIN_ICON_BOX=1'
  endif

  if get_option('with-main-box')
    sources += [
      'gd-main-box.c',
      'gd-main-box.h',
    ]
    c_args += '-DLIBGD_MAIN_BOX=1'
  endif
endif

if (get_option('with-main-icon-view') or
    get_option('with-main-list-view') or
    get_option('with-main-view'))
  sources += [
    'gd-main-view-generic.c',
    'gd-main-view-generic.h',
    'gd-styled-text-renderer.c',
    'gd-styled-text-renderer.h',
    'gd-two-lines-renderer.c',
    'gd-two-lines-renderer.h',
  ]
  c_args += '-DLIBGD__VIEW_COMMON=1'

  if (get_option('with-main-icon-view') or
      get_option('with-main-view'))
    sources += [
      'gd-main-icon-view.c',
      'gd-main-icon-view.h',
      'gd-toggle-pixbuf-renderer.c',
      'gd-toggle-pixbuf-renderer.h'
    ]
    c_args += '-DLIBGD_MAIN_ICON_VIEW=1'
  endif

  if (get_option('with-main-list-view') or
      get_option('with-main-view'))
    sources += [
      'gd-main-list-view.c',
      'gd-main-list-view.h',
    ]
    c_args += '-DLIBGD_MAIN_LIST_VIEW=1'
  endif

  if get_option('with-main-view')
    sources += [
      'gd-main-view.c',
      'gd-main-view.h',
    ]
    c_args += '-DLIBGD_MAIN_VIEW=1'
  endif
endif

if get_option('with-margin-container')
  sources += [
    'gd-margin-container.c',
    'gd-margin-container.h',
  ]
  c_args += '-DLIBGD_MARGIN_CONTAINER=1'
endif

if get_option('with-tagged-entry')
  sources += [
    'gd-tagged-entry.c',
    'gd-tagged-entry.h',
  ]
  c_args += '-DLIBGD_TAGGED_ENTRY=1'
endif

if get_option('with-notification')
  sources += [
    'gd-notification.c',
    'gd-notification.h',
  ]
  c_args += '-DLIBGD_NOTIFICATION=1'
endif

if sources.length() == 2
  error('You must include a feature to be built!')
endif

# --------- Building -----------

static = get_option('static')
install_introspection = get_option('with-introspection')
with_vapi = get_option('with-vapi')

if static
  libgd_lib = static_library('gd', sources,
    dependencies: [libgtk, libm],
    include_directories: libgd_include,
    c_args: c_args + private_c_args
  )
endif

# Currently in Meson building gir requires a shared library
if not static or (install_introspection or with_vapi)
  if not static and pkglibdir == ''
    error('Installing shared library but pkglibdir is unset!')
  endif

  libgd_shared_lib = shared_library('gd', sources,
    dependencies: [libgtk, libm],
    include_directories: libgd_include,
    c_args: c_args + private_c_args,
    install: not static,
    install_dir: pkglibdir
  )

  if not static
    libgd_lib = libgd_shared_lib
  endif
endif

if install_introspection or with_vapi
  if install_introspection
    if pkgdatadir == ''
      error('Installing introspection but pkgdatadir is unset!')
    elif pkglibdir == ''
      error('Installing introspection but pkglibdir is unset!')
    endif
  endif

  libgd_gir = gnome.generate_gir(libgd_shared_lib,
    sources : sources,
    nsversion : '1.0',
    namespace : 'Gd',
    symbol_prefix : 'gd',
    identifier_prefix : 'Gd',
    includes : 'Gtk-3.0',
    include_directories: libgd_include,
    install: install_introspection,
    install_dir_gir: join_paths(pkgdatadir, 'gir-1.0'),
    install_dir_typelib: join_paths(pkglibdir, 'girepository-1.0'),
    extra_args: [
      '--c-include=libgd/gd.h',
    ]
  )
  built_sources += libgd_gir

  if get_option('with-vapi')
    libgd_vapi_dep = gnome.generate_vapi('gd-1.0',
      sources: libgd_gir[0],
      packages: ['gtk+-3.0']
    )
  endif
endif

libgd_dep = declare_dependency(
  link_with: libgd_lib,
  include_directories: libgd_include,
  dependencies: libgtk,
  compile_args: c_args,
  sources: built_sources
)