• 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 = [
41    ".",
42    "src",
43  ]
44  if (target_cpu == "arm") {
45    include_dirs += [ "src/aarch32" ]
46  } else if (target_cpu == "arm64" || target_cpu == "amd64" ||
47             target_cpu == "x64" || target_cpu == "x86_64") {
48    include_dirs += [ "src/aarch64" ]
49  }
50}
51
52ohos_static_library("libvixl") {
53  sources = [
54    "src/code-buffer-vixl.cc",
55    "src/compiler-intrinsics-vixl.cc",
56    "src/cpu-features.cc",
57    "src/utils-vixl.cc",
58  ]
59
60  defines = []
61  cflags_cc = [
62    "-std=c++17",
63    "-pedantic",
64    "-Wall",
65    "-Wextra",
66    "-Werror",
67    "-fno-rtti",
68    "-fno-exceptions",
69    "-Wno-invalid-offsetof",
70
71    "-Wno-gnu-statement-expression",
72    "-Wno-unused-parameter",
73    "-Wno-unused-result",
74    "-Wno-deprecated-declarations",
75  ]
76  if (is_debug) {
77    cflags_cc += [
78      "-Og",
79      "-ggdb3",
80      "-gdwarf-4",
81    ]
82  }
83
84  if (is_asan) {
85    cflags_cc += [ "-g" ]
86    defines += [ "__SANITIZE_ADDRESS__" ]
87  }
88
89  if (target_cpu == "arm") {
90    sources += [
91      "src/aarch32/assembler-aarch32.cc",
92      "src/aarch32/constants-aarch32.cc",
93      "src/aarch32/disasm-aarch32.cc",
94      "src/aarch32/instructions-aarch32.cc",
95      "src/aarch32/location-aarch32.cc",
96      "src/aarch32/macro-assembler-aarch32.cc",
97      "src/aarch32/operands-aarch32.cc",
98    ]
99    defines += [ "VIXL_INCLUDE_TARGET_A32" ]
100  } else if (target_cpu == "arm64" || target_cpu == "amd64" ||
101             target_cpu == "x64" || target_cpu == "x86_64") {
102    sources += [
103      "src/aarch64/assembler-aarch64.cc",
104      "src/aarch64/assembler-sve-aarch64.cc",
105      "src/aarch64/cpu-aarch64.cc",
106      "src/aarch64/cpu-features-auditor-aarch64.cc",
107      "src/aarch64/decoder-aarch64.cc",
108      "src/aarch64/disasm-aarch64.cc",
109      "src/aarch64/instructions-aarch64.cc",
110      "src/aarch64/logic-aarch64.cc",
111      "src/aarch64/macro-assembler-aarch64.cc",
112      "src/aarch64/macro-assembler-sve-aarch64.cc",
113      "src/aarch64/operands-aarch64.cc",
114      "src/aarch64/pointer-auth-aarch64.cc",
115      "src/aarch64/simulator-aarch64.cc",
116    ]
117    defines += [
118      "VIXL_INCLUDE_TARGET_A64",
119      "VIXL_INCLUDE_SIMULATOR_AARCH64",
120    ]
121  }
122  if (current_cpu == "arm") {
123    cflags_cc += [
124      "-march=armv7-a",
125      "-mfloat-abi=softfp",
126      "-marm",
127      "-mfpu=vfp",
128    ]
129  }
130
131  if (is_mac) {
132    cflags_cc += [ "-DVIXL_CODE_BUFFER_MALLOC" ]
133  } else {
134    cflags_cc += [ "-DVIXL_CODE_BUFFER_MMAP" ]
135  }
136
137  public_configs = [ ":vixl_public_config" ]
138
139  subsystem_name = "thirdparty"
140  part_name = "vixl"
141}
142