# Copyright (c) 2021-2023 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/arkui/ace_engine/ace_config.gni") import("//foundation/arkui/ace_engine/build/ace_lib.gni") import("//foundation/arkui/ace_engine/interfaces/napi/kits/napi_lib.gni") if (is_ohos_standard_system) { system_resource_hap_path = get_label_info("//base/global/system_resources/systemres:systemres_hap", "target_out_dir") + "/SystemResources.hap" system_resource_path = get_label_info("//base/global/system_resources/systemres:systemres_hap", "target_out_dir") + "/resources" } else { system_resource_hap_path = get_label_info("//base/global/system_resources/systemres:systemres_hap", "target_gen_dir") + "/SystemResources.hap" system_resource_path = get_label_info("//base/global/system_resources/systemres:systemres_hap", "target_gen_dir") + "/resources" } action("get_system_resource") { script = "get_system_resources.sh" deps = [ "//base/global/system_resources/systemres:systemres_hap($current_toolchain)" ] args = [ rebase_path(system_resource_hap_path), rebase_path(system_resource_path), ] inputs = [ system_resource_hap_path ] outputs = [ system_resource_path ] } # Triggered only when the SDK is compiled if (is_ohos_standard_system) { import("sharedlib_config.gni") foreach(module, napi_modules) { ohos_copy("copy_napi_${module.prefix}libs") { deps = [] sources = [] foreach(shard_lib, module.shard_libs) { subsystem_name = shard_lib.subsystem_name part_name = shard_lib.part_name deps += [ shard_lib.label ] out_path = get_label_info(shard_lib.label, "root_out_dir") lib_names = [] if (defined(shard_lib.lib_names)) { lib_names += shard_lib.lib_names } else { cur_lib = get_label_info(shard_lib.label, "name") lib_names += [ string_replace(cur_lib, "lib", "", 1) ] } foreach(lib_name, lib_names) { sources += [ "${out_path}/${subsystem_name}/${part_name}/lib${lib_name}${dylib_suffix}" ] } } # Set the output directory for all dynamic libraries. if (module.prefix == "") { module_source_dir = "${target_out_dir}/previewer/common/bin/module/" } else { module_source_dir = "${target_out_dir}/previewer/common/bin/module/${module.prefix}/" } outputs = [ "${module_source_dir}{{source_file_part}}" ] module_install_name = "" } } # All dynamic libraries to be copied to the path "/previewer/common/bin/", # which are related to the previewer, can be added to this script. ohos_copy("copy_preview_shared_library") { deps = [] foreach(module, napi_modules) { deps += [ ":copy_napi_${module.prefix}libs" ] } # The dynamic library here is used for local testing of the previewer. if (enable_glfw_window) { deps += [ "$ace_root/adapter/preview/entrance/samples:previewer_demo" ] } sources = [ "//base/global/system_resources/fonts", "//foundation/arkui/ace_engine/adapter/preview/sdk/fontconfig.json", "//third_party/icu/ohos_icu4j/data/icudt72l.dat", ] foreach(item, common_bin) { subsystem_name = item.subsystem_name part_name = item.part_name deps += [ item.label ] out_path = get_label_info(item.label, "root_out_dir") lib_names = [] if (defined(item.lib_names)) { lib_names += item.lib_names } else { lib_names += [ string_replace(get_label_info(item.label, "name"), "lib", "", 1) ] } foreach(lib_name, lib_names) { sources += [ "${out_path}/${subsystem_name}/${part_name}/lib${lib_name}${dylib_suffix}" ] } } # Set the output directory for all dynamic libraries. outputs = [ target_out_dir + "/previewer/common/bin/{{source_file_part}}" ] module_source_dir = target_out_dir + "/previewer/common/bin/" module_install_name = "" } if (use_mingw_win) { ohos_copy("copy_preview_curl_cacert") { sources = [ "//third_party/curl/cacert.pem" ] outputs = [ target_out_dir + "/previewer/resources/cacert.pem" ] module_source_dir = target_out_dir + "/previewer/resources" module_install_name = "" } } ohos_copy("copy_system_resource_standard") { deps = [ ":get_system_resource" ] sources = [ system_resource_path ] outputs = [ target_out_dir + "/previewer/common/{{source_file_part}}" ] module_source_dir = target_out_dir + "/previewer/common" module_install_name = "" } } else { ohos_copy("copy_system_resource") { if (use_mac) { sources = [ "//prebuilts/ace-toolkit/preview/rich/resources" ] outputs = [ target_out_dir + "/tv_resources/{{source_file_part}}" ] module_source_dir = target_out_dir + "/tv_resources/" module_install_name = "" } else { deps = [ ":get_system_resource" ] sources = [ system_resource_path ] outputs = [ target_out_dir + "/tv_resources/{{source_file_part}}" ] module_source_dir = target_out_dir + "/tv_resources/" module_install_name = "" } } ohos_copy("copy_system_resource_wearable") { if (use_mac) { sources = [ "//prebuilts/ace-toolkit/preview/rich/resources" ] outputs = [ target_out_dir + "/wearable_resources/{{source_file_part}}" ] module_source_dir = target_out_dir + "/wearable_resources/" module_install_name = "" } else { deps = [ ":get_system_resource" ] sources = [ system_resource_path ] outputs = [ target_out_dir + "/wearable_resources/{{source_file_part}}" ] module_source_dir = target_out_dir + "/wearable_resources/" module_install_name = "" } } }