# Copyright (c) 2021 Huawei Device Co., Ltd. # 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. import("//build/ohos.gni") import("//foundation/ace/ace_engine/ace_config.gni") import("//foundation/ace/ace_engine/build/ace_gen_obj.gni") import("$v8_root/gni/snapshot_toolchain.gni") # Build v8 snapshot obj base_output_path = get_label_info(":gen_v8_startup_snapshot_bin", "target_out_dir") v8_startup_snapshot_bin_path = base_output_path + "/v8_startup_snapshot.bin" v8_startup_snapshot_obj_path = base_output_path + "/v8_startup_snapshot.o" action("gen_v8_startup_snapshot_bin") { visibility = [ ":*" ] # Only targets in this file can depend on this. deps = [ "$v8_root:mksnapshot($v8_snapshot_toolchain)" ] script = "$v8_root/tools/run.sh" args = [ rebase_path("${aosp_libs_dir}/ndk/libcxx/linux_x86") + ":" + rebase_path("${aosp_libs_dir}/ndk/libcxx/linux_x86_64"), rebase_path( get_label_info("$v8_root:mksnapshot($v8_snapshot_toolchain)", "root_out_dir") + "/ace/ace_engine_full/mksnapshot"), "--startup_blob=" + rebase_path(v8_startup_snapshot_bin_path), "--turbo_instruction_scheduling", ] outputs = [ v8_startup_snapshot_bin_path ] } gen_obj("v8_startup_snapshot") { input = v8_startup_snapshot_bin_path output = v8_startup_snapshot_obj_path snapshot_dep = [ ":gen_v8_startup_snapshot_bin" ] } # Build v8 helper ohos_shared_library("ace_v8_helper") { configs = [ "$ace_root:ace_config", "$v8_root:v8_header_features", ] include_dirs = [ "//third_party/v8/include" ] sources = [ "v8_helper.cpp" ] deps = [ ":gen_obj_src_v8_startup_snapshot" ] if (use_shared_v8) { deps += [ "$v8_root:v8_shared" ] } else { deps += [ "$v8_root:ace_libicu", "$v8_root:v8", "$v8_root:v8_libbase", "$v8_root:v8_libplatform", ] } part_name = ace_engine_part subsystem_name = "ace" } ohos_source_set("ace_v8_helper_static") { configs = [ "$ace_root:ace_config", "$v8_root:v8_header_features", ] include_dirs = [ "//third_party/v8/include" ] sources = [ "v8_helper.cpp" ] deps = [ ":gen_obj_src_v8_startup_snapshot" ] if (use_shared_v8) { deps += [ "$v8_root:v8_shared" ] } else { deps += [ "$v8_root:ace_libicu", "$v8_root:v8", "$v8_root:v8_libbase", "$v8_root:v8_libplatform", ] } }