1# Copyright (c) 2022 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/lite/config/component/lite_component.gni") 15import("//third_party/jerryscript/engine.gni") 16 17lite_component("jerry-ext") { 18 if (ohos_kernel_type == "liteos_m") { 19 features = [ ":jerry-ext_static" ] 20 } else { 21 features = [ ":jerry-ext_shared" ] 22 } 23} 24 25jerry_ext_sources = [ 26 "arg/arg-js-iterator-helper.c", 27 "arg/arg-transform-functions.c", 28 "arg/arg.c", 29 "debugger/debugger-common.c", 30 "debugger/debugger-rp.c", 31 "debugger/debugger-serial.c", 32 "debugger/debugger-sha1.c", 33 "debugger/debugger-tcp.c", 34 "debugger/debugger-ws.c", 35 "handle-scope/handle-scope-allocator.c", 36 "handle-scope/handle-scope.c", 37 "handler/handler-assert.c", 38 "handler/handler-gc.c", 39 "handler/handler-print.c", 40 "handler/handler-register.c", 41 "handler/handler-resource-name.c", 42 "module/module.c", 43] 44 45jerry_ext_include_dirs = [ 46 "include", 47 "debugger", 48 "common", 49 "arg", 50 "handle-scope", 51 "${core_path}/include", 52] 53 54if (board_toolchain_type == "iccarm") { 55 config("jerry_ext_config") { 56 cflags = [ 57 "--diag_suppress", 58 "Pe940", 59 ] 60 defines = [ 61 "JERRY_FOR_IAR_CONFIG", 62 "JERRY_GC_LIMIT=(0)", 63 "JERRY_CPOINTER_32_BIT=0", 64 "JERRY_ERROR_MESSAGES=1", 65 "JERRY_PARSER=1", 66 "JERRY_LINE_INFO=1", 67 "JERRY_LOGGING=0", 68 "JERRY_DEBUGGER=0", 69 "JERRY_MEM_GC_BEFORE_EACH_ALLOC=0", 70 "JERRY_PARSER_DUMP_BYTE_CODE=0", 71 "JERRY_ES2015=0", 72 "JERRY_REGEXP_STRICT_MODE=0", 73 "JERRY_REGEXP_DUMP_BYTE_CODE=0", 74 "JERRY_SNAPSHOT_EXEC=1", 75 "JERRY_SNAPSHOT_SAVE=1", 76 "JERRY_SYSTEM_ALLOCATOR=0", 77 "JERRY_VALGRIND=0", 78 "JERRY_VM_EXEC_STOP=0", 79 "JERRY_STACK_LIMIT=(8)", 80 "JERRY_IAR_JUPITER", 81 "INPUTJS_BUFFER_SIZE=64*1024", 82 "SNAPSHOT_BUFFER_SIZE=48*1024", 83 ] 84 if (thirdparty_jerryscript_enable_external_context == true) { 85 defines += [ "JERRY_EXTERNAL_CONTEXT=1" ] 86 } 87 include_dirs = jerry_ext_include_dirs 88 include_dirs += [ 89 "${core_path}", 90 "${core_path}/jrt", 91 "//commonlibrary/utils_lite/memory/include", 92 ] 93 } 94} 95 96if (ohos_kernel_type == "liteos_m") { 97 lite_library("jerry-ext_static") { 98 target_type = "static_library" 99 sources = jerry_ext_sources 100 if (board_toolchain_type == "iccarm") { 101 public_configs = [ ":jerry_ext_config" ] 102 } else { 103 include_dirs = jerry_ext_include_dirs 104 } 105 } 106} else { 107 lite_library("jerry-ext_shared") { 108 target_type = "shared_library" 109 sources = jerry_ext_sources 110 include_dirs = jerry_ext_include_dirs 111 } 112} 113