xref: /aosp_15_r20/external/swiftshader/third_party/marl/BUILD.gn (revision 03ce13f70fcc45d86ee91b7ee4cab1936a95046e)
1# Copyright 2019 The SwiftShader Authors. All Rights Reserved.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#    http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15import("../../src/swiftshader.gni")
16
17import("//testing/test.gni")
18
19config("marl_config") {
20  include_dirs = [ "include" ]
21  if (!is_win) {
22    defines = [ "MARL_USE_PTHREAD_THREAD_LOCAL=1" ]
23  }
24}
25
26swiftshader_source_set("Marl_headers") {
27  sources = [
28    "include/marl/blockingcall.h",
29    "include/marl/conditionvariable.h",
30    "include/marl/containers.h",
31    "include/marl/debug.h",
32    "include/marl/defer.h",
33    "include/marl/event.h",
34    "include/marl/finally.h",
35    "include/marl/memory.h",
36    "include/marl/mutex.h",
37    "include/marl/parallelize.h",
38    "include/marl/pool.h",
39    "include/marl/sanitizers.h",
40    "include/marl/scheduler.h",
41    "include/marl/task.h",
42    "include/marl/thread.h",
43    "include/marl/ticket.h",
44    "include/marl/trace.h",
45    "include/marl/tsa.h",
46    "include/marl/waitgroup.h",
47  ]
48
49  public_configs = [ ":marl_config" ]
50}
51
52swiftshader_source_set("Marl") {
53  sources = [
54    "src/debug.cpp",
55    "src/memory.cpp",
56    "src/scheduler.cpp",
57    "src/thread.cpp",
58    "src/trace.cpp",
59  ]
60
61  if (!is_win) {
62    if (current_cpu == "arm64") {
63      sources += [
64        "src/osfiber_aarch64.c",
65        "src/osfiber_asm_aarch64.h",
66        "src/osfiber_asm_aarch64.S",
67      ]
68    } else if (current_cpu == "arm") {
69      sources += [
70        "src/osfiber_arm.c",
71        "src/osfiber_asm_arm.h",
72        "src/osfiber_asm_arm.S",
73      ]
74    } else if (current_cpu == "mips64") {
75      sources += [
76        "src/osfiber_mips64.c",
77        "src/osfiber_asm_mips64.h",
78        "src/osfiber_asm_mips64.S",
79      ]
80    } else if (current_cpu == "ppc64") {
81      sources += [
82        "src/osfiber_ppc64.c",
83        "src/osfiber_asm_ppc64.h",
84        "src/osfiber_asm_ppc64.S",
85      ]
86    } else if (current_cpu == "riscv64") {
87      sources += [
88        "src/osfiber_rv64.c",
89        "src/osfiber_asm_rv64.h",
90        "src/osfiber_asm_rv64.S",
91      ]
92    } else if (current_cpu == "loong64") {
93      sources += [
94        "src/osfiber_loongarch64.c",
95        "src/osfiber_asm_loongarch64.h",
96        "src/osfiber_asm_loongarch64.S",
97      ]
98    } else if (current_cpu == "x64") {
99      sources += [
100        "src/osfiber_x64.c",
101        "src/osfiber_asm_x64.h",
102        "src/osfiber_asm_x64.S",
103      ]
104    } else if (current_cpu == "x86") {
105      sources += [
106        "src/osfiber_x86.c",
107        "src/osfiber_asm_x86.h",
108        "src/osfiber_asm_x86.S",
109      ]
110    } else {
111      assert(false, "Unhandled value for current-cpu=" + current_cpu)
112    }
113  }
114
115  public_deps = [ ":Marl_headers" ]
116}
117