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("//build/ohos.gni") 15 16config("ark_interop_config") { 17 include_dirs = [ "../../.." ] 18 cflags = [ 19 "-std=c++17", 20 "-Wno-gnu-zero-variadic-macro-arguments", 21 "-fvisibility-inlines-hidden", 22 "-fvisibility=hidden", 23 "-fno-exceptions", 24 "-fno-rtti", 25 "-fmerge-all-constants", 26 "-ffunction-sections", 27 "-Wno-unused-private-field", 28 ] 29 if (current_os == "ohos") { 30 cflags += [ "-fPIC" ] 31 defines = [ 32 "__LINUX__", 33 "__OHOS__=1", 34 ] 35 } else if (current_os == "linux") { 36 defines = [ "__LINUX__" ] 37 } else if (current_os == "mingw") { 38 defines = [ "__WINDOWS__" ] 39 } 40} 41 42ohos_source_set("cj_envsetup") { 43 part_name = "napi" 44 subsystem_name = "arkui" 45 46 configs = [ ":ark_interop_config" ] 47 sources = [ "cj_envsetup.cpp" ] 48} 49 50ohos_shared_library("ark_interop") { 51 part_name = "napi" 52 subsystem_name = "arkui" 53 innerapi_tags = [ "platformsdk" ] 54 55 public_configs = [ ":ark_interop_config" ] 56 57 sources = [ 58 "ark_interop_async.cpp", 59 "ark_interop_bigint.cpp", 60 "ark_interop_engine.cpp", 61 "ark_interop_global.cpp", 62 "ark_interop_hitrace.cpp", 63 "ark_interop_module.cpp", 64 "ark_interop_napi.cpp", 65 "ark_interop_object.cpp", 66 "ark_interop_scope.cpp", 67 "ark_interop_string.cpp", 68 "ark_interop_symbol.cpp", 69 ] 70 71 deps = [ 72 ":cj_envsetup", 73 "../../../..:ace_napi", 74 ] 75 76 external_deps = [ 77 "ets_runtime:libark_jsruntime", 78 "hilog:libhilog", 79 ] 80 81 if (!is_mingw && !is_mac && !is_linux && !is_arkui_x && is_standard_system) { 82 external_deps += [ "c_utils:utils" ] 83 84 # macro in runtime_core in full repo will effect build napi 85 if (ohos_indep_compiler_enable) { 86 external_deps += [ "runtime_core:libarkbase_static" ] 87 } 88 } 89 90 defines = [ 91 "DEBUG_JS", 92 "ENABLE_PROFILE", 93 ] 94 95 if (use_clang_coverage) { 96 defines += [ "CLANG_COVERAGE" ] 97 } 98 99 if (is_arkui_x) { 100 deps += [ 101 "//third_party/bounds_checking_function:libsec_static", 102 "//third_party/libuv:uv", 103 ] 104 } else { 105 external_deps += [ 106 "bounds_checking_function:libsec_static", 107 "libuv:uv", 108 ] 109 } 110 111 if (build_ohos_sdk) { 112 defines += [ 113 "NO_HITRACE", 114 "NO_CONTAINER", 115 ] 116 } else { 117 external_deps += [ 118 "eventhandler:libeventhandler", 119 "hitrace:hitrace_meter", 120 ] 121 } 122} 123 124ohos_shared_library("ark_interop_loader") { 125 part_name = "napi" 126 subsystem_name = "arkui" 127 relative_install_dir = "module" 128 129 configs = [ ":ark_interop_config" ] 130 131 sources = [ "ark_interop_loader.cpp" ] 132 133 external_deps = [ "hilog:libhilog" ] 134 135 deps = [ 136 ":cj_envsetup", 137 "../../../..:ace_napi", 138 ] 139} 140