# Copyright (c) 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("//build/ohos.gni") config("ark_interop_config") { include_dirs = [ "../../.." ] cflags = [ "-std=c++17", "-Wno-gnu-zero-variadic-macro-arguments", "-fvisibility-inlines-hidden", "-fvisibility=hidden", "-fno-exceptions", "-fno-rtti", "-fmerge-all-constants", "-ffunction-sections", "-Wno-unused-private-field", ] if (current_os == "ohos") { cflags += [ "-fPIC" ] defines = [ "__LINUX__", "__OHOS__=1", ] } else if (current_os == "linux") { defines = [ "__LINUX__" ] } else if (current_os == "mingw") { defines = [ "__WINDOWS__" ] } } ohos_source_set("cj_envsetup") { part_name = "napi" subsystem_name = "arkui" configs = [ ":ark_interop_config" ] sources = [ "cj_envsetup.cpp" ] } ohos_shared_library("ark_interop") { part_name = "napi" subsystem_name = "arkui" innerapi_tags = [ "platformsdk" ] public_configs = [ ":ark_interop_config" ] sources = [ "ark_interop_async.cpp", "ark_interop_bigint.cpp", "ark_interop_engine.cpp", "ark_interop_global.cpp", "ark_interop_hitrace.cpp", "ark_interop_module.cpp", "ark_interop_napi.cpp", "ark_interop_object.cpp", "ark_interop_scope.cpp", "ark_interop_string.cpp", "ark_interop_symbol.cpp", ] deps = [ ":cj_envsetup", "../../../..:ace_napi", ] external_deps = [ "ets_runtime:libark_jsruntime", "hilog:libhilog", ] defines = [ "DEBUG_JS", "ENABLE_PROFILE", ] if (use_clang_coverage) { defines += [ "CLANG_COVERAGE" ] } if (is_arkui_x) { deps += [ "//third_party/bounds_checking_function:libsec_static", "//third_party/libuv:uv", ] } else { external_deps += [ "bounds_checking_function:libsec_static", "libuv:uv", ] } if (build_ohos_sdk) { defines += [ "NO_HITRACE", "NO_CONTAINER", ] } else { external_deps += [ "eventhandler:libeventhandler", "hitrace:hitrace_meter", ] } } ohos_shared_library("ark_interop_loader") { part_name = "napi" subsystem_name = "arkui" relative_install_dir = "module" configs = [ ":ark_interop_config" ] sources = [ "ark_interop_loader.cpp" ] external_deps = [ "hilog:libhilog" ] deps = [ ":cj_envsetup", "../../../..:ace_napi", ] }