1# Copyright (c) 2021 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") 15import("//foundation/arkui/ace_engine/ace_config.gni") 16 17config("ace_napi_quickjs_config") { 18 include_dirs = [ 19 "//foundation/arkui/napi", 20 "//foundation/arkui/napi/native_engine", 21 "//third_party/libuv/include", 22 "//third_party/quickjs", 23 "//third_party/bounds_checking_function/include", 24 ] 25} 26 27template("ace_napi_impl") { 28 ohos_source_set(target_name) { 29 public_configs = [ ":ace_napi_quickjs_config" ] 30 defines = invoker.engine_defines 31 defines += invoker.defines 32 33 include_dirs = [ "//foundation/arkui/napi/native_engine/impl/quickjs" ] 34 35 sources = [ 36 "native_value/quickjs_native_array.cpp", 37 "native_value/quickjs_native_array_buffer.cpp", 38 "native_value/quickjs_native_big_int.cpp", 39 "native_value/quickjs_native_boolean.cpp", 40 "native_value/quickjs_native_buffer.cpp", 41 "native_value/quickjs_native_data_view.cpp", 42 "native_value/quickjs_native_date.cpp", 43 "native_value/quickjs_native_external.cpp", 44 "native_value/quickjs_native_function.cpp", 45 "native_value/quickjs_native_number.cpp", 46 "native_value/quickjs_native_object.cpp", 47 "native_value/quickjs_native_string.cpp", 48 "native_value/quickjs_native_typed_array.cpp", 49 "native_value/quickjs_native_value.cpp", 50 "quickjs_ext.cpp", 51 "quickjs_native_deferred.cpp", 52 "quickjs_native_engine.cpp", 53 "quickjs_native_engine_impl.cpp", 54 "quickjs_native_reference.cpp", 55 ] 56 57 deps = [ 58 "//foundation/arkui/napi:ace_napi", 59 "//third_party/bounds_checking_function:libsec_static", 60 ] 61 if (use_mingw_win || use_mac || use_linux) { 62 defines += [ "PREVIEW" ] 63 } 64 if (use_mingw_win) { 65 defines += [ "WINDOWS_PLATFORM" ] 66 } else if (use_mac) { 67 defines += [ "MAC_PLATFORM" ] 68 } else if (use_linux) { 69 defines += [ "LINUX_PLATFORM" ] 70 } else if (is_cross_platform_build && target_os == "ios") { 71 defines += [ "IOS_PLATFORM" ] 72 } else if (is_cross_platform_build && target_os == "android") { 73 defines += [ "ANDROID_PLATFORM" ] 74 } else { 75 external_deps = hilog_deps 76 } 77 78 if (invoker.use_js_debug) { 79 deps += [ "//third_party/quickjs:qjs_debugger" ] 80 } else { 81 deps += [ "//third_party/quickjs:qjs" ] 82 } 83 84 cflags_cc = [ "-Wno-missing-braces" ] 85 part_name = "napi" 86 subsystem_name = "arkui" 87 } 88} 89 90foreach(item, ace_platforms) { 91 if (item.name == "ohos" || is_cross_platform_build) { 92 engine_config = { 93 } 94 support_engines = { 95 } 96 engine_config = item.config 97 support_engines = engine_config.js_engines 98 foreach(engine, support_engines) { 99 if (engine.engine_name == "qjs") { 100 ace_napi_impl("ace_napi_impl_quickjs") { 101 defines = [] 102 engine_defines = engine.engine_defines 103 use_js_debug = false 104 defines = engine_config.defines 105 } 106 if (defined(engine.have_debug) && engine.have_debug) { 107 ace_napi_impl("ace_napi_impl_quickjs_debug") { 108 defines = [] 109 engine_defines = engine.engine_defines 110 use_js_debug = true 111 defines = engine_config.defines 112 } 113 } 114 } 115 } 116 } 117} 118