1#Copyright (c) 2020-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("//build/lite/config/subsystem/aafwk/config.gni") 16import("//foundation/arkui/ace_engine_lite/ace_lite.gni") 17 18defines = [] 19 20declare_args() { 21 LOSCFG_TEST_JS_BUILD = false 22} 23 24lite_component("jsfwk") { 25 features = [ ":ace_lite" ] 26} 27 28config("ace_lite_config") { 29 include_dirs = ace_lite_include_dirs 30 defines += [ "FEATURE_COMPONENT_TEXT_SPANNABLE=0" ] 31 if (defined(board_toolchain_type) && board_toolchain_type == "iccarm") { 32 cflags = [ 33 "--diag_suppress", 34 "Pe111,Pa137,Pe177,Pa205,Pe226,Pe366,Pe367", 35 ] 36 cflags_cc = cflags 37 } else { 38 cflags_cc = [ "-std=c++14" ] 39 } 40 ldflags = [ "-lstdc++" ] 41 42 if (ohos_kernel_type == "liteos_m") { 43 ldflags += [ "-lposix" ] 44 } else { 45 ldflags += [ "-lpthread" ] 46 ldflags += [ "-Wl,-rpath-link=$ohos_root_path/$root_out_dir" ] 47 } 48} 49 50lite_library("ace_lite") { 51 if (ohos_kernel_type == "liteos_m") { 52 target_type = "static_library" 53 } else { 54 target_type = "shared_library" 55 } 56 57 deps = [ "targets" ] 58 public_configs = [ ":ace_lite_config" ] 59 60 sources = ace_lite_sources 61 if (ohos_kernel_type == "liteos_m") { 62 sources -= [ 63 "$ACE_LITE_PATH/src/core/context/ace_ability.cpp", 64 "$ACE_LITE_PATH/src/core/modules/dfx_module.cpp", 65 ] 66 } 67 68 public_deps = [ 69 "$ACE_LITE_COMMON_PATH:ace_common_lite", 70 "$MODULE_MANAGER_PATH:ace_module_manager_lite", 71 "$NATIVE_ENGINE_PATH:ace_native_engine_lite", 72 "//base/global/i18n_lite/frameworks/i18n:global_i18n", 73 "//base/global/resource_management_lite/frameworks/resmgr_lite:global_resmgr", 74 "//commonlibrary/utils_lite/timer_task:ace_kit_timer", 75 "//foundation/graphic/ui:lite_ui", 76 ] 77 78 if (ohos_kernel_type == "liteos_m") { 79 deps += [ ":gen_syscap_module_native_mini" ] 80 sources += [ "$target_out_dir/syscap_module_native_mini.cpp" ] 81 include_dirs = 82 [ "//base/hiviewdfx/hilog_lite/interfaces/native/kits/hilog_lite" ] 83 public_deps += [ 84 "//build/lite/config/component/cJSON:cjson_static", 85 "//third_party/bounds_checking_function:libsec_static", 86 "//third_party/jerryscript:jerry_engine", 87 ] 88 } else { 89 public_deps += [ 90 "//base/startup/init/interfaces/innerkits/syscap:syscap", 91 "//build/lite/config/component/cJSON:cjson_shared", 92 "//foundation/graphic/surface:lite_surface", 93 "//foundation/multimedia/camera_lite/frameworks:camera_lite", 94 "//foundation/multimedia/media_lite/frameworks/player_lite:player_lite", 95 "//third_party/bounds_checking_function:libsec_shared", 96 "//third_party/jerryscript/jerry-core:jerry-core_shared", 97 "//third_party/jerryscript/jerry-ext:jerry-ext_shared", 98 "//third_party/jerryscript/jerry-libm:jerry-libm_shared", 99 "//third_party/jerryscript/jerry-port/default:jerry-port-default_shared", 100 ] 101 } 102 defines = [ 103 "GRAPHIC_ENABLE_LINECAP_FLAG=1", 104 "GRAPHIC_ENABLE_LINEJOIN_FLAG=1", 105 "GRAPHIC_ENABLE_ELLIPSE_FLAG=1", 106 "GRAPHIC_ENABLE_BEZIER_ARC_FLAG=1", 107 "GRAPHIC_ENABLE_ARC_FLAG=1", 108 "GRAPHIC_ENABLE_ROUNDEDRECT_FLAG=1", 109 "GRAPHIC_ENABLE_DASH_GENERATE_FLAG=1", 110 "GRAPHIC_ENABLE_BLUR_EFFECT_FLAG=1", 111 "GRAPHIC_ENABLE_SHADOW_EFFECT_FLAG=1", 112 "GRAPHIC_ENABLE_GRADIENT_FILL_FLAG=1", 113 "GRAPHIC_ENABLE_PATTERN_FILL_FLAG=1", 114 "GRAPHIC_ENABLE_DRAW_IMAGE_FLAG=1", 115 "GRAPHIC_ENABLE_DRAW_TEXT_FLAG=1", 116 ] 117 118 if (ohos_build_type == "debug") { 119 defines += [ "JS_PROFILER=1" ] 120 } else { 121 defines += [ "JS_PROFILER=0" ] 122 } 123 124 if (LOSCFG_TEST_JS_BUILD) { 125 defines += [ "JSFWK_TEST=1" ] 126 } 127 128 if (enable_ohos_appexecfwk_feature_ability == true) { 129 defines += [ "ABILITY_WINDOW_SUPPORT" ] 130 defines += [ "OHOS_APPEXECFWK_BMS_BUNDLEMANAGER" ] 131 } 132} 133 134# generate syscap_module_native_mini.cpp 135action("gen_syscap_module_native_mini") { 136 ace_tools_root = "//foundation/arkui/ace_engine_lite/frameworks/tools" 137 script = "${ace_tools_root}/syscap/syscap_native_api_src_gen.py" 138 139 args = [ 140 "--syscap-file", 141 rebase_path("${preloader_output_dir}/system/etc/SystemCapability.json"), 142 "--output-file", 143 rebase_path("${target_out_dir}/syscap_module_native_mini.cpp"), 144 ] 145 146 inputs = [ "${preloader_output_dir}/system/etc/SystemCapability.json" ] 147 outputs = [ "${target_out_dir}/syscap_module_native_mini.cpp" ] 148} 149