1# Copyright (c) 2022 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14import("//build/ohos.gni") 15import("//build/test.gni") 16import("./restool.gni") 17 18ohos_executable("restool") { 19 sources = [ 20 "src/append_compiler.cpp", 21 "src/binary_file_packer.cpp", 22 "src/cmd/cmd_parser.cpp", 23 "src/cmd/dump_parser.cpp", 24 "src/cmd/package_parser.cpp", 25 "src/compression_parser.cpp", 26 "src/config_parser.cpp", 27 "src/file_entry.cpp", 28 "src/file_manager.cpp", 29 "src/generic_compiler.cpp", 30 "src/header.cpp", 31 "src/i_resource_compiler.cpp", 32 "src/id_defined_parser.cpp", 33 "src/id_worker.cpp", 34 "src/json_compiler.cpp", 35 "src/key_parser.cpp", 36 "src/overlap_binary_file_packer.cpp", 37 "src/overlap_compiler.cpp", 38 "src/reference_parser.cpp", 39 "src/resconfig_parser.cpp", 40 "src/resource_append.cpp", 41 "src/resource_check.cpp", 42 "src/resource_compiler_factory.cpp", 43 "src/resource_directory.cpp", 44 "src/resource_dumper.cpp", 45 "src/resource_item.cpp", 46 "src/resource_merge.cpp", 47 "src/resource_module.cpp", 48 "src/resource_overlap.cpp", 49 "src/resource_pack.cpp", 50 "src/resource_packer_factory.cpp", 51 "src/resource_table.cpp", 52 "src/resource_util.cpp", 53 "src/restool.cpp", 54 "src/restool_errors.cpp", 55 "src/select_compile_parse.cpp", 56 "src/thread_pool.cpp", 57 "src/translatable_parser.cpp", 58 ] 59 60 include_dirs = [ 61 "include", 62 "//third_party/bounds_checking_function/include", 63 ] 64 65 deps = [ 66 "//third_party/bounds_checking_function:libsec_static", 67 "//third_party/cJSON:cjson_static", 68 "//third_party/libpng:libpng_static", 69 ] 70 71 if (is_arkui_x) { 72 deps += [ "//third_party/zlib:libz" ] 73 } else { 74 external_deps = [ "zlib:libz" ] 75 } 76 77 cflags = [ "-std=c++17" ] 78 if (is_mingw) { 79 ldflags = [ 80 "-static", 81 "-lws2_32", 82 "-lshlwapi", 83 ] 84 } 85 subsystem_name = "developtools" 86 part_name = "global_resource_tool" 87} 88 89ohos_unittest_py("restool_test") { 90 sources = [ "test/test.py" ] 91} 92 93ohos_copy("restool_id_defined") { 94 sources = [ "${id_defined_path}" ] 95 outputs = [ get_label_info(":restool($host_toolchain)", "root_out_dir") + 96 "/developtools/global_resource_tool/{{source_file_part}}" ] 97 deps = [ ":restool($host_toolchain)" ] 98 subsystem_name = "developtools" 99 part_name = "global_resource_tool" 100} 101 102ohos_prebuilt_etc("restool_systemres") { 103 source = "${id_defined_path}" 104 subsystem_name = "developtools" 105 part_name = "global_resource_tool" 106} 107