xref: /aosp_15_r20/external/swiftshader/Android.bp (revision 03ce13f70fcc45d86ee91b7ee4cab1936a95046e)
1//
2// Copyright (C) 2018 The Android Open Source Project
3//
4// Licensed under the Apache License, Version 2.0 (the "License");
5// you may not use this file except in compliance with the License.
6// You may obtain a copy of the License at
7//
8//      http://www.apache.org/licenses/LICENSE-2.0
9//
10// Unless required by applicable law or agreed to in writing, software
11// distributed under the License is distributed on an "AS IS" BASIS,
12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13// See the License for the specific language governing permissions and
14// limitations under the License.
15//
16
17package {
18    default_applicable_licenses: ["external_swiftshader_license"],
19}
20
21// Added automatically by a large-scale-change that took the approach of
22// 'apply every license found to every target'. While this makes sure we respect
23// every license restriction, it may not be entirely correct.
24//
25// e.g. GPL in an MIT project might only apply to the contrib/ directory.
26//
27// Please consider splitting the single license below into multiple licenses,
28// taking care not to lose any license_kind information, and overriding the
29// default license using the 'licenses: [...]' property on targets as needed.
30//
31// For unused files, consider creating a 'filegroup' with "//visibility:private"
32// to attach the license to, and including a comment whether the files may be
33// used in the current project.
34//
35// large-scale-change filtered out the below license kinds as false-positives:
36//   SPDX-license-identifier-GPL
37//   SPDX-license-identifier-GPL-3.0
38// http://go/android-license-faq
39license {
40    name: "external_swiftshader_license",
41    visibility: [":__subpackages__"],
42    license_kinds: [
43        "SPDX-license-identifier-Apache-2.0",
44        "SPDX-license-identifier-BSD",
45        "SPDX-license-identifier-MIT",
46        "SPDX-license-identifier-NCSA",
47        "legacy_unencumbered",
48    ],
49    license_text: [
50        "LICENSE.txt",
51    ],
52}
53
54cc_defaults {
55    name: "swiftshader_common",
56
57    gnu_extensions: false,
58
59    cflags: [
60        "-Werror",
61        "-Wwrite-strings",
62    ],
63
64    cppflags: [
65        "-Woverloaded-virtual",
66        "-DVK_EXPORT= ",
67    ],
68
69    arch: {
70        x86: {
71            cflags: [
72                "-msse2",
73            ],
74        },
75        x86_64: {
76            cflags: [
77                "-msse2",
78            ],
79        },
80    },
81
82    target: {
83        android: {
84            cppflags: [
85                "-DVK_USE_PLATFORM_ANDROID_KHR",
86            ],
87        },
88        host: {
89            cppflags: [
90                "-fno-rtti",
91                "-fno-exceptions",
92            ],
93            compile_multilib: "64",
94        },
95
96        // We don't need Darwin host-side builds
97        darwin: {
98            enabled: false,
99        },
100    },
101}
102
103cc_defaults {
104    name: "swiftshader_common_release",
105
106    defaults: [ "swiftshader_common" ],
107
108    cflags: [
109        "-Os",
110        "-fomit-frame-pointer",
111        "-ffunction-sections",
112        "-fdata-sections",
113    ],
114}
115
116cc_defaults {
117    name: "swiftshader_common_debug",
118
119    defaults: [ "swiftshader_common" ],
120
121    cflags: [
122        "-O0",
123        "-g",
124        "-UNDEBUG",
125    ],
126}
127
128cc_library_headers {
129    name: "swiftshader_platform_headers",
130    host_supported: true,
131    device_supported: true,
132    vendor_available: true,
133    export_include_dirs: ["include"],
134}
135
136cc_library_headers {
137    name: "swiftshader_host_headers",
138    device_supported: false,
139    host_supported: true,
140    export_include_dirs: ["include/Android"],
141}
142