# 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-ext") { if (ohos_kernel_type == "liteos_m") { features = [ ":jerry-ext_static" ] } else { features = [ ":jerry-ext_shared" ] } } jerry_ext_sources = [ "arg/arg-js-iterator-helper.c", "arg/arg-transform-functions.c", "arg/arg.c", "debugger/debugger-common.c", "debugger/debugger-rp.c", "debugger/debugger-serial.c", "debugger/debugger-sha1.c", "debugger/debugger-tcp.c", "debugger/debugger-ws.c", "handle-scope/handle-scope-allocator.c", "handle-scope/handle-scope.c", "handler/handler-assert.c", "handler/handler-gc.c", "handler/handler-print.c", "handler/handler-register.c", "handler/handler-resource-name.c", "module/module.c", ] jerry_ext_include_dirs = [ "include", "debugger", "common", "arg", "handle-scope", "${core_path}/include", ] if (board_toolchain_type == "iccarm") { config("jerry_ext_config") { cflags = [ "--diag_suppress", "Pe940", ] 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_ext_include_dirs include_dirs += [ "${core_path}", "${core_path}/jrt", "//commonlibrary/utils_lite/memory/include", ] } } if (ohos_kernel_type == "liteos_m") { lite_library("jerry-ext_static") { target_type = "static_library" sources = jerry_ext_sources if (board_toolchain_type == "iccarm") { public_configs = [ ":jerry_ext_config" ] } else { include_dirs = jerry_ext_include_dirs } } } else { lite_library("jerry-ext_shared") { target_type = "shared_library" sources = jerry_ext_sources include_dirs = jerry_ext_include_dirs } }