summaryrefslogtreecommitdiff
path: root/src/libqmi-glib/meson.build
blob: b6de003cba02923c9cbaf8cdc783dc5c28b144e3 (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
# SPDX-License-Identifier: GPL-2.0-or-later
# Copyright (C) 2019 - 2021 Iñigo Martinez <inigomartinez@gmail.com>

libqmi_glib_inc = include_directories('.')

qmi_errors_header = files('qmi-errors.h')

qmi_enums_headers = files(
  'qmi-device.h',
  'qmi-enums.h',
  'qmi-enums-dms.h',
  'qmi-enums-dsd.h',
  'qmi-enums-gas.h',
  'qmi-enums-loc.h',
  'qmi-enums-nas.h',
  'qmi-enums-oma.h',
  'qmi-enums-pbm.h',
  'qmi-enums-pdc.h',
  'qmi-enums-pds.h',
  'qmi-enums-qos.h',
  'qmi-enums-sar.h',
  'qmi-enums-uim.h',
  'qmi-enums-voice.h',
  'qmi-enums-wda.h',
  'qmi-enums-wds.h',
  'qmi-enums-wms.h',
)

qmi_enums_private_header = files('qmi-enums-private.h')

qmi_flags64_headers = files(
  'qmi-flags64-dms.h',
  'qmi-flags64-dsd.h',
  'qmi-flags64-loc.h',
  'qmi-flags64-nas.h',
  'qmi-flags64-wds.h',
)

headers = qmi_errors_header + qmi_enums_headers + qmi_enums_private_header + qmi_flags64_headers + files(
  'libqmi-glib.h',
  'qmi-client.h',
  'qmi-message-context.h',
  'qmi-message.h',
  'qmi-proxy.h',
  'qmi-utils.h',
)

install_headers(
  headers + files('qmi-compat.h'),
  subdir: qmi_glib_include_subdir,
)

version_header = configure_file(
  input: 'qmi-version.h.in',
  output: '@BASENAME@',
  configuration: version_conf,
  install_dir: qmi_glib_pkgincludedir,
)

subdir('generated')

common_c_flags = [
  '-DLIBQMI_GLIB_COMPILATION',
  '-DG_LOG_DOMAIN="Qmi"',
]

libqmi_glib_compat = static_library(
  'qmi-glib-compat',
  sources: 'qmi-compat.c',
  include_directories: top_inc,
  dependencies: generated_dep,
  c_args: common_c_flags + no_deprecated_declarations_flags,
  link_whole: libqmi_glib_generated,
)

libname = 'qmi-glib'

sources = files(
  'qmi-client.c',
  'qmi-device.c',
  'qmi-endpoint.c',
  'qmi-endpoint-qmux.c',
  'qmi-enums-dms.c',
  'qmi-enums-nas.c',
  'qmi-enums-wds.c',
  'qmi-file.c',
  'qmi-helpers.c',
  'qmi-message.c',
  'qmi-message-context.c',
  'qmi-net-port-manager.c',
  'qmi-net-port-manager-qmiwwan.c',
  'qmi-proxy.c',
  'qmi-utils.c',
)

deps = [
  generated_dep,
  gio_unix_dep,
]

if enable_mbim_qmux
  sources += files('qmi-endpoint-mbim.c')
  deps += mbim_glib_dep
endif

if enable_qrtr
  sources += files('qmi-endpoint-qrtr.c')
endif

if enable_rmnet
  sources += files('qmi-net-port-manager-rmnet.c')
endif

libqmi_glib = library(
  libname,
  version: qmi_glib_version,
  sources: sources + [version_header],
  include_directories: top_inc,
  dependencies: deps,
  c_args: common_c_flags + ['-DLIBEXEC_PATH="@0@"'.format(join_paths(qmi_prefix, qmi_libexecdir))],
  link_whole: libqmi_glib_compat,
  install: true,
)

libqmi_glib_dep = declare_dependency(
  dependencies: generated_dep,
  link_with: libqmi_glib,
)

pkg.generate(
  libraries: libqmi_glib,
  version: qmi_version,
  name: libname,
  description: 'Library to communicate with QMI-powered modems',
  subdirs: qmi_glib_include_subdir,
  # FIXME: produced by the inhability of meson to use internal dependencies
  requires: ['glib-2.0', 'gobject-2.0', 'gio-2.0'],
  variables: [
    'exec_prefix=${prefix}',
    'qmi_qrtr_supported=' + enable_qrtr.to_int().to_string(),
    'qmi_mbim_qmux_supported=' + enable_mbim_qmux.to_int().to_string(),
  ],
)

if enable_gir and get_option('default_library') != 'static'
  incs = [
    'Gio-2.0',
    'GLib-2.0',
    'GObject-2.0',
  ]

  if enable_qrtr
    incs += ['Qrtr-1.0']
  endif

  ns = 'Qmi'

  libqmi_glib_gir = gnome.generate_gir(
    libqmi_glib,
    sources: sources + headers + gen_sources + gen_headers,
    includes: incs,
    namespace: ns,
    nsversion: qmi_gir_version,
    identifier_prefix: ns,
    symbol_prefix: ns.to_lower() + '_',
    extra_args: common_c_flags + ['--identifier-prefix=' + ns.to_upper()],
    header: 'libqmi-glib.h',
    export_packages: 'libqmi-glib',
    install: true,
  )
endif

subdir('test')