| # SPDX-License-Identifier: GPL-2.0-or-later |
| # Copyright (C) 2021 IƱigo Martinez <inigomartinez@gmail.com> |
| |
| generated_inc = include_directories('.') |
| |
| gen_sources = [] |
| gen_headers = [] |
| gen_sections = [] |
| gen_sections_deps = [] |
| |
| # Error types |
| enum_types = 'mbim-error-types' |
| |
| gen_headers += custom_target( |
| enum_types + '.h', |
| input: mbim_errors_header, |
| output: enum_types + '.h', |
| command: [ |
| python, |
| mbim_mkenums, |
| '--fhead', '#ifndef __LIBMBIM_GLIB_ERROR_TYPES_H__\n#define __LIBMBIM_GLIB_ERROR_TYPES_H__\n#include "mbim-errors.h"\n', |
| '--template', files(templates_dir / enum_types + '.h.template'), |
| '--ftail', '#endif /* __LIBMBIM_GLIB_ERROR_TYPES_H__ */\n', |
| '@INPUT@'], |
| capture: true, |
| install: true, |
| install_dir: mbim_glib_pkgincludedir, |
| ) |
| |
| gen_sources += custom_target( |
| enum_types + '.c', |
| input: mbim_errors_header, |
| output: enum_types + '.c', |
| command: [ |
| python, |
| mbim_mkenums, |
| '--fhead', '#include "mbim-errors.h"\n#include "mbim-error-types.h"\n', |
| '--template', files(templates_dir / enum_types + '.c.template'), |
| '@INPUT@'], |
| capture: true, |
| ) |
| |
| enum_types = 'mbim-error-quarks' |
| |
| gen_sources += custom_target( |
| enum_types + '.c', |
| input: mbim_errors_header, |
| output: enum_types + '.c', |
| command: [ |
| python, |
| mbim_mkenums, |
| '--fhead', '#include "mbim-errors.h"\n#include "mbim-error-types.h"\n', |
| '--template', files(templates_dir / enum_types + '.c.template'), |
| '@INPUT@'], |
| capture: true, |
| ) |
| |
| # Enum/Flag types |
| enum_types = 'mbim-enum-types' |
| |
| gen_headers += custom_target( |
| enum_types + '.h', |
| input: mbim_enums_headers, |
| output: enum_types + '.h', |
| command: [ |
| python, |
| mbim_mkenums, |
| '--fhead', '#ifndef __LIBMBIM_GLIB_ENUM_TYPES_H__\n#define __LIBMBIM_GLIB_ENUM_TYPES_H__\n#include "mbim-uuid.h"\n#include "mbim-cid.h"\n#include "mbim-message.h"\n#include "mbim-enums.h"\n#include "mbim-tlv.h"\n', |
| '--template', files(templates_dir / enum_types + '.h.template'), |
| '--ftail', '#endif /* __LIBMBIM_GLIB_ENUM_TYPES_H__ */\n', |
| '@INPUT@'], |
| capture: true, |
| install: true, |
| install_dir: mbim_glib_pkgincludedir, |
| ) |
| |
| gen_sources += custom_target( |
| enum_types + '.c', |
| input: mbim_enums_headers, |
| output: enum_types + '.c', |
| command: [ |
| python, |
| mbim_mkenums, |
| '--fhead', '#include "mbim-enum-types.h"\n', |
| '--template', files(templates_dir / enum_types + '.c.template'), |
| '@INPUT@'], |
| capture: true, |
| ) |
| |
| services_data = [ |
| [['atds'], true], |
| [['auth'], true], |
| [['basic-connect', 'ms-basic-connect-v2', 'ms-basic-connect-v3'], true], |
| [['dss'], true], |
| [['intel-firmware-update'], true], |
| [['ms-basic-connect-extensions', 'ms-basic-connect-extensions-v2', 'ms-basic-connect-extensions-v3'], true], |
| [['ms-uicc-low-level-access'], true], |
| [['ms-firmware-id'], true], |
| [['ms-host-shutdown'], true], |
| [['ms-sar'], true], |
| [['phonebook'], true], |
| [['proxy-control'], false], |
| [['qdu'], true], |
| [['qmi'], true], |
| [['sms'], true], |
| [['stk'], true], |
| [['ussd'], true], |
| ] |
| |
| foreach service_data: services_data |
| service = service_data[0][0] |
| name = 'mbim-' + service |
| |
| input = [] |
| foreach service_file: service_data[0] |
| input += data_dir / 'mbim-service-@0@.json'.format(service_file) |
| endforeach |
| |
| generated = custom_target( |
| name, |
| input: input, |
| output: [name + '.c', name + '.h', name + '.sections'], |
| command: [mbim_codegen, '--output', '@OUTDIR@' / name, '@INPUT@'], |
| install: true, |
| install_dir: [false, mbim_glib_pkgincludedir, false], |
| ) |
| |
| gen_sources += generated[0] |
| gen_headers += generated[1] |
| |
| if service_data[1] |
| # FIXME: the third target generated by custom target can't by used because is not a known |
| # source file, to the path has to be used. the first workaround is to use the |
| # build paths to point to the files, and the second workaround is to use |
| # custom target objects to force its building. |
| gen_sections += [meson.current_build_dir() / name + '.sections'] |
| gen_sections_deps += [generated] |
| endif |
| endforeach |
| |
| c_flags = [ |
| '-DLIBMBIM_GLIB_COMPILATION', |
| '-DG_LOG_DOMAIN="Mbim"', |
| '-Wno-unused-function', |
| ] |
| |
| libmbim_glib_generated = static_library( |
| 'mbim-glib-generated', |
| sources: gen_sources + gen_headers, |
| include_directories: libmbim_glib_inc, |
| dependencies: glib_deps, |
| c_args: c_flags, |
| ) |
| |
| generated_dep = declare_dependency( |
| sources: gen_headers, |
| include_directories: [libmbim_glib_inc, generated_inc], |
| dependencies: glib_deps, |
| ) |