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/cmd_parser.cpp", 22 "src/config_parser.cpp", 23 "src/factory_resource_compiler.cpp", 24 "src/file_entry.cpp", 25 "src/file_manager.cpp", 26 "src/generic_compiler.cpp", 27 "src/header.cpp", 28 "src/i_resource_compiler.cpp", 29 "src/id_defined_parser.cpp", 30 "src/id_worker.cpp", 31 "src/json_compiler.cpp", 32 "src/key_parser.cpp", 33 "src/reference_parser.cpp", 34 "src/resconfig_parser.cpp", 35 "src/resource_append.cpp", 36 "src/resource_check.cpp", 37 "src/resource_directory.cpp", 38 "src/resource_item.cpp", 39 "src/resource_merge.cpp", 40 "src/resource_module.cpp", 41 "src/resource_pack.cpp", 42 "src/resource_table.cpp", 43 "src/resource_util.cpp", 44 "src/restool.cpp", 45 "src/select_compile_parse.cpp", 46 "src/task_handle.cpp", 47 "src/translatable_parser.cpp", 48 ] 49 50 include_dirs = [ 51 "include", 52 "//third_party/bounds_checking_function/include", 53 ] 54 55 deps = [ 56 "//third_party/bounds_checking_function:libsec_static", 57 "//third_party/cJSON:cjson_static", 58 "//third_party/libpng:libpng_static", 59 ] 60 61 cflags = [ "-std=c++17" ] 62 if (is_mingw) { 63 ldflags = [ 64 "-static", 65 "-lws2_32", 66 "-lshlwapi", 67 ] 68 } 69 subsystem_name = "developtools" 70 part_name = "global_resource_tool" 71} 72 73ohos_unittest_py("restool_test") { 74 sources = [ "test/test.py" ] 75} 76 77ohos_copy("restool_id_defined") { 78 sources = [ "${id_defined_path}" ] 79 outputs = [ get_label_info(":restool($host_toolchain)", "root_out_dir") + 80 "/developtools/global_resource_tool/{{source_file_part}}" ] 81 deps = [ ":restool($host_toolchain)" ] 82 subsystem_name = "developtools" 83 part_name = "global_resource_tool" 84} 85 86ohos_prebuilt_etc("restool_systemres") { 87 source = "${id_defined_path}" 88 subsystem_name = "developtools" 89 part_name = "global_resource_tool" 90} 91