# 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("//foundation/graphic/graphic_2d/graphic_config.gni")
defines = [
  "CROSS_PLATFORM",
  "IOS_PLATFORM",
  "NG_BUILD",
  "PANDA_TARGET_IOS",
  "SK_BUILD_FOR_IOS",
]

js_engines = []
ark_engine = {
  engine_name = "ark"
  engine_path = "jsi"
  engine_defines = [ "USE_ARK_ENGINE" ]
}
js_engines += [ ark_engine ]
build_for_ios = true
build_container_scope_lib = true

use_curl_download = false
use_build_in_js_engine = true
accessibility_support = false
rich_components_support = true
advance_components_support = true
form_components_support = false
js_pa_support = false
connect_server_support = false

napi_support = false
enable_rosen_backend = true
use_external_icu = "static"
pixel_map_support = true
video_components_support = true
use_components_lib = false
web_components_support = true
render_extract_support = true
xcomponent_components_support = true
enable_drag_framework = true
platform_view_support = true
use_platform_font = true
support_touch_target_test = true

cflags_cc = [
  "-std=c++17",
  "-Wno-thread-safety-attributes",
]

if (use_components_lib) {
  defines += [ "USE_COMPONENTS_LIB" ]
}

if (ace_enable_gpu) {
  defines += [ "ACE_ENABLE_GL" ]
}

if (defined(enable_rosen_backend) && enable_rosen_backend) {
  defines += [ "ENABLE_ROSEN_BACKEND" ]
  defines += [ "VIRTUAL_RS_WINDOW" ]
  defines += [ "QUICK_PUSH_TRANSITION" ]
}
platform_deps = [
  "//foundation/arkui/ace_engine/adapter/ios/entrance:ace_ios_entrance",
  "//foundation/arkui/ace_engine/adapter/ios/osal:ace_osal_ios",
  "//foundation/arkui/ace_engine/adapter/ios/stage/ability:stage_ios_entrance",
  "//foundation/arkui/ace_engine/adapter/ios/stage/uicontent:ace_uicontent_ios",
]

libace_target = "//foundation/arkui/ace_engine/adapter/ios/build:arkui_ios"

if (xcomponent_components_support) {
  defines += [ "XCOMPONENT_SUPPORTED" ]
  if (platform_view_support) {
    defines += [ "PLATFORM_VIEW_SUPPORTED" ]
  }
}

if (defined(pixel_map_support) && pixel_map_support) {
  defines += [ "PIXEL_MAP_SUPPORTED" ]
}

if (defined(video_components_support) && video_components_support) {
  defines += [ "VIDEO_SUPPORTED" ]
}

if (defined(web_components_support) && web_components_support) {
  defines += [ "WEB_SUPPORTED" ]
}

if (defined(render_extract_support) && render_extract_support) {
  defines += [ "RENDER_EXTRACT_SUPPORTED" ]
}

if (defined(use_platform_font) && use_platform_font) {
  defines += [ "USE_PLATFORM_FONT" ]
}

if (enable_drag_framework) {
  defines += [ "ENABLE_DRAG_FRAMEWORK" ]
}

if (defined(support_touch_target_test) && support_touch_target_test) {
  defines += [ "SUPPORT_TOUCH_TARGET_TEST" ]
}

if (runtime_mode == "debug") {
  defines += [ "ACE_DEBUG_LOG" ]
}