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 sources += [ "$ACE_LITE_PATH/src/core/context/slite_ace_ability.cpp" ] 67 } 68 69 public_deps = [ 70 "$ACE_LITE_COMMON_PATH:ace_common_lite", 71 "$MODULE_MANAGER_PATH:ace_module_manager_lite", 72 "$NATIVE_ENGINE_PATH:ace_native_engine_lite", 73 "//base/global/i18n_lite/frameworks/i18n:global_i18n", 74 "//base/global/resource_management_lite/frameworks/resmgr_lite:global_resmgr", 75 "//commonlibrary/utils_lite/timer_task:ace_kit_timer", 76 "//foundation/arkui/ui_lite:ui_lite", 77 ] 78 79 defines += ace_lite_common_defines 80 81 if (ohos_kernel_type == "liteos_m") { 82 deps += [ ":gen_syscap_module_native_mini" ] 83 sources += [ "$target_out_dir/syscap_module_native_mini.cpp" ] 84 include_dirs = 85 [ "//base/hiviewdfx/hilog_lite/interfaces/native/kits/hilog_lite" ] 86 public_deps += [ 87 "//build/lite/config/component/cJSON:cjson_static", 88 "//foundation/ability/ability_lite/frameworks/ability_lite:ability", 89 "//third_party/bounds_checking_function:libsec_static", 90 "//third_party/jerryscript:jerry_engine", 91 ] 92 } else { 93 public_deps += [ 94 "//base/startup/init/interfaces/innerkits/syscap:syscap", 95 "//build/lite/config/component/cJSON:cjson_shared", 96 "//third_party/bounds_checking_function:libsec_shared", 97 "//third_party/jerryscript/jerry-core:jerry-core_shared", 98 "//third_party/jerryscript/jerry-ext:jerry-ext_shared", 99 "//third_party/jerryscript/jerry-libm:jerry-libm_shared", 100 "//third_party/jerryscript/jerry-port/default:jerry-port-default_shared", 101 ] 102 103 if (ace_engine_lite_surface_lite_enable) { 104 public_deps += [ "//foundation/graphic/surface_lite:surface_lite" ] 105 } 106 107 if (ace_engine_lite_kv_store_enable) { 108 public_deps += [] 109 } 110 111 if (ace_engine_lite_media_lite_enable) { 112 public_deps += [ 113 "//foundation/multimedia/media_lite/frameworks/player_lite:player_lite", 114 ] 115 } 116 117 if (ace_engine_lite_camera_lite_enable) { 118 public_deps += 119 [ "//foundation/multimedia/camera_lite/frameworks:camera_lite" ] 120 } 121 } 122 123 defines += [ 124 "GRAPHIC_ENABLE_LINECAP_FLAG=1", 125 "GRAPHIC_ENABLE_LINEJOIN_FLAG=1", 126 "GRAPHIC_ENABLE_ELLIPSE_FLAG=1", 127 "GRAPHIC_ENABLE_BEZIER_ARC_FLAG=1", 128 "GRAPHIC_ENABLE_ARC_FLAG=1", 129 "GRAPHIC_ENABLE_ROUNDEDRECT_FLAG=1", 130 "GRAPHIC_ENABLE_DASH_GENERATE_FLAG=1", 131 "GRAPHIC_ENABLE_BLUR_EFFECT_FLAG=1", 132 "GRAPHIC_ENABLE_SHADOW_EFFECT_FLAG=1", 133 "GRAPHIC_ENABLE_GRADIENT_FILL_FLAG=1", 134 "GRAPHIC_ENABLE_PATTERN_FILL_FLAG=1", 135 "GRAPHIC_ENABLE_DRAW_IMAGE_FLAG=1", 136 "GRAPHIC_ENABLE_DRAW_TEXT_FLAG=1", 137 ] 138 139 if (ohos_build_type == "debug") { 140 defines += [ "JS_PROFILER=1" ] 141 } else { 142 defines += [ "JS_PROFILER=0" ] 143 } 144 145 if (LOSCFG_TEST_JS_BUILD) { 146 defines += [ "JSFWK_TEST=1" ] 147 } 148 149 if (enable_ohos_appexecfwk_feature_ability == true) { 150 defines += [ "ABILITY_WINDOW_SUPPORT" ] 151 defines += [ "OHOS_APPEXECFWK_BMS_BUNDLEMANAGER" ] 152 } 153 154 if (enable_ohos_aafwk_multi_tasks_feature == true) { 155 defines += [ "_MINI_MULTI_TASKS_" ] 156 } 157} 158 159# generate syscap_module_native_mini.cpp 160action("gen_syscap_module_native_mini") { 161 ace_tools_root = "//foundation/arkui/ace_engine_lite/frameworks/tools" 162 script = "${ace_tools_root}/syscap/syscap_native_api_src_gen.py" 163 164 args = [ 165 "--syscap-file", 166 rebase_path("${preloader_output_dir}/system/etc/SystemCapability.json"), 167 "--output-file", 168 rebase_path("${target_out_dir}/syscap_module_native_mini.cpp"), 169 ] 170 171 inputs = [ "${preloader_output_dir}/system/etc/SystemCapability.json" ] 172 outputs = [ "${target_out_dir}/syscap_module_native_mini.cpp" ] 173} 174