| # 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("embed_v8c_resources_as_header_files_public_config") { |
| include_dirs = [ target_gen_dir ] |
| } |
| |
| action("embed_v8c_resources_as_header_files_action") { |
| script = "//cobalt/build/generate_data_header.py" |
| sources = [ |
| "//cobalt/fetch/embedded_scripts/fetch.js", |
| "//cobalt/streams/embedded_scripts/byte_length_queuing_strategy.js", |
| "//cobalt/streams/embedded_scripts/count_queuing_strategy.js", |
| "//cobalt/streams/embedded_scripts/readable_stream.js", |
| ] |
| outputs = [ "$target_gen_dir/cobalt/script/v8c/embedded_resources.h" ] |
| |
| args = [ "V8cEmbeddedResources" ] + rebase_path(outputs, root_build_dir) + |
| rebase_path(sources, root_build_dir) |
| } |
| |
| group("embed_v8c_resources_as_header_files") { |
| public_configs = [ ":embed_v8c_resources_as_header_files_public_config" ] |
| deps = [ ":embed_v8c_resources_as_header_files_action" ] |
| } |
| |
| config("common_public_config") { |
| defines = [] |
| if ((current_cpu == "arm64" || current_cpu == "x64") && |
| v8_enable_pointer_compression_override) { |
| defines += [ |
| # enables pointer compression on 64 bit platforms for Cobalt. |
| "V8_COMPRESS_POINTERS", |
| "V8_31BIT_SMIS_ON_64BIT_ARCH", |
| ] |
| } |
| |
| if (v8_enable_webassembly) { |
| defines += [ "V8_ENABLE_WEBASSEMBLY" ] |
| } |
| } |
| |
| config("engine_all_dependent_config") { |
| defines = [ |
| "ENGINE_SUPPORTS_INDEXED_DELETERS", |
| "ENGINE_SUPPORTS_INT64", |
| ] |
| } |
| |
| static_library("engine") { |
| check_includes = false |
| |
| sources = [ |
| "algorithm_helpers.cc", |
| "algorithm_helpers.h", |
| "callback_function_conversion.h", |
| "cobalt_platform.cc", |
| "cobalt_platform.h", |
| "common_v8c_bindings_code.cc", |
| "common_v8c_bindings_code.h", |
| "conversion_helpers.cc", |
| "conversion_helpers.h", |
| "entry_scope.h", |
| "interface_data.h", |
| "isolate_fellowship.cc", |
| "isolate_fellowship.h", |
| "native_promise.h", |
| "scoped_persistent.h", |
| "switches.cc", |
| "switches.h", |
| "type_traits.h", |
| "union_type_conversion_forward.h", |
| "union_type_conversion_impl.h", |
| "v8c_array_buffer.cc", |
| "v8c_array_buffer.h", |
| "v8c_array_buffer_view.cc", |
| "v8c_array_buffer_view.h", |
| "v8c_callback_function.h", |
| "v8c_callback_interface.cc", |
| "v8c_callback_interface.h", |
| "v8c_callback_interface_holder.h", |
| "v8c_data_view.cc", |
| "v8c_data_view.h", |
| "v8c_engine.cc", |
| "v8c_engine.h", |
| "v8c_exception_state.cc", |
| "v8c_exception_state.h", |
| "v8c_global_environment.cc", |
| "v8c_global_environment.h", |
| "v8c_heap_tracer.cc", |
| "v8c_heap_tracer.h", |
| "v8c_property_enumerator.h", |
| "v8c_script_debugger.cc", |
| "v8c_script_debugger.h", |
| "v8c_script_value_factory.cc", |
| "v8c_script_value_factory.h", |
| "v8c_source_code.cc", |
| "v8c_source_code.h", |
| "v8c_tracing_controller.cc", |
| "v8c_tracing_controller.h", |
| "v8c_typed_arrays.cc", |
| "v8c_typed_arrays.h", |
| "v8c_user_object_holder.h", |
| "v8c_value_handle.cc", |
| "v8c_value_handle.h", |
| "v8c_wrapper_handle.h", |
| "wrapper_factory.cc", |
| "wrapper_factory.h", |
| "wrapper_private.cc", |
| "wrapper_private.h", |
| ] |
| |
| public_configs = [ |
| ":common_public_config", |
| ":engine_all_dependent_config", |
| ] |
| |
| deps = [ |
| ":embed_v8c_resources_as_header_files", |
| "//cobalt/cache", |
| "//cobalt/configuration", |
| "//cobalt/script", |
| "//third_party/v8", |
| "//third_party/v8:v8_libplatform", |
| "//third_party/v8/third_party/inspector_protocol:crdtp", |
| ] |
| } |
| |
| target(final_executable_type, "v8c") { |
| sources = [ "v8c.cc" ] |
| |
| public_configs = [ ":common_public_config" ] |
| |
| deps = [ |
| ":engine", |
| "//cobalt/base", |
| "//cobalt/script:script", |
| "//cobalt/script:standalone_javascript_runner", |
| "//third_party/v8", |
| "//third_party/v8:v8_libplatform", |
| ] |
| } |