13920e296Sopenharmony_ci# Copyright (c) 2022 Huawei Device Co., Ltd.
23920e296Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
33920e296Sopenharmony_ci# you may not use this file except in compliance with the License.
43920e296Sopenharmony_ci# You may obtain a copy of the License at
53920e296Sopenharmony_ci#
63920e296Sopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
73920e296Sopenharmony_ci#
83920e296Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software
93920e296Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
103920e296Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
113920e296Sopenharmony_ci# See the License for the specific language governing permissions and
123920e296Sopenharmony_ci# limitations under the License.
133920e296Sopenharmony_ci
143920e296Sopenharmony_ciimport("//build/ohos.gni")
153920e296Sopenharmony_ciimport("//build/test.gni")
163920e296Sopenharmony_ciimport("./restool.gni")
173920e296Sopenharmony_ci
183920e296Sopenharmony_ciohos_executable("restool") {
193920e296Sopenharmony_ci  sources = [
203920e296Sopenharmony_ci    "src/append_compiler.cpp",
213920e296Sopenharmony_ci    "src/binary_file_packer.cpp",
223920e296Sopenharmony_ci    "src/cmd_parser.cpp",
233920e296Sopenharmony_ci    "src/compression_parser.cpp",
243920e296Sopenharmony_ci    "src/config_parser.cpp",
253920e296Sopenharmony_ci    "src/factory_resource_compiler.cpp",
263920e296Sopenharmony_ci    "src/file_entry.cpp",
273920e296Sopenharmony_ci    "src/file_manager.cpp",
283920e296Sopenharmony_ci    "src/generic_compiler.cpp",
293920e296Sopenharmony_ci    "src/header.cpp",
303920e296Sopenharmony_ci    "src/i_resource_compiler.cpp",
313920e296Sopenharmony_ci    "src/id_defined_parser.cpp",
323920e296Sopenharmony_ci    "src/id_worker.cpp",
333920e296Sopenharmony_ci    "src/json_compiler.cpp",
343920e296Sopenharmony_ci    "src/key_parser.cpp",
353920e296Sopenharmony_ci    "src/reference_parser.cpp",
363920e296Sopenharmony_ci    "src/resconfig_parser.cpp",
373920e296Sopenharmony_ci    "src/resource_append.cpp",
383920e296Sopenharmony_ci    "src/resource_check.cpp",
393920e296Sopenharmony_ci    "src/resource_directory.cpp",
403920e296Sopenharmony_ci    "src/resource_item.cpp",
413920e296Sopenharmony_ci    "src/resource_merge.cpp",
423920e296Sopenharmony_ci    "src/resource_module.cpp",
433920e296Sopenharmony_ci    "src/resource_pack.cpp",
443920e296Sopenharmony_ci    "src/resource_table.cpp",
453920e296Sopenharmony_ci    "src/resource_util.cpp",
463920e296Sopenharmony_ci    "src/restool.cpp",
473920e296Sopenharmony_ci    "src/select_compile_parse.cpp",
483920e296Sopenharmony_ci    "src/task_handle.cpp",
493920e296Sopenharmony_ci    "src/thread_pool.cpp",
503920e296Sopenharmony_ci    "src/translatable_parser.cpp",
513920e296Sopenharmony_ci  ]
523920e296Sopenharmony_ci
533920e296Sopenharmony_ci  include_dirs = [
543920e296Sopenharmony_ci    "include",
553920e296Sopenharmony_ci    "//third_party/bounds_checking_function/include",
563920e296Sopenharmony_ci  ]
573920e296Sopenharmony_ci
583920e296Sopenharmony_ci  deps = [
593920e296Sopenharmony_ci    "//third_party/bounds_checking_function:libsec_static",
603920e296Sopenharmony_ci    "//third_party/cJSON:cjson_static",
613920e296Sopenharmony_ci    "//third_party/libpng:libpng_static",
623920e296Sopenharmony_ci  ]
633920e296Sopenharmony_ci
643920e296Sopenharmony_ci  cflags = [ "-std=c++17" ]
653920e296Sopenharmony_ci  if (is_mingw) {
663920e296Sopenharmony_ci    ldflags = [
673920e296Sopenharmony_ci      "-static",
683920e296Sopenharmony_ci      "-lws2_32",
693920e296Sopenharmony_ci      "-lshlwapi",
703920e296Sopenharmony_ci    ]
713920e296Sopenharmony_ci  }
723920e296Sopenharmony_ci  subsystem_name = "developtools"
733920e296Sopenharmony_ci  part_name = "global_resource_tool"
743920e296Sopenharmony_ci}
753920e296Sopenharmony_ci
763920e296Sopenharmony_ciohos_unittest_py("restool_test") {
773920e296Sopenharmony_ci  sources = [ "test/test.py" ]
783920e296Sopenharmony_ci}
793920e296Sopenharmony_ci
803920e296Sopenharmony_ciohos_copy("restool_id_defined") {
813920e296Sopenharmony_ci  sources = [ "${id_defined_path}" ]
823920e296Sopenharmony_ci  outputs = [ get_label_info(":restool($host_toolchain)", "root_out_dir") +
833920e296Sopenharmony_ci              "/developtools/global_resource_tool/{{source_file_part}}" ]
843920e296Sopenharmony_ci  deps = [ ":restool($host_toolchain)" ]
853920e296Sopenharmony_ci  subsystem_name = "developtools"
863920e296Sopenharmony_ci  part_name = "global_resource_tool"
873920e296Sopenharmony_ci}
883920e296Sopenharmony_ci
893920e296Sopenharmony_ciohos_prebuilt_etc("restool_systemres") {
903920e296Sopenharmony_ci  source = "${id_defined_path}"
913920e296Sopenharmony_ci  subsystem_name = "developtools"
923920e296Sopenharmony_ci  part_name = "global_resource_tool"
933920e296Sopenharmony_ci}
94