| # Copyright 2021 The Cobalt Authors. All Rights Reserved. |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); |
| # you may not use this file except in compliance with the License. |
| # You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| |
| config("enable_fake_microphone_public") { |
| defines = [ "ENABLE_FAKE_MICROPHONE" ] |
| } |
| |
| config("speech_config") { |
| if (is_win) { |
| cflags = [ |
| # Dereferencing NULL pointer in generated file |
| # google_streaming_api.pb.cc. |
| "/wd6011", |
| ] |
| } |
| |
| include_dirs = [ "//third_party/protobuf/src" ] |
| } |
| |
| copy("speech_testdata") { |
| sources = [ |
| "//cobalt/speech/testdata/audio1.raw", |
| "//cobalt/speech/testdata/audio2.raw", |
| "//cobalt/speech/testdata/audio3.raw", |
| "//cobalt/speech/testdata/quit.raw", |
| ] |
| |
| outputs = [ "$root_build_dir/content/test/{{source_root_relative_dir}}/{{source_file_part}}" ] |
| } |
| |
| static_library("speech") { |
| has_pedantic_warnings = true |
| |
| # Creates cycle with //cobalt/dom |
| check_includes = false |
| |
| sources = [ |
| "audio_encoder_flac.cc", |
| "audio_encoder_flac.h", |
| "cobalt_speech_recognizer.cc", |
| "cobalt_speech_recognizer.h", |
| "endpointer_delegate.cc", |
| "endpointer_delegate.h", |
| "google_speech_service.cc", |
| "google_speech_service.h", |
| "google_streaming_api.pb.cc", |
| "google_streaming_api.pb.h", |
| "microphone.h", |
| "microphone_manager.cc", |
| "microphone_manager.h", |
| "speech_configuration.h", |
| "speech_recognition.cc", |
| "speech_recognition.h", |
| "speech_recognition_alternative.h", |
| "speech_recognition_config.h", |
| "speech_recognition_error.cc", |
| "speech_recognition_error.h", |
| "speech_recognition_event.cc", |
| "speech_recognition_event.h", |
| "speech_recognition_manager.cc", |
| "speech_recognition_manager.h", |
| "speech_recognition_result.cc", |
| "speech_recognition_result.h", |
| "speech_recognition_result_list.cc", |
| "speech_recognition_result_list.h", |
| "speech_recognizer.cc", |
| "speech_recognizer.h", |
| "speech_synthesis.cc", |
| "speech_synthesis.h", |
| "speech_synthesis_error_event.h", |
| "speech_synthesis_event.cc", |
| "speech_synthesis_event.h", |
| "speech_synthesis_utterance.cc", |
| "speech_synthesis_utterance.h", |
| "speech_synthesis_voice.h", |
| "starboard_speech_recognizer.cc", |
| "starboard_speech_recognizer.h", |
| ] |
| |
| configs += [ ":speech_config" ] |
| |
| public_deps = [ |
| # Additionally, ensure that the include directories for generated |
| # headers are put on the include directories for targets that depend |
| # on this one. |
| "//cobalt/browser:generated_types", |
| ] |
| |
| deps = [ |
| "//cobalt/base", |
| "//cobalt/dom:dom_exception", |
| "//cobalt/loader", |
| "//cobalt/media", |
| "//cobalt/network", |
| "//cobalt/script", |
| "//content/browser/speech", |
| "//starboard", |
| "//third_party/flac", |
| "//third_party/protobuf:protobuf_lite", |
| "//url", |
| ] |
| |
| if (is_starboard) { |
| sources += [ |
| "microphone_starboard.cc", |
| "microphone_starboard.h", |
| ] |
| } |
| |
| if (is_starboard && !is_gold) { |
| sources += [ |
| "microphone_fake.cc", |
| "microphone_fake.h", |
| "url_fetcher_fake.cc", |
| "url_fetcher_fake.h", |
| ] |
| |
| public_configs = [ ":enable_fake_microphone_public" ] |
| deps += [ "//cobalt/audio" ] |
| } |
| |
| if (!is_gold) { |
| deps += [ ":speech_testdata" ] |
| } |
| } |