1425bb815Sopenharmony_ci# Copyright (c) 2022 Huawei Device Co., Ltd. 2425bb815Sopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License"); 3425bb815Sopenharmony_ci# you may not use this file except in compliance with the License. 4425bb815Sopenharmony_ci# You may obtain a copy of the License at 5425bb815Sopenharmony_ci# 6425bb815Sopenharmony_ci# http://www.apache.org/licenses/LICENSE-2.0 7425bb815Sopenharmony_ci# 8425bb815Sopenharmony_ci# Unless required by applicable law or agreed to in writing, software 9425bb815Sopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS, 10425bb815Sopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11425bb815Sopenharmony_ci# See the License for the specific language governing permissions and 12425bb815Sopenharmony_ci# limitations under the License. 13425bb815Sopenharmony_ci 14425bb815Sopenharmony_ciimport("//build/lite/config/component/lite_component.gni") 15425bb815Sopenharmony_ciimport("//third_party/jerryscript/engine.gni") 16425bb815Sopenharmony_ci 17425bb815Sopenharmony_cilite_component("jerry-port-default") { 18425bb815Sopenharmony_ci if (ohos_kernel_type == "liteos_m") { 19425bb815Sopenharmony_ci features = [ ":jerry-port-default_static" ] 20425bb815Sopenharmony_ci } else { 21425bb815Sopenharmony_ci features = [ ":jerry-port-default_shared" ] 22425bb815Sopenharmony_ci } 23425bb815Sopenharmony_ci} 24425bb815Sopenharmony_ci 25425bb815Sopenharmony_cijerry_port_default_sources = [ 26425bb815Sopenharmony_ci "default-date.c", 27425bb815Sopenharmony_ci "default-debugger.c", 28425bb815Sopenharmony_ci "default-external-context.c", 29425bb815Sopenharmony_ci "default-fatal.c", 30425bb815Sopenharmony_ci "default-io.c", 31425bb815Sopenharmony_ci "default-module.c", 32425bb815Sopenharmony_ci] 33425bb815Sopenharmony_ci 34425bb815Sopenharmony_cijerry_port_default_include_dirs = [ 35425bb815Sopenharmony_ci "include", 36425bb815Sopenharmony_ci "${core_path}/include", 37425bb815Sopenharmony_ci] 38425bb815Sopenharmony_ci 39425bb815Sopenharmony_ciif (board_toolchain_type == "iccarm") { 40425bb815Sopenharmony_ci config("jerry_port_default_config") { 41425bb815Sopenharmony_ci cflags = [ 42425bb815Sopenharmony_ci "--diag_suppress", 43425bb815Sopenharmony_ci "Pe111", 44425bb815Sopenharmony_ci ] 45425bb815Sopenharmony_ci defines = [ 46425bb815Sopenharmony_ci "JERRY_FOR_IAR_CONFIG", 47425bb815Sopenharmony_ci "JERRY_DEBUGGER=0", 48425bb815Sopenharmony_ci "JERRY_STACK_LIMIT=(8)", 49425bb815Sopenharmony_ci "JERRY_IAR_JUPITER", 50425bb815Sopenharmony_ci "INPUTJS_BUFFER_SIZE=64*1024", 51425bb815Sopenharmony_ci "SNAPSHOT_BUFFER_SIZE=48*1024", 52425bb815Sopenharmony_ci ] 53425bb815Sopenharmony_ci defines += [ 54425bb815Sopenharmony_ci "JERRY_GC_LIMIT=${jerryscript_jerry_gc_limit}", 55425bb815Sopenharmony_ci "JERRY_CPOINTER_32_BIT=${jerryscript_jerry_cpointer_32_bit}", 56425bb815Sopenharmony_ci "JERRY_ERROR_MESSAGES=${jerryscript_jerry_error_messages}", 57425bb815Sopenharmony_ci "JERRY_PARSER=${jerryscript_jerry_parser}", 58425bb815Sopenharmony_ci "JERRY_LINE_INFO=${jerryscript_jerry_line_info}", 59425bb815Sopenharmony_ci "JERRY_LOGGING=${jerryscript_jerry_logging}", 60425bb815Sopenharmony_ci "JERRY_MEM_GC_BEFORE_EACH_ALLOC=${jerryscript_jerry_mem_gc_before_each_alloc}", 61425bb815Sopenharmony_ci "JERRY_PARSER_DUMP_BYTE_CODE=${jerryscript_jerry_parser_dump_byte_code}", 62425bb815Sopenharmony_ci "JERRY_REGEXP_STRICT_MODE=${jerryscript_jerry_regexp_strict_mode}", 63425bb815Sopenharmony_ci "JERRY_REGEXP_DUMP_BYTE_CODE=${jerryscript_jerry_regexp_dump_byte_code}", 64425bb815Sopenharmony_ci "JERRY_SNAPSHOT_EXEC=${jerryscript_jerry_snapshot_exec}", 65425bb815Sopenharmony_ci "JERRY_SNAPSHOT_SAVE=${jerryscript_jerry_snapshot_save}", 66425bb815Sopenharmony_ci "JERRY_SYSTEM_ALLOCATOR=${jerryscript_jerry_system_allocator}", 67425bb815Sopenharmony_ci "JERRY_VALGRIND=${jerryscript_jerry_valgrind}", 68425bb815Sopenharmony_ci "JERRY_VM_EXEC_STOP=${jerryscript_jerry_vm_exec_stop}", 69425bb815Sopenharmony_ci "JERRY_ES2015=${jerryscript_jerry_es2015}", 70425bb815Sopenharmony_ci "JERRY_ES2015_BUILTIN_TYPEDARRAY=${jerryscript_jerry_es2015_builtin_typedarray}", 71425bb815Sopenharmony_ci "JERRY_ES2015_BUILTIN_SET=${jerryscript_jerry_es2015_builtin_set}", 72425bb815Sopenharmony_ci "JERRY_ES2015_BUILTIN_PROMISE=${jerryscript_jerry_es2015_builtin_promise}", 73425bb815Sopenharmony_ci "JERRY_ES2015_BUILTIN_PROXY=${jerryscript_jerry_es2015_builtin_proxy}", 74425bb815Sopenharmony_ci "JERRY_ES2015_MODULE_SYSTEM=${jerryscript_jerry_es2015_module_system}", 75425bb815Sopenharmony_ci "JERRY_ES2015_BUILTIN_MAP=${jerryscript_jerry_es2015_builtin_map}", 76425bb815Sopenharmony_ci "JERRY_ES2015_BUILTIN_WEAKMAP=${jerryscript_jerry_es2015_builtin_weakmap}", 77425bb815Sopenharmony_ci "JERRY_ES2015_BUILTIN_WEAKSET=${jerryscript_jerry_es2015_builtin_weakset}", 78425bb815Sopenharmony_ci "JERRY_ES2015_BUILTIN_DATAVIEW=${jerryscript_jerry_es2015_builtin_dataview}", 79425bb815Sopenharmony_ci "JERRY_ES2015_BUILTIN_REFLECT=${jerryscript_jerry_es2015_builtin_reflect}", 80425bb815Sopenharmony_ci ] 81425bb815Sopenharmony_ci if (jerryscript_enable_external_context == true) { 82425bb815Sopenharmony_ci defines += [ "JERRY_EXTERNAL_CONTEXT=1" ] 83425bb815Sopenharmony_ci } 84425bb815Sopenharmony_ci defines += [ "INPUTJS_BUFFER_SIZE=${jerryscript_inputjs_buffer_size}" ] 85425bb815Sopenharmony_ci defines += [ "SNAPSHOT_BUFFER_SIZE=${jerryscript_snapshot_buffer_size}" ] 86425bb815Sopenharmony_ci defines += [ "BMS_TASK_HEAP_SIZE=${jerryscript_bms_task_heap_size}" ] 87425bb815Sopenharmony_ci defines += [ "JS_TASK_HEAP_SIZE=${jerryscript_js_task_heap_size}" ] 88425bb815Sopenharmony_ci 89425bb815Sopenharmony_ci include_dirs = jerry_port_default_include_dirs 90425bb815Sopenharmony_ci include_dirs += [ 91425bb815Sopenharmony_ci "${core_path}", 92425bb815Sopenharmony_ci "${core_path}/include", 93425bb815Sopenharmony_ci "${core_path}/api", 94425bb815Sopenharmony_ci "${core_path}/debugger", 95425bb815Sopenharmony_ci "${core_path}/ecma/base", 96425bb815Sopenharmony_ci "${core_path}/ecma/builtin-objects", 97425bb815Sopenharmony_ci "${core_path}/ecma/builtin-objects/typedarray", 98425bb815Sopenharmony_ci "${core_path}/ecma/operations", 99425bb815Sopenharmony_ci "${core_path}/ext", 100425bb815Sopenharmony_ci "${core_path}/jcontext", 101425bb815Sopenharmony_ci "${core_path}/jmem", 102425bb815Sopenharmony_ci "${core_path}/jrt", 103425bb815Sopenharmony_ci "${core_path}/lit", 104425bb815Sopenharmony_ci "${core_path}/parser", 105425bb815Sopenharmony_ci "${core_path}/parser/js", 106425bb815Sopenharmony_ci "${core_path}/parser/regexp", 107425bb815Sopenharmony_ci "${core_path}/vm", 108425bb815Sopenharmony_ci "${port_path}", 109425bb815Sopenharmony_ci "//commonlibrary/utils_lite/memory/include", 110425bb815Sopenharmony_ci ] 111425bb815Sopenharmony_ci } 112425bb815Sopenharmony_ci} 113425bb815Sopenharmony_ci 114425bb815Sopenharmony_ciif (ohos_kernel_type == "liteos_m") { 115425bb815Sopenharmony_ci lite_library("jerry-port-default_static") { 116425bb815Sopenharmony_ci target_type = "static_library" 117425bb815Sopenharmony_ci sources = jerry_port_default_sources 118425bb815Sopenharmony_ci if (board_toolchain_type == "iccarm") { 119425bb815Sopenharmony_ci public_configs = [ ":jerry_port_default_config" ] 120425bb815Sopenharmony_ci } else { 121425bb815Sopenharmony_ci include_dirs = jerry_port_default_include_dirs 122425bb815Sopenharmony_ci } 123425bb815Sopenharmony_ci } 124425bb815Sopenharmony_ci} else { 125425bb815Sopenharmony_ci lite_library("jerry-port-default_shared") { 126425bb815Sopenharmony_ci target_type = "shared_library" 127425bb815Sopenharmony_ci 128425bb815Sopenharmony_ci sources = jerry_port_default_sources 129425bb815Sopenharmony_ci include_dirs = jerry_port_default_include_dirs 130425bb815Sopenharmony_ci } 131425bb815Sopenharmony_ci} 132