1b8021494Sopenharmony_ci# Copyright (c) 2021-2022 Huawei Device Co., Ltd.
2b8021494Sopenharmony_ci#
3b8021494Sopenharmony_ci# Redistribution and use in source and binary forms, with or without
4b8021494Sopenharmony_ci# modification, are permitted provided that the following conditions are met:
5b8021494Sopenharmony_ci#
6b8021494Sopenharmony_ci#   * Redistributions of source code must retain the above copyright notice,
7b8021494Sopenharmony_ci#     this list of conditions and the following disclaimer.
8b8021494Sopenharmony_ci#   * Redistributions in binary form must reproduce the above copyright notice,
9b8021494Sopenharmony_ci#     this list of conditions and the following disclaimer in the documentation
10b8021494Sopenharmony_ci#     and/or other materials provided with the distribution.
11b8021494Sopenharmony_ci#   * Neither the name of ARM Limited nor the names of its contributors may be
12b8021494Sopenharmony_ci#     used to endorse or promote products derived from this software without
13b8021494Sopenharmony_ci#     specific prior written permission.
14b8021494Sopenharmony_ci#
15b8021494Sopenharmony_ci# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS CONTRIBUTORS "AS IS" AND
16b8021494Sopenharmony_ci# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
17b8021494Sopenharmony_ci# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18b8021494Sopenharmony_ci# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
19b8021494Sopenharmony_ci# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20b8021494Sopenharmony_ci# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21b8021494Sopenharmony_ci# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22b8021494Sopenharmony_ci# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23b8021494Sopenharmony_ci# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24b8021494Sopenharmony_ci# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25b8021494Sopenharmony_ci
26b8021494Sopenharmony_ciimport("//build/ohos.gni")
27b8021494Sopenharmony_ci
28b8021494Sopenharmony_ciconfig("vixl_public_config") {
29b8021494Sopenharmony_ci  defines = []
30b8021494Sopenharmony_ci  if (is_debug) {
31b8021494Sopenharmony_ci    defines += [ "VIXL_DEBUG" ]
32b8021494Sopenharmony_ci  }
33b8021494Sopenharmony_ci
34b8021494Sopenharmony_ci  defines += [ "PANDA_BUILD" ]
35b8021494Sopenharmony_ci
36b8021494Sopenharmony_ci  if (defined(ark_standalone_build) && ark_standalone_build) {
37b8021494Sopenharmony_ci    cflags_cc = [ "-Wno-bitwise-instead-of-logical" ]
38b8021494Sopenharmony_ci  }
39b8021494Sopenharmony_ci
40b8021494Sopenharmony_ci  include_dirs = [
41b8021494Sopenharmony_ci    ".",
42b8021494Sopenharmony_ci    "src",
43b8021494Sopenharmony_ci  ]
44b8021494Sopenharmony_ci  if (target_cpu == "arm") {
45b8021494Sopenharmony_ci    include_dirs += [ "src/aarch32" ]
46b8021494Sopenharmony_ci  } else if (target_cpu == "arm64" || target_cpu == "amd64" ||
47b8021494Sopenharmony_ci             target_cpu == "x64" || target_cpu == "x86_64") {
48b8021494Sopenharmony_ci    include_dirs += [ "src/aarch64" ]
49b8021494Sopenharmony_ci  }
50b8021494Sopenharmony_ci}
51b8021494Sopenharmony_ci
52b8021494Sopenharmony_ciohos_static_library("libvixl") {
53b8021494Sopenharmony_ci  sources = [
54b8021494Sopenharmony_ci    "src/code-buffer-vixl.cc",
55b8021494Sopenharmony_ci    "src/compiler-intrinsics-vixl.cc",
56b8021494Sopenharmony_ci    "src/cpu-features.cc",
57b8021494Sopenharmony_ci    "src/utils-vixl.cc",
58b8021494Sopenharmony_ci  ]
59b8021494Sopenharmony_ci
60b8021494Sopenharmony_ci  defines = []
61b8021494Sopenharmony_ci  cflags_cc = [
62b8021494Sopenharmony_ci    "-std=c++17",
63b8021494Sopenharmony_ci    "-pedantic",
64b8021494Sopenharmony_ci    "-Wall",
65b8021494Sopenharmony_ci    "-Wextra",
66b8021494Sopenharmony_ci    "-Werror",
67b8021494Sopenharmony_ci    "-fno-rtti",
68b8021494Sopenharmony_ci    "-fno-exceptions",
69b8021494Sopenharmony_ci    "-Wno-invalid-offsetof",
70b8021494Sopenharmony_ci
71b8021494Sopenharmony_ci    "-Wno-gnu-statement-expression",
72b8021494Sopenharmony_ci    "-Wno-unused-parameter",
73b8021494Sopenharmony_ci    "-Wno-unused-result",
74b8021494Sopenharmony_ci    "-Wno-deprecated-declarations",
75b8021494Sopenharmony_ci  ]
76b8021494Sopenharmony_ci  if (is_debug) {
77b8021494Sopenharmony_ci    cflags_cc += [
78b8021494Sopenharmony_ci      "-Og",
79b8021494Sopenharmony_ci      "-ggdb3",
80b8021494Sopenharmony_ci      "-gdwarf-4",
81b8021494Sopenharmony_ci    ]
82b8021494Sopenharmony_ci  }
83b8021494Sopenharmony_ci
84b8021494Sopenharmony_ci  if (is_asan) {
85b8021494Sopenharmony_ci    cflags_cc += [ "-g" ]
86b8021494Sopenharmony_ci    defines += [ "__SANITIZE_ADDRESS__" ]
87b8021494Sopenharmony_ci  }
88b8021494Sopenharmony_ci
89b8021494Sopenharmony_ci  if (target_cpu == "arm") {
90b8021494Sopenharmony_ci    sources += [
91b8021494Sopenharmony_ci      "src/aarch32/assembler-aarch32.cc",
92b8021494Sopenharmony_ci      "src/aarch32/constants-aarch32.cc",
93b8021494Sopenharmony_ci      "src/aarch32/disasm-aarch32.cc",
94b8021494Sopenharmony_ci      "src/aarch32/instructions-aarch32.cc",
95b8021494Sopenharmony_ci      "src/aarch32/location-aarch32.cc",
96b8021494Sopenharmony_ci      "src/aarch32/macro-assembler-aarch32.cc",
97b8021494Sopenharmony_ci      "src/aarch32/operands-aarch32.cc",
98b8021494Sopenharmony_ci    ]
99b8021494Sopenharmony_ci    defines += [ "VIXL_INCLUDE_TARGET_A32" ]
100b8021494Sopenharmony_ci  } else if (target_cpu == "arm64" || target_cpu == "amd64" ||
101b8021494Sopenharmony_ci             target_cpu == "x64" || target_cpu == "x86_64") {
102b8021494Sopenharmony_ci    sources += [
103b8021494Sopenharmony_ci      "src/aarch64/assembler-aarch64.cc",
104b8021494Sopenharmony_ci      "src/aarch64/assembler-sve-aarch64.cc",
105b8021494Sopenharmony_ci      "src/aarch64/cpu-aarch64.cc",
106b8021494Sopenharmony_ci      "src/aarch64/cpu-features-auditor-aarch64.cc",
107b8021494Sopenharmony_ci      "src/aarch64/debugger-aarch64.cc",
108b8021494Sopenharmony_ci      "src/aarch64/decoder-aarch64.cc",
109b8021494Sopenharmony_ci      "src/aarch64/disasm-aarch64.cc",
110b8021494Sopenharmony_ci      "src/aarch64/instructions-aarch64.cc",
111b8021494Sopenharmony_ci      "src/aarch64/logic-aarch64.cc",
112b8021494Sopenharmony_ci      "src/aarch64/macro-assembler-aarch64.cc",
113b8021494Sopenharmony_ci      "src/aarch64/macro-assembler-sve-aarch64.cc",
114b8021494Sopenharmony_ci      "src/aarch64/operands-aarch64.cc",
115b8021494Sopenharmony_ci      "src/aarch64/pointer-auth-aarch64.cc",
116b8021494Sopenharmony_ci      "src/aarch64/simulator-aarch64.cc",
117b8021494Sopenharmony_ci    ]
118b8021494Sopenharmony_ci    defines += [
119b8021494Sopenharmony_ci      "VIXL_INCLUDE_TARGET_A64",
120b8021494Sopenharmony_ci      "VIXL_INCLUDE_SIMULATOR_AARCH64",
121b8021494Sopenharmony_ci    ]
122b8021494Sopenharmony_ci  }
123b8021494Sopenharmony_ci  if (current_cpu == "arm") {
124b8021494Sopenharmony_ci    cflags_cc += [
125b8021494Sopenharmony_ci      "-march=armv7-a",
126b8021494Sopenharmony_ci      "-mfloat-abi=softfp",
127b8021494Sopenharmony_ci      "-marm",
128b8021494Sopenharmony_ci      "-mfpu=vfp",
129b8021494Sopenharmony_ci    ]
130b8021494Sopenharmony_ci  }
131b8021494Sopenharmony_ci
132b8021494Sopenharmony_ci  if (is_mac) {
133b8021494Sopenharmony_ci    cflags_cc += [ "-DVIXL_CODE_BUFFER_MALLOC" ]
134b8021494Sopenharmony_ci  } else {
135b8021494Sopenharmony_ci    cflags_cc += [ "-DVIXL_CODE_BUFFER_MMAP" ]
136b8021494Sopenharmony_ci  }
137b8021494Sopenharmony_ci
138b8021494Sopenharmony_ci  public_configs = [ ":vixl_public_config" ]
139b8021494Sopenharmony_ci
140b8021494Sopenharmony_ci  subsystem_name = "thirdparty"
141b8021494Sopenharmony_ci  part_name = "vixl"
142b8021494Sopenharmony_ci}
143