1# Copyright (c) 2021-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/static_core/ark_config.gni") 15import("//build/ohos.gni") 16import("$ark_root/plugins/plugins.gni") 17 18config("arklinker_public_config") { 19 include_dirs = [ 20 "$ark_root/libpandabase", 21 "$ark_root/libpandafile", 22 ] 23} 24 25arklinker_sources = [ 26 "linker.cpp", 27 "linker_code_parser_context.cpp", 28 "linker_context.cpp", 29 "linker_context_misc.cpp", 30] 31 32arklinker_configs = [ 33 "$ark_root:ark_config", 34 "$ark_root/libpandabase:arkbase_public_config", 35 "$ark_root/libpandafile:arkfile_public_config", 36] 37 38ohos_shared_library("arklinker") { 39 sources = arklinker_sources 40 41 include_dirs = [ 42 "$ark_root/libpandabase", 43 "$ark_root/libpandafile", 44 "$target_gen_dir", 45 ] 46 47 configs = arklinker_configs 48 49 deps = [ 50 "$ark_root/libpandabase:libarktsbase", 51 "$ark_root/libpandafile:libarktsfile", 52 ] 53 54 external_deps = [ sdk_libc_secshared_dep ] 55 56 output_extension = "so" 57 if (is_mingw) { 58 output_extension = "dll" 59 } 60 part_name = ark_part_name 61 subsystem_name = "$ark_subsystem_name" 62} 63 64ark_gen_file("link_options_h") { 65 template_file = "$ark_root/templates/options/options.h.erb" 66 data = [ "options.yaml" ] 67 api = [ "$ark_root/templates/common.rb" ] 68 output_file = "$target_gen_dir/panda_gen_options/generated/link_options.h" 69} 70 71ohos_executable("ark_link") { 72 sources = [ "link.cpp" ] 73 74 include_dirs = [ 75 "$target_gen_dir", 76 "$target_gen_dir/panda_gen_options", 77 "$ark_root_gen_dir/libpandabase", 78 ] 79 80 configs = [ 81 "$ark_root:ark_config", 82 "$ark_root/static_linker:arklinker_public_config", 83 "$ark_root/libpandabase:arkbase_public_config", 84 "$ark_root/libpandafile:arkfile_public_config", 85 ] 86 87 deps = [ 88 ":arklinker", 89 ":link_options_h", 90 "$ark_root/libpandabase:libarktsbase", 91 ] 92 93 libs = platform_libs 94 ldflags = platform_ldflags 95 96 install_enable = true 97 part_name = ark_part_name 98 subsystem_name = "$ark_subsystem_name" 99} 100