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