123b3eb3cSopenharmony_ci# Copyright (c) 2021-2022 Huawei Device Co., Ltd. 223b3eb3cSopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License"); 323b3eb3cSopenharmony_ci# you may not use this file except in compliance with the License. 423b3eb3cSopenharmony_ci# You may obtain a copy of the License at 523b3eb3cSopenharmony_ci# 623b3eb3cSopenharmony_ci# http://www.apache.org/licenses/LICENSE-2.0 723b3eb3cSopenharmony_ci# 823b3eb3cSopenharmony_ci# Unless required by applicable law or agreed to in writing, software 923b3eb3cSopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS, 1023b3eb3cSopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1123b3eb3cSopenharmony_ci# See the License for the specific language governing permissions and 1223b3eb3cSopenharmony_ci# limitations under the License. 1323b3eb3cSopenharmony_ci 1423b3eb3cSopenharmony_ciimport("//foundation/arkui/ace_engine/ace_config.gni") 1523b3eb3cSopenharmony_ci 1623b3eb3cSopenharmony_ciohos_source_set("ace_resource") { 1723b3eb3cSopenharmony_ci if (current_os == "ohos") { 1823b3eb3cSopenharmony_ci sanitize = { 1923b3eb3cSopenharmony_ci integer_overflow = true 2023b3eb3cSopenharmony_ci boundary_sanitize = true 2123b3eb3cSopenharmony_ci debug = ace_sanitize_debug 2223b3eb3cSopenharmony_ci } 2323b3eb3cSopenharmony_ci } 2423b3eb3cSopenharmony_ci subsystem_name = ace_engine_subsystem 2523b3eb3cSopenharmony_ci part_name = ace_engine_part 2623b3eb3cSopenharmony_ci deps = [] 2723b3eb3cSopenharmony_ci external_deps = [] 2823b3eb3cSopenharmony_ci if (is_arkui_x) { 2923b3eb3cSopenharmony_ci deps += [ "//third_party/bounds_checking_function:libsec_static" ] 3023b3eb3cSopenharmony_ci } else { 3123b3eb3cSopenharmony_ci external_deps += [ "bounds_checking_function:libsec_shared" ] 3223b3eb3cSopenharmony_ci } 3323b3eb3cSopenharmony_ci 3423b3eb3cSopenharmony_ci # add resource file here 3523b3eb3cSopenharmony_ci sources = [ 3623b3eb3cSopenharmony_ci "ace_res_config.cpp", 3723b3eb3cSopenharmony_ci "ace_res_key_parser.cpp", 3823b3eb3cSopenharmony_ci "data_provider_manager.cpp", 3923b3eb3cSopenharmony_ci "shared_image_manager.cpp", 4023b3eb3cSopenharmony_ci ] 4123b3eb3cSopenharmony_ci if (current_os == "mac" || current_os == "mingw" || current_os == "ios" || 4223b3eb3cSopenharmony_ci current_os == "linux" || current_os == "android") { 4323b3eb3cSopenharmony_ci deps += [ ":binary_resource_mac_and_windows" ] 4423b3eb3cSopenharmony_ci sources += [ "internal_resource_previewer.cpp" ] 4523b3eb3cSopenharmony_ci } else { 4623b3eb3cSopenharmony_ci sources += [ "internal_resource.cpp" ] 4723b3eb3cSopenharmony_ci deps += [ ":binary_resource" ] 4823b3eb3cSopenharmony_ci } 4923b3eb3cSopenharmony_ci configs = [ "$ace_root:ace_config" ] 5023b3eb3cSopenharmony_ci 5123b3eb3cSopenharmony_ci if (current_os == "mingw") { 5223b3eb3cSopenharmony_ci cflags_cc = [ "-std=c++17" ] 5323b3eb3cSopenharmony_ci } 5423b3eb3cSopenharmony_ci 5523b3eb3cSopenharmony_ci if (use_hilog) { 5623b3eb3cSopenharmony_ci external_deps += [ "hilog:libhilog" ] 5723b3eb3cSopenharmony_ci } 5823b3eb3cSopenharmony_ci} 5923b3eb3cSopenharmony_ci 6023b3eb3cSopenharmony_ciohos_source_set("binary_resource") { 6123b3eb3cSopenharmony_ci deps = [ ":objcopy_resource" ] 6223b3eb3cSopenharmony_ci ace_resource_dir = 6323b3eb3cSopenharmony_ci get_label_info(":binary_resource($current_toolchain)", "target_out_dir") 6423b3eb3cSopenharmony_ci sources = [ 6523b3eb3cSopenharmony_ci "$ace_resource_dir/entry.o", 6623b3eb3cSopenharmony_ci "$ace_resource_dir/errorcode.o", 6723b3eb3cSopenharmony_ci "$ace_resource_dir/indexletter_bar.o", 6823b3eb3cSopenharmony_ci ] 6923b3eb3cSopenharmony_ci subsystem_name = ace_engine_subsystem 7023b3eb3cSopenharmony_ci part_name = ace_engine_part 7123b3eb3cSopenharmony_ci} 7223b3eb3cSopenharmony_ci 7323b3eb3cSopenharmony_ciohos_source_set("binary_resource_mac_and_windows") { 7423b3eb3cSopenharmony_ci deps = [ ":objcopy_resource_mac_and_windows" ] 7523b3eb3cSopenharmony_ci ace_resource_dir = 7623b3eb3cSopenharmony_ci get_label_info(":binary_resource($current_toolchain)", "target_out_dir") 7723b3eb3cSopenharmony_ci sources = [ 7823b3eb3cSopenharmony_ci "$ace_resource_dir/entry.c", 7923b3eb3cSopenharmony_ci "$ace_resource_dir/errorcode.c", 8023b3eb3cSopenharmony_ci "$ace_resource_dir/indexletter_bar.c", 8123b3eb3cSopenharmony_ci ] 8223b3eb3cSopenharmony_ci subsystem_name = ace_engine_subsystem 8323b3eb3cSopenharmony_ci part_name = ace_engine_part 8423b3eb3cSopenharmony_ci} 8523b3eb3cSopenharmony_ci 8623b3eb3cSopenharmony_ciaction_foreach("objcopy_resource") { 8723b3eb3cSopenharmony_ci # add resource file here 8823b3eb3cSopenharmony_ci sources = [ 8923b3eb3cSopenharmony_ci "binary/i18n/entry.json", 9023b3eb3cSopenharmony_ci "binary/i18n/errorcode.json", 9123b3eb3cSopenharmony_ci "binary/indexletter_bar.json", 9223b3eb3cSopenharmony_ci ] 9323b3eb3cSopenharmony_ci 9423b3eb3cSopenharmony_ci ace_resource_dir = 9523b3eb3cSopenharmony_ci get_label_info(":binary_resource($current_toolchain)", "target_out_dir") 9623b3eb3cSopenharmony_ci 9723b3eb3cSopenharmony_ci outputs = [ "$ace_resource_dir/{{source_name_part}}.o" ] 9823b3eb3cSopenharmony_ci 9923b3eb3cSopenharmony_ci objcopy_tool = objcopy_default 10023b3eb3cSopenharmony_ci script = "$ace_root/build/tools/run_objcopy.py" 10123b3eb3cSopenharmony_ci if (target_cpu == "x86_64") { 10223b3eb3cSopenharmony_ci objcopy_tool = objcopy_x86_64 10323b3eb3cSopenharmony_ci } 10423b3eb3cSopenharmony_ci 10523b3eb3cSopenharmony_ci args = [ 10623b3eb3cSopenharmony_ci "--objcopy", 10723b3eb3cSopenharmony_ci rebase_path("$objcopy_tool"), 10823b3eb3cSopenharmony_ci "--input", 10923b3eb3cSopenharmony_ci "{{source}}", 11023b3eb3cSopenharmony_ci "--output", 11123b3eb3cSopenharmony_ci rebase_path("$ace_resource_dir/") + "{{source_name_part}}.o", 11223b3eb3cSopenharmony_ci "--arch", 11323b3eb3cSopenharmony_ci current_cpu, 11423b3eb3cSopenharmony_ci ] 11523b3eb3cSopenharmony_ci} 11623b3eb3cSopenharmony_ci 11723b3eb3cSopenharmony_ciaction_foreach("objcopy_resource_mac_and_windows") { 11823b3eb3cSopenharmony_ci # add resource file here 11923b3eb3cSopenharmony_ci sources = [ 12023b3eb3cSopenharmony_ci "binary/i18n/entry.json", 12123b3eb3cSopenharmony_ci "binary/i18n/errorcode.json", 12223b3eb3cSopenharmony_ci "binary/indexletter_bar.json", 12323b3eb3cSopenharmony_ci ] 12423b3eb3cSopenharmony_ci 12523b3eb3cSopenharmony_ci ace_resource_dir = 12623b3eb3cSopenharmony_ci get_label_info(":binary_resource($current_toolchain)", "target_out_dir") 12723b3eb3cSopenharmony_ci 12823b3eb3cSopenharmony_ci outputs = [ "$ace_resource_dir/{{source_name_part}}.c" ] 12923b3eb3cSopenharmony_ci 13023b3eb3cSopenharmony_ci script = "$ace_root/build/tools/build_resource_to_bytecode.py" 13123b3eb3cSopenharmony_ci out_target = rebase_path("$ace_resource_dir/") + "{{source_name_part}}.c" 13223b3eb3cSopenharmony_ci 13323b3eb3cSopenharmony_ci args = [ 13423b3eb3cSopenharmony_ci "--input", 13523b3eb3cSopenharmony_ci "{{source}}", 13623b3eb3cSopenharmony_ci "--output", 13723b3eb3cSopenharmony_ci out_target, 13823b3eb3cSopenharmony_ci ] 13923b3eb3cSopenharmony_ci} 140