blob: f0e2e41d4d92521585526d32494925f17074da3d [file] [log] [blame] [edit]
project(
'vbmc',
['c', 'cpp'],
version: '0.1',
meson_version: '>=1.1.1',
default_options: [
'cpp_std=c++23',
'c_std=c18',
],
)
vbmc_include = include_directories('.')
cppc = meson.get_compiler('cpp')
# Proto headers
run_command(
'mkdir', '-p',
join_paths(meson.project_build_root(), 'include/vbmc'),
check: true
)
expected_dir = meson.project_build_root() + '/include/vbmc/'
actual_dir = meson.project_build_root() + '/'
protoc = find_program('protoc')
protobuf_deps = dependency('protobuf')
grpc = dependency('grpc', required: false)
if not grpc.found()
grpc = cppc.find_library('grpc')
endif
grpc_cpp = find_program('grpc_cpp_plugin')
grpcpp = dependency('grpc++', required: false)
if not grpcpp.found()
grpcpp = cppc.find_library('grpc++')
endif
gpr = dependency('gpr', required: false)
if not gpr.found()
gpr = cppc.find_library('gpr')
endif
grpcpp_reflection = dependency('grpc++_reflection', required: false)
if not grpcpp_reflection.found()
grpcpp_reflection = cppc.find_library('grpc++_reflection')
endif
grpcpp_auth = dependency('libgrpc++_authorization_provider', required: false)
if not grpcpp_auth.found()
grpcpp_auth = cppc.find_library('libgrpc++_authorization_provider', dirs: '/usr/local/lib')
endif
vbmc_proto_deps = [
grpc,
grpcpp,
gpr,
protobuf_deps,
grpcpp_reflection,
]
protos_gen = []
foreach proto : ['proxy_config', 'events', 'vendor_events']
protos_gen += custom_target(
proto,
output: ['@BASENAME@.pb.cc', '@BASENAME@.pb.h'],
input: [proto + '.proto'],
command : [
protoc,
'@INPUT@',
'--proto_path=@CURRENT_SOURCE_DIR@',
'--cpp_out=@OUTDIR@/',
],
install : true,
install_dir : get_option('includedir') / 'vbmc',
)
# Generate symlink just for headers so that other sources or headers including them can find it
# under include/voyager/
run_command(
'ln', '-sf',
join_paths(expected_dir, proto + '.pb.h'),
join_paths(actual_dir, proto + '.pb.h'),
check: true
)
endforeach
# generate grpc services
grpc_gen = []
foreach proto : ['proxy_config', 'events', 'vendor_events']
grpc_gen += custom_target(
'grpc_' + proto,
output: ['@BASENAME@.grpc.pb.cc', '@BASENAME@.grpc.pb.h'],
input: [proto + '.proto'],
command: [
protoc,
'--proto_path=@CURRENT_SOURCE_DIR@',
'--grpc_out=' + meson.current_build_dir(),
'--plugin=protoc-gen-grpc=' + grpc_cpp.path(),
'@INPUT@'
],
install: true,
install_dir : get_option('includedir') / 'vbmc',
)
# Generate symlink just for headers so that other sources or headers including them can find it
# under include/voyager/
run_command(
'ln', '-sf',
join_paths(expected_dir, proto + '.grpc.pb.h'),
join_paths(actual_dir, proto + '.grpc.pb.h'),
check: true
)
endforeach
libvbmc_proto = library(
'vbmc_proto',
protos_gen,
grpc_gen,
implicit_include_directories: false,
dependencies: vbmc_proto_deps,
)
vbmc_proto = declare_dependency(
sources: [protos_gen, grpc_gen],
dependencies: vbmc_proto_deps,
link_with: [libvbmc_proto],
)
vbmc_srcs = []
vbmc_deps = []
# Add subdirectories
subdir('cper')
subdir('sse')
subdir('sse_plugin')
subdir('utils')
# Add external dependencies
voyager_dep = dependency('voyager', required:true)
redfish_query_engine_dep = dependency('redfish_query_engine', required: true)
srcs_main = [
'main.cc',
'tls_auth.cc',
'log_monitoring.cc',
'proxy.cc',
'redfish_session_auth.cc',
'proxy_builder.cc',
'proxy_redfishv1_impl.cc',
'proxy_voyager_impl.cc',
'redfish_resource.cc',
'remote_credentials.cc',
'ssh_actions_plugin.cc',
'resource_authz.cc',
]
deps_main = [
vbmc_proto,
dependency('absl_base'),
dependency('absl_statusor'),
dependency('absl_flags_parse'),
dependency('absl_log'),
grpcpp_auth,
voyager_dep,
redfish_query_engine_dep,
]
vbmc_srcs += srcs_main
vbmc_deps += deps_main
# Each plugin should have its own srcs and extra dependencies.
srcs_passthrough_plugin = [
'redfish_passthrough_plugin.cc',
'http_client_pool.cc',
]
deps_passthrough_plugin = []
vbmc_srcs += srcs_passthrough_plugin
vbmc_deps += deps_passthrough_plugin
executable(
'vbmc',
vbmc_srcs,
implicit_include_directories: false,
dependencies: vbmc_deps,
include_directories: vbmc_include,
install:true,
# TODO(b/374116351): Remove these once the warnings are fixed.
cpp_args: ['-Wno-unused-parameter', '-Wno-unused-value', '-Wno-missing-field-initializers', '-Wno-type-limits'],
)