1# Copyright (c) 2024 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("//arkcompiler/runtime_core/ark_config.gni") 15 16config("panda_guard_public_config") { 17 include_dirs = [ "$ark_root/panda_guard" ] 18} 19 20panda_guard_sources = [ 21 "configs/guard_args_parser.cpp", 22 "configs/guard_context.cpp", 23 "configs/guard_graph_context.cpp", 24 "configs/guard_name_cache.cpp", 25 "configs/guard_options.cpp", 26 "generator/name_mapping.cpp", 27 "generator/order_name_generator.cpp", 28 "guard4program.cpp", 29 "guard_driver.cpp", 30 "obfuscate/class.cpp", 31 "obfuscate/entity.cpp", 32 "obfuscate/file_path.cpp", 33 "obfuscate/function.cpp", 34 "obfuscate/graph_analyzer.cpp", 35 "obfuscate/inst_obf.cpp", 36 "obfuscate/method.cpp", 37 "obfuscate/module_record.cpp", 38 "obfuscate/node.cpp", 39 "obfuscate/object.cpp", 40 "obfuscate/program.cpp", 41 "obfuscate/property.cpp", 42 "util/error.cpp", 43 "util/file_util.cpp", 44 "util/json_util.cpp", 45 "util/string_util.cpp", 46] 47 48panda_guard_configs = [ 49 "$ark_root:ark_config", 50 "$ark_root/libpandabase:arkbase_public_config", 51 "$ark_root/assembler:arkassembler_public_config", 52 "$ark_root/libpandafile:arkfile_public_config", 53 "$ark_root/compiler:arkcompiler_public_config", 54] 55 56ohos_static_library("panda_guard_static") { 57 sources = panda_guard_sources 58 59 include_dirs = [ "$ark_root/abc2program" ] 60 61 configs = panda_guard_configs 62 63 public_configs = [ ":panda_guard_public_config" ] 64 65 deps = [ 66 "$ark_root/abc2program:abc2program_frontend_static", 67 "$ark_root/assembler:libarkassembler_frontend_static", 68 "$ark_root/compiler:libarkcompiler_frontend_static", 69 "$ark_root/libpandabase:libarkbase_frontend_static", 70 "$ark_root/libpandafile:libarkfile_frontend_static", 71 ] 72 73 external_deps = [ sdk_libc_secshared_dep ] 74 75 part_name = "runtime_core" 76 subsystem_name = "arkcompiler" 77} 78 79ohos_executable("panda_guard") { 80 sources = [ "guard_main.cpp" ] 81 82 configs = panda_guard_configs 83 84 deps = [ ":panda_guard_static" ] 85 86 install_enable = false 87 88 part_name = "runtime_core" 89 subsystem_name = "arkcompiler" 90} 91 92if (is_linux || (is_build_sdk && is_ohos)) { 93 ohos_copy("panda_guard_build_ets") { 94 deps = [ ":panda_guard" ] 95 sources = [ "${root_out_dir}/arkcompiler/runtime_core/panda_guard" ] 96 outputs = [ "${root_out_dir}/arkcompiler/runtime_core/panda_guard-ets" ] 97 module_source_dir = "${root_out_dir}/arkcompiler/runtime_core" 98 module_install_name = "panda_guard" 99 100 part_name = "runtime_core" 101 subsystem_name = "arkcompiler" 102 } 103} 104 105if (is_mingw) { 106 ohos_copy("panda_guard_build_win_ets") { 107 deps = [ ":panda_guard" ] 108 sources = [ "${root_out_dir}/arkcompiler/runtime_core/panda_guard.exe" ] 109 outputs = [ "${root_out_dir}/arkcompiler/runtime_core/panda_guard-win-ets" ] 110 module_source_dir = "${root_out_dir}/arkcompiler/runtime_core" 111 module_install_name = "panda_guard.exe" 112 113 part_name = "runtime_core" 114 subsystem_name = "arkcompiler" 115 } 116} 117 118if (is_mac) { 119 ohos_copy("panda_guard_build_mac_ets") { 120 deps = [ ":panda_guard" ] 121 sources = [ "${root_out_dir}/arkcompiler/runtime_core/panda_guard" ] 122 outputs = [ "${root_out_dir}/arkcompiler/runtime_core/panda_guard-mac-ets" ] 123 module_source_dir = "${root_out_dir}/arkcompiler/runtime_core" 124 module_install_name = "panda_guard" 125 126 part_name = "runtime_core" 127 subsystem_name = "arkcompiler" 128 } 129} 130