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-port-default") { 18 if (ohos_kernel_type == "liteos_m") { 19 features = [ ":jerry-port-default_static" ] 20 } else { 21 features = [ ":jerry-port-default_shared" ] 22 } 23} 24 25jerry_port_default_sources = [ 26 "default-date.c", 27 "default-debugger.c", 28 "default-external-context.c", 29 "default-fatal.c", 30 "default-io.c", 31 "default-module.c", 32] 33 34jerry_port_default_include_dirs = [ 35 "include", 36 "${core_path}/include", 37] 38 39if (board_toolchain_type == "iccarm") { 40 config("jerry_port_default_config") { 41 cflags = [ 42 "--diag_suppress", 43 "Pe111", 44 ] 45 defines = [ 46 "JERRY_FOR_IAR_CONFIG", 47 "JERRY_GC_LIMIT=(0)", 48 "JERRY_CPOINTER_32_BIT=0", 49 "JERRY_ERROR_MESSAGES=1", 50 "JERRY_PARSER=1", 51 "JERRY_LINE_INFO=1", 52 "JERRY_LOGGING=0", 53 "JERRY_DEBUGGER=0", 54 "JERRY_MEM_GC_BEFORE_EACH_ALLOC=0", 55 "JERRY_PARSER_DUMP_BYTE_CODE=0", 56 "JERRY_ES2015=0", 57 "JERRY_REGEXP_STRICT_MODE=0", 58 "JERRY_REGEXP_DUMP_BYTE_CODE=0", 59 "JERRY_SNAPSHOT_EXEC=1", 60 "JERRY_SNAPSHOT_SAVE=1", 61 "JERRY_SYSTEM_ALLOCATOR=0", 62 "JERRY_VALGRIND=0", 63 "JERRY_VM_EXEC_STOP=0", 64 "JERRY_STACK_LIMIT=(8)", 65 "JERRY_IAR_JUPITER", 66 "INPUTJS_BUFFER_SIZE=64*1024", 67 "SNAPSHOT_BUFFER_SIZE=48*1024", 68 ] 69 if (thirdparty_jerryscript_enable_external_context == true) { 70 defines += [ "JERRY_EXTERNAL_CONTEXT=1" ] 71 } 72 include_dirs = jerry_port_default_include_dirs 73 include_dirs += [ 74 "${core_path}", 75 "${core_path}/include", 76 "${core_path}/api", 77 "${core_path}/debugger", 78 "${core_path}/ecma/base", 79 "${core_path}/ecma/builtin-objects", 80 "${core_path}/ecma/builtin-objects/typedarray", 81 "${core_path}/ecma/operations", 82 "${core_path}/ext", 83 "${core_path}/jcontext", 84 "${core_path}/jmem", 85 "${core_path}/jrt", 86 "${core_path}/lit", 87 "${core_path}/parser", 88 "${core_path}/parser/js", 89 "${core_path}/parser/regexp", 90 "${core_path}/vm", 91 "${port_path}", 92 "//commonlibrary/utils_lite/memory/include", 93 ] 94 } 95} 96 97if (ohos_kernel_type == "liteos_m") { 98 lite_library("jerry-port-default_static") { 99 target_type = "static_library" 100 sources = jerry_port_default_sources 101 if (board_toolchain_type == "iccarm") { 102 public_configs = [ ":jerry_port_default_config" ] 103 } else { 104 include_dirs = jerry_port_default_include_dirs 105 } 106 } 107} else { 108 lite_library("jerry-port-default_shared") { 109 target_type = "shared_library" 110 111 sources = jerry_port_default_sources 112 include_dirs = jerry_port_default_include_dirs 113 } 114} 115