# Copyright (c) 2021-2024 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import("//arkcompiler/runtime_core/static_core/ark_config.gni") import("$ark_root/plugins/plugins.gni") if (ark_standalone_build) { import("$build_root/ark.gni") } else { import("//build/ohos.gni") } config("arklinker_public_config") { include_dirs = [ "$ark_root/libpandabase", "$ark_root/libpandafile", ] } arklinker_sources = [ "linker.cpp", "linker_code_parser_context.cpp", "linker_context.cpp", "linker_context_misc.cpp", ] arklinker_configs = [ "$ark_root:ark_config", "$ark_root/libpandabase:arkbase_public_config", "$ark_root/libpandafile:arkfile_public_config", ] ohos_shared_library("arklinker") { sources = arklinker_sources include_dirs = [ "$ark_root/libpandabase", "$ark_root/libpandafile", "$target_gen_dir", ] configs = arklinker_configs deps = [ "$ark_root/libpandabase:libarktsbase", "$ark_root/libpandafile:libarktsfile", ] if (is_mingw || is_win) { deps += [ "$ark_root/libpandabase:libarktsbase_frontend_static", "$ark_root/libpandafile:libarktsfile_frontend_static", ] } external_deps = [ sdk_libc_secshared_dep ] output_extension = "so" if (is_mingw || is_win) { output_extension = "dll" } part_name = ark_part_name subsystem_name = "$ark_subsystem_name" } ark_gen_file("link_options_h") { template_file = "$ark_root/templates/options/options.h.erb" data = [ "options.yaml" ] api = [ "$ark_root/templates/common.rb" ] output_file = "$target_gen_dir/panda_gen_options/generated/link_options.h" } ohos_static_library("arklinker_static") { sources = arklinker_sources include_dirs = [ "$ark_root/libpandabase", "$ark_root/libpandafile", "$target_gen_dir", ] configs = arklinker_configs deps = [ "$ark_root/libpandabase:libarktsbase_frontend_static", "$ark_root/libpandafile:libarktsfile_frontend_static", ] external_deps = [ sdk_libc_secshared_dep ] part_name = "runtime_core" subsystem_name = "arkcompiler" } ohos_executable("ark_link") { sources = [ "link.cpp" ] include_dirs = [ "$target_gen_dir", "$target_gen_dir/panda_gen_options", "$ark_root_gen_dir/libpandabase", ] configs = [ "$ark_root:ark_config", "$ark_root/static_linker:arklinker_public_config", "$ark_root/libpandabase:arkbase_public_config", "$ark_root/libpandafile:arkfile_public_config", ] deps = [ ":arklinker_static", ":link_options_h", ] external_deps = [ sdk_libc_secshared_dep ] if (target_os != "win" && target_os != "mingw" && target_os != "winuwp") { if (is_linux) { deps += [ "$ark_root/plugins/ets:etsstdlib_copy_linux" ] } else if (is_mingw || is_win) { deps += [ "$ark_root/plugins/ets:etsstdlib_copy_windows" ] } } libs = platform_libs ldflags = platform_ldflags install_enable = true part_name = ark_part_name subsystem_name = "$ark_subsystem_name" } group("static_linker") { deps = [ ":ark_link", ":arklinker", ] }