blob: 89150afe3e0068661ee7b8a0bdbb03a778631fc6 [file] [log] [blame]
# Enable development workflow to skip some parts with hardware dependencies
if get_option('dev') or not get_option('tests').disabled()
add_project_arguments('-DDEV_WORKFLOW', language: 'cpp')
endif
stdplus_dep = dependency('stdplus')
flasher_dep = dependency('flasher', fallback: ['flasher', 'flasher_dep'])
json_dep = dependency('', required: false)
has_json = meson.get_compiler('cpp').has_header_symbol(
'nlohmann/json.hpp',
'nlohmann::json::string_t',
required: false)
if not has_json
json_dep = dependency(
'nlohmann_json',
fallback: ['nlohmann_json', 'nlohmann_json_dep'],
disabler: true,
required: false)
endif
# Needed to pull in libcr51sign
libcr51sign_dep = dependency('libcr51sign', required: false)
if not libcr51sign_dep.found()
subproject('google-misc')
libcr51sign_dep = subproject('libcr51sign').get_variable('libcr51sign_dep')
libcr51sign_cflags = subproject('libcr51sign').get_variable('libcr51sign_cflags')
endif
add_project_arguments('-Wno-pedantic', language : 'cpp')
libcr51_deps = [
libcr51sign_dep,
stdplus_dep,
]
libflashupdate_deps = [
flasher_dep,
json_dep,
stdplus_dep,
libcr51sign_dep,
]
conf_data = configuration_data()
conf_data.set_quoted('CR51_MAUV_PATH', get_option('cr51-mauv-path'))
conf_data.set('CR51_MAUV_OFFSET', get_option('cr51-mauv-offset'))
config_h = configure_file(
output: 'config.h',
configuration: conf_data
)
libflashupdate_lib = library(
'flashupdate',
'args.cpp',
'config.cpp',
'flash.cpp',
'info.cpp',
'version.cpp',
'ops.cpp',
'reader/copy.cpp',
'ops/copy_partition.cpp',
'ops/erase.cpp',
'ops/fetch_version.cpp',
'ops/info.cpp',
'ops/invalidate.cpp',
'ops/update_state.cpp',
'ops/update_version.cpp',
'ops/hash_descriptor.cpp',
'ops/read.cpp',
'ops/write.cpp',
'ops/verify_staging.cpp',
'validator/cr51.cpp',
'logging.cpp',
config_h,
version: meson.project_version(),
dependencies: libflashupdate_deps,
include_directories: [flashupdate_includes, flashupdate_internal_includes],
install: true)
flashupdate_reqs = []
foreach dep : libflashupdate_deps
if dep.type_name() == 'pkgconfig'
flashupdate_reqs += dep
endif
endforeach
import('pkgconfig').generate(
libflashupdate_lib,
description: 'Common flashupdate library',
version: meson.project_version(),
requires: flashupdate_reqs)
libflashupdate = declare_dependency(
dependencies: libflashupdate_deps,
include_directories: [flashupdate_includes, flashupdate_internal_includes],
link_with: libflashupdate_lib)
executable(
'flashupdate',
'flashupdate.cpp',
implicit_include_directories: false,
dependencies: libflashupdate,
include_directories: [flashupdate_includes, flashupdate_internal_includes],
install: true,
install_dir: get_option('bindir'))