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 = [ 80 "GRAPHIC_ENABLE_LINECAP_FLAG=1", 81 "GRAPHIC_ENABLE_LINEJOIN_FLAG=1", 82 "GRAPHIC_ENABLE_ELLIPSE_FLAG=1", 83 "GRAPHIC_ENABLE_BEZIER_ARC_FLAG=1", 84 "GRAPHIC_ENABLE_ARC_FLAG=1", 85 "GRAPHIC_ENABLE_ROUNDEDRECT_FLAG=1", 86 "GRAPHIC_ENABLE_DASH_GENERATE_FLAG=1", 87 "GRAPHIC_ENABLE_BLUR_EFFECT_FLAG=1", 88 "GRAPHIC_ENABLE_SHADOW_EFFECT_FLAG=1", 89 "GRAPHIC_ENABLE_GRADIENT_FILL_FLAG=1", 90 "GRAPHIC_ENABLE_PATTERN_FILL_FLAG=1", 91 "GRAPHIC_ENABLE_DRAW_IMAGE_FLAG=1", 92 "GRAPHIC_ENABLE_DRAW_TEXT_FLAG=1", 93 ] 94 95 if (ohos_kernel_type == "liteos_m") { 96 deps += [ ":gen_syscap_module_native_mini" ] 97 sources += [ "$target_out_dir/syscap_module_native_mini.cpp" ] 98 include_dirs = 99 [ "//base/hiviewdfx/hilog_lite/interfaces/native/kits/hilog_lite" ] 100 public_deps += [ 101 "//build/lite/config/component/cJSON:cjson_static", 102 "//foundation/ability/ability_lite/frameworks/ability_lite:ability", 103 "//third_party/bounds_checking_function:libsec_static", 104 "//third_party/jerryscript:jerry_engine", 105 ] 106 } else { 107 if (enable_ohos_appexecfwk_feature_ability == true) { 108 defines += [ "ABILITY_WINDOW_SUPPORT" ] 109 defines += [ "OHOS_APPEXECFWK_BMS_BUNDLEMANAGER" ] 110 } 111 public_deps += [ 112 "//base/startup/init/interfaces/innerkits/syscap:syscap", 113 "//build/lite/config/component/cJSON:cjson_shared", 114 "//foundation/graphic/surface_lite:surface_lite", 115 "//foundation/multimedia/camera_lite/frameworks:camera_lite", 116 "//foundation/multimedia/media_lite/frameworks/player_lite:player_lite", 117 "//third_party/bounds_checking_function:libsec_shared", 118 "//third_party/jerryscript/jerry-core:jerry-core_shared", 119 "//third_party/jerryscript/jerry-ext:jerry-ext_shared", 120 "//third_party/jerryscript/jerry-libm:jerry-libm_shared", 121 "//third_party/jerryscript/jerry-port/default:jerry-port-default_shared", 122 ] 123 } 124 125 if (ohos_build_type == "debug") { 126 defines += [ "JS_PROFILER=1" ] 127 } else { 128 defines += [ "JS_PROFILER=0" ] 129 } 130 131 if (LOSCFG_TEST_JS_BUILD) { 132 defines += [ "JSFWK_TEST=1" ] 133 } 134 135 if (enable_ohos_aafwk_multi_tasks_feature == true) { 136 defines += [ "_MINI_MULTI_TASKS_" ] 137 } 138} 139 140# generate syscap_module_native_mini.cpp 141action("gen_syscap_module_native_mini") { 142 ace_tools_root = "//foundation/arkui/ace_engine_lite/frameworks/tools" 143 script = "${ace_tools_root}/syscap/syscap_native_api_src_gen.py" 144 145 args = [ 146 "--syscap-file", 147 rebase_path("${preloader_output_dir}/system/etc/SystemCapability.json"), 148 "--output-file", 149 rebase_path("${target_out_dir}/syscap_module_native_mini.cpp"), 150 ] 151 152 inputs = [ "${preloader_output_dir}/system/etc/SystemCapability.json" ] 153 outputs = [ "${target_out_dir}/syscap_module_native_mini.cpp" ] 154} 155