| cpp_compiler = meson.get_compiler('cpp') |
| |
| protobuf_deps = dependency('protobuf', required : false) |
| if not protobuf_deps.found() |
| protobuf_proj = subproject('protobuf') |
| protobuf_deps = declare_dependency( |
| dependencies : [ |
| abseil_proj.get_variable('protobuf_dep'), |
| ], |
| ) |
| endif |
| |
| gpr_deps = dependency('gpr', required: false) |
| if not gpr_deps.found() |
| gpr_deps = cpp_compiler.find_library('gpr') |
| endif |
| |
| grpc_deps = dependency('grpc', required: false) |
| if not grpc_deps.found() |
| grpc_deps = cpp_compiler.find_library('grpc') |
| endif |
| |
| grpcpp_deps = dependency('grpc++', required: false) |
| if not grpcpp_deps.found() |
| grpcpp_deps = cpp_compiler.find_library('grpc++') |
| endif |
| |
| grpcpp_reflection = dependency('grpc++_reflection', required: false) |
| if not grpcpp_reflection.found() |
| grpcpp_reflection = cpp_compiler.find_library('grpc++_reflection', required: false) |
| if not grpcpp_reflection.found() |
| grpcpp_reflection = cpp_compiler.find_library('grpc++_reflection', dirs: '/usr/local/lib') |
| endif |
| endif |
| |
| protoc = find_program('protoc') |
| grpc_cpp_plugin = find_program('grpc_cpp_plugin') |
| |
| redfish_v1_protos = ['redfish_v1.proto'] |
| authz_protos = ['oauth.proto', 'authorized_entity.proto'] |
| |
| all_protos = redfish_v1_protos + authz_protos |
| |
| proto_gen = {} |
| proto_headers = {} |
| foreach proto : all_protos |
| tmp_target = custom_target( |
| proto, |
| output: ['@BASENAME@.pb.cc', '@BASENAME@.pb.h'], |
| input: [proto], |
| command : [ |
| protoc, |
| '@INPUT@', |
| '--proto_path=@CURRENT_SOURCE_DIR@', |
| '--cpp_out=@OUTDIR@', |
| ], |
| install : true, |
| install_dir : [false, get_option('includedir')], |
| ) |
| proto_gen += {proto: tmp_target} |
| proto_headers += {proto: tmp_target[1]} |
| endforeach |
| |
| redfish_v1_proto_gen = [] |
| foreach proto : redfish_v1_protos |
| redfish_v1_proto_gen += proto_gen[proto] |
| endforeach |
| |
| authz_proto_gen = [] |
| foreach proto : authz_protos |
| authz_proto_gen += proto_gen[proto] |
| endforeach |
| |
| grpc_redfish_gen = custom_target( |
| 'grpc_redfish_grpc_pb_[ch]', |
| output: ['@BASENAME@.grpc.pb.cc', '@BASENAME@.grpc.pb.h'], |
| input: ['redfish_v1.proto'], |
| command : [ |
| protoc, |
| '@INPUT@', |
| '--proto_path=@CURRENT_SOURCE_DIR@', |
| '--grpc_out=@OUTDIR@', |
| '--plugin=protoc-gen-grpc=' + grpc_cpp_plugin.full_path(), |
| ], |
| install : true, |
| install_dir : [false, get_option('includedir')], |
| ) |
| |
| oauth_gen = custom_target( |
| 'oauth_grpc_pb_[ch]', |
| output: ['@BASENAME@.grpc.pb.cc', '@BASENAME@.grpc.pb.h'], |
| input: ['oauth.proto'], |
| command : [ |
| protoc, |
| '@INPUT@', |
| '--proto_path=@CURRENT_SOURCE_DIR@', |
| '--grpc_out=@OUTDIR@', |
| '--plugin=protoc-gen-grpc=' + grpc_cpp_plugin.full_path(), |
| ], |
| install : true, |
| install_dir : [false, get_option('includedir')], |
| ) |
| |
| gmi_protos_dep = dependency('gmi_protos') |
| one_dep = dependency('one') |
| |
| if cpp_compiler.has_header('nlohmann/json.hpp') |
| nlohmann_json = declare_dependency() |
| else |
| nlohmann_json_proj = subproject('nlohmann', required: true) |
| nlohmann_json = nlohmann_json_proj.get_variable('nlohmann_json_dep') |
| endif |
| |
| libsystemd_pkg = dependency('libsystemd') |
| zatar_dep = dependency('zatar') |
| |
| grpc_redfish_deps = [ |
| abseil_deps, |
| gpr_deps, |
| grpc_deps, |
| grpcpp_deps, |
| protobuf_deps, |
| grpcpp_reflection, |
| gmi_protos_dep, |
| libsystemd_pkg, |
| nlohmann_json, |
| one_dep, |
| openssl, |
| zatar_dep, |
| ] |
| |
| grpc_redfish_include = include_directories('.') |
| |
| grpc_redfish_lib = static_library( |
| 'grpc_redfish', |
| 'bmcweb_authorizer_singleton.cc', |
| 'subscription_tracker.cc', |
| 'config_generator.cc', |
| 'config_parser.cc', |
| 'json_utils.cc', |
| 'oauth_utils.cc', |
| 'redfish_authorizer.cc', |
| 'redfish_privileges.cc', |
| 'redfish_entity_trie.cc', |
| 'redfish_entity_trie_node.cc', |
| 'redfish_subtree_privileges_trie_node.cc', |
| 'override.cc', |
| 'subordinate_override.cc', |
| 'resource_uri_override.cc', |
| 'authorizer_enums.cc', |
| authz_proto_gen, |
| redfish_v1_proto_gen, |
| grpc_redfish_gen, |
| dependencies: grpc_redfish_deps, |
| include_directories: [grpc_redfish_include], |
| cpp_args: ['-Wno-error'], |
| ) |
| |
| grpc_redfish_dep = declare_dependency( |
| link_with: [grpc_redfish_lib], |
| include_directories: [grpc_redfish_include], |
| dependencies: grpc_redfish_deps, |
| ) |
| |
| bmcweb_dependencies += grpc_redfish_dep |
| |
| executable( |
| 'config_generator', |
| 'config_generator_main.cc', |
| dependencies: [grpc_redfish_dep], |
| install: true, |
| ) |
| |
| executable( |
| 'authz_server', |
| 'authz_server_main.cc', |
| 'authz_server.cc', |
| authz_proto_gen, |
| oauth_gen, |
| dependencies: [grpc_redfish_dep], |
| install: true, |
| ) |
| |
| systemd_dep = dependency('systemd') |
| systemd_system_unitdir = systemd_dep.get_variable( |
| pkgconfig: 'systemdsystemunitdir') |
| conf_data = configuration_data() |
| conf_data.set('extra_service_flags', get_option('extra-service-flags')) |
| configure_file( |
| input: 'authz_server.service.in', |
| output: 'authz_server.service', |
| configuration: conf_data, |
| install: true, |
| install_dir: systemd_system_unitdir, |
| ) |