1# Copyright (c) 2024 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("//foundation/arkui/ace_engine/ace_config.gni")
15
16platform_config = {
17  is_ohos = true
18  common_defines = []
19  common_deps = []
20}
21
22if (current_os != "ohos") {
23  platform_config.is_ohos = false
24  platform_config.common_defines += [ "_NON_OHOS_" ]
25  if (current_os == "mingw") {
26    platform_config.common_deps +=
27        [ "$ace_root/adapter/preview/build:libace_engine_windows" ]
28    platform_config.common_defines += [
29      "WINDOWS_PLATFORM",
30      "PREVIEW",
31    ]
32  } else if (current_os == "linux") {
33    platform_config.common_deps +=
34        [ "$ace_root/adapter/preview/build:libace_engine_linux" ]
35    platform_config.common_defines += [ "PREVIEW" ]
36  } else {
37    assert(false && "platform not supported: ${current_os}")
38  }
39} else {
40  cfg = {
41    import("//foundation/arkui/ace_engine/adapter/ohos/build/config.gni")
42  }
43  platform_config.common_deps += [ "$ace_root/build:libace_compatible" ]
44  platform_config.common_defines += cfg.defines
45}
46
47cj_config = {
48  platform_name = ""
49  platform_target = ""
50  shared_lib_prefix = "so"
51  is_previewer = false
52  common_defines = []
53}
54
55if (current_os == "ohos") {
56  cj_config.platform_name = "ohos"
57  cj_config.shared_lib_prefix = "so"
58  cj_config.platform_target = "linux_ohos_aarch64_llvm"
59  cj_config.common_defines = [
60    "__DSU__",
61    "__OHOS__",
62  ]
63} else if (current_os == "linux") {
64  cj_config.platform_name = "linux"
65  cj_config.shared_lib_prefix = "so"
66  cj_config.platform_target = "linux_x86_64_llvm"
67} else if (current_os == "mingw") {
68  cj_config.platform_name = "windows"
69  cj_config.shared_lib_prefix = "dll"
70  cj_config.platform_target = "windows_x86_64_llvm"
71  cj_config.is_previewer = true
72  cj_config.common_defines = [ "__WINDOWS__" ]
73}
74