# Copyright (c) 2022 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/lite/config/component/lite_component.gni") import("//third_party/jerryscript/engine.gni") lite_component("jerry-port-default") { if (ohos_kernel_type == "liteos_m") { features = [ ":jerry-port-default_static" ] } else { features = [ ":jerry-port-default_shared" ] } } jerry_port_default_sources = [ "default-date.c", "default-debugger.c", "default-external-context.c", "default-fatal.c", "default-io.c", "default-module.c", ] jerry_port_default_include_dirs = [ "include", "${core_path}/include", ] if (board_toolchain_type == "iccarm") { config("jerry_port_default_config") { cflags = [ "--diag_suppress", "Pe111", ] defines = [ "JERRY_FOR_IAR_CONFIG", "JERRY_DEBUGGER=0", "JERRY_STACK_LIMIT=(8)", "JERRY_IAR_JUPITER", "INPUTJS_BUFFER_SIZE=64*1024", "SNAPSHOT_BUFFER_SIZE=48*1024", ] defines += [ "JERRY_GC_LIMIT=${jerryscript_jerry_gc_limit}", "JERRY_CPOINTER_32_BIT=${jerryscript_jerry_cpointer_32_bit}", "JERRY_ERROR_MESSAGES=${jerryscript_jerry_error_messages}", "JERRY_PARSER=${jerryscript_jerry_parser}", "JERRY_LINE_INFO=${jerryscript_jerry_line_info}", "JERRY_LOGGING=${jerryscript_jerry_logging}", "JERRY_MEM_GC_BEFORE_EACH_ALLOC=${jerryscript_jerry_mem_gc_before_each_alloc}", "JERRY_PARSER_DUMP_BYTE_CODE=${jerryscript_jerry_parser_dump_byte_code}", "JERRY_REGEXP_STRICT_MODE=${jerryscript_jerry_regexp_strict_mode}", "JERRY_REGEXP_DUMP_BYTE_CODE=${jerryscript_jerry_regexp_dump_byte_code}", "JERRY_SNAPSHOT_EXEC=${jerryscript_jerry_snapshot_exec}", "JERRY_SNAPSHOT_SAVE=${jerryscript_jerry_snapshot_save}", "JERRY_SYSTEM_ALLOCATOR=${jerryscript_jerry_system_allocator}", "JERRY_VALGRIND=${jerryscript_jerry_valgrind}", "JERRY_VM_EXEC_STOP=${jerryscript_jerry_vm_exec_stop}", "JERRY_ES2015=${jerryscript_jerry_es2015}", "JERRY_ES2015_BUILTIN_TYPEDARRAY=${jerryscript_jerry_es2015_builtin_typedarray}", "JERRY_ES2015_BUILTIN_SET=${jerryscript_jerry_es2015_builtin_set}", "JERRY_ES2015_BUILTIN_PROMISE=${jerryscript_jerry_es2015_builtin_promise}", "JERRY_ES2015_BUILTIN_PROXY=${jerryscript_jerry_es2015_builtin_proxy}", "JERRY_ES2015_MODULE_SYSTEM=${jerryscript_jerry_es2015_module_system}", "JERRY_ES2015_BUILTIN_MAP=${jerryscript_jerry_es2015_builtin_map}", "JERRY_ES2015_BUILTIN_WEAKMAP=${jerryscript_jerry_es2015_builtin_weakmap}", "JERRY_ES2015_BUILTIN_WEAKSET=${jerryscript_jerry_es2015_builtin_weakset}", "JERRY_ES2015_BUILTIN_DATAVIEW=${jerryscript_jerry_es2015_builtin_dataview}", "JERRY_ES2015_BUILTIN_REFLECT=${jerryscript_jerry_es2015_builtin_reflect}", ] if (jerryscript_enable_external_context == true) { defines += [ "JERRY_EXTERNAL_CONTEXT=1" ] } defines += [ "INPUTJS_BUFFER_SIZE=${jerryscript_inputjs_buffer_size}" ] defines += [ "SNAPSHOT_BUFFER_SIZE=${jerryscript_snapshot_buffer_size}" ] defines += [ "BMS_TASK_HEAP_SIZE=${jerryscript_bms_task_heap_size}" ] defines += [ "JS_TASK_HEAP_SIZE=${jerryscript_js_task_heap_size}" ] include_dirs = jerry_port_default_include_dirs include_dirs += [ "${core_path}", "${core_path}/include", "${core_path}/api", "${core_path}/debugger", "${core_path}/ecma/base", "${core_path}/ecma/builtin-objects", "${core_path}/ecma/builtin-objects/typedarray", "${core_path}/ecma/operations", "${core_path}/ext", "${core_path}/jcontext", "${core_path}/jmem", "${core_path}/jrt", "${core_path}/lit", "${core_path}/parser", "${core_path}/parser/js", "${core_path}/parser/regexp", "${core_path}/vm", "${port_path}", "//commonlibrary/utils_lite/memory/include", ] } } if (ohos_kernel_type == "liteos_m") { lite_library("jerry-port-default_static") { target_type = "static_library" sources = jerry_port_default_sources if (board_toolchain_type == "iccarm") { public_configs = [ ":jerry_port_default_config" ] } else { include_dirs = jerry_port_default_include_dirs } } } else { lite_library("jerry-port-default_shared") { target_type = "shared_library" sources = jerry_port_default_sources include_dirs = jerry_port_default_include_dirs } }