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

libutils = static_library(
  'utils',
  sources: 'qfu-utils.c',
  include_directories: top_inc,
  dependencies: libqmi_glib_dep,
)

libutils_dep = declare_dependency(
  include_directories: '.',
  dependencies: libqmi_glib_dep,
  link_with: libutils,
)

libfirehose = static_library(
  'firehose',
  sources: 'qfu-firehose-message.c',
  dependencies: glib_deps,
)

libfirehose_dep = declare_dependency(
  include_directories: '.',
  dependencies: glib_deps,
  link_with: libfirehose,
)

enum_headers = files(
  'qfu-dload-message.h',
  'qfu-image.h',
  'qfu-qdl-message.h',
  'qfu-sahara-message.h',
)

sources = files(
  'qfu-at-device.c',
  'qfu-device-selection.c',
  'qfu-dload-message.c',
  'qfu-helpers.c',
  'qfu-image.c',
  'qfu-image-cwe.c',
  'qfu-image-factory.c',
  'qfu-log.c',
  'qfu-main.c',
  'qfu-operation-reset.c',
  'qfu-operation-update.c',
  'qfu-operation-verify.c',
  'qfu-qdl-device.c',
  'qfu-qdl-message.c',
  'qfu-reseter.c',
  'qfu-sahara-device.c',
  'qfu-sahara-message.c',
  'qfu-updater.c',
)

if enable_udev
  sources += files('qfu-helpers-udev.c')
else
  sources += files('qfu-helpers-sysfs.c')
endif

enum_types = 'qfu-enum-types'

sources += custom_target(
  enum_types + '.h',
  input: enum_headers,
  output: enum_types + '.h',
  command: [
    python,
    qmi_mkenums,
    '--enums-only',
    '--fhead', '#ifndef QFU_ENUM_TYPES_H\n#define QFU_ENUM_TYPES_H\n#include "qfu-image.h"\n#include "qfu-qdl-message.h"\n#include "qfu-dload-message.h"\n#include "qfu-sahara-message.h"\n',
    '--template', files(templates_dir / enum_types + '.h.template'),
    '--ftail', '#endif /* __QFUENUM_TYPES_H__ */\n',
    '@INPUT@'],
  capture: true,
)

sources += custom_target(
  enum_types + '.c',
  input: enum_headers,
  output: enum_types + '.c',
  command: [
    python,
    qmi_mkenums,
    '--enums-only',
    '--fhead', '#include "qfu-enum-types.h"\n',
    '--template', files(templates_dir / enum_types + '.c.template'),
    '@INPUT@'],
  capture: true,
)

deps = [
  libfirehose_dep,
  libutils_dep,
]

if enable_mbim_qmux
  deps += mbim_glib_dep
endif

if enable_udev
  deps += gudev_dep
endif

qmi_firmware_update = executable(
  'qmi-firmware-update',
  sources: sources,
  include_directories: top_inc,
  dependencies: deps,
  install: true,
)

subdir('test')