• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2016 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("../../swiftshader.gni")
16
17# Need a separate config to ensure the warnings are added to the end.
18config("swiftshader_libGLESv2_private_config") {
19  defines = [
20    "GL_API=",
21    "GL_GLEXT_PROTOTYPES",
22  ]
23
24  if (is_win) {
25    cflags = [
26      "/wd4201",  # nameless struct/union
27      "/wd4324",  # structure was padded due to alignment specifier
28      "/wd5030",  # attribute is not recognized
29    ]
30
31    defines += [ "GL_APICALL=" ]
32
33    if (is_clang) {
34      defines += [
35        "__STDC_CONSTANT_MACROS",
36        "__STDC_LIMIT_MACROS",
37      ]
38    }
39  } else {
40    cflags = [ "-Wno-sign-compare" ]
41    if (!is_clang) {
42      cflags += [ "-Wno-unused-but-set-variable" ]
43    }
44
45    defines += [
46      "__STDC_CONSTANT_MACROS",
47      "__STDC_LIMIT_MACROS",
48      "GL_APICALL=__attribute__((visibility(\"default\"))) __attribute__((no_sanitize(\"function\")))",
49    ]
50  }
51}
52
53swiftshader_shared_library("swiftshader_libGLESv2") {
54  if (!is_mac) {
55    output_name = "libGLESv2"
56    output_dir = "$root_out_dir/swiftshader"
57  }
58
59  deps = [
60    "../../OpenGL/compiler:swiftshader_opengl_compiler",
61    "../../Reactor:swiftshader_reactor",
62    "../../Renderer:swiftshader_renderer",
63    "//build/config:exe_and_shlib_deps",
64  ]
65
66  sources = [
67    "Buffer.cpp",
68    "Context.cpp",
69    "Device.cpp",
70    "Fence.cpp",
71    "Framebuffer.cpp",
72    "IndexDataManager.cpp",
73    "Program.cpp",
74    "Query.cpp",
75    "Renderbuffer.cpp",
76    "ResourceManager.cpp",
77    "Shader.cpp",
78    "Texture.cpp",
79    "TransformFeedback.cpp",
80    "VertexArray.cpp",
81    "VertexDataManager.cpp",
82    "libGLESv2.cpp",
83    "libGLESv2.def",
84    "libGLESv2.rc",
85    "libGLESv3.cpp",
86    "main.cpp",
87    "resource.h",
88    "utilities.cpp",
89  ]
90
91  if (is_win) {
92    ldflags = [ "/DEF:" + rebase_path("libGLESv2.def", root_build_dir) ]
93  } else if (is_mac) {
94    ldflags = [ "-Wl,-install_name,@rpath/libswiftshader_libGLESv2.dylib" ]
95  } else if (is_linux) {
96    ldflags =
97        [ "-Wl,--version-script=" + rebase_path("exports.map", root_build_dir) ]
98  }
99
100  configs = [ ":swiftshader_libGLESv2_private_config" ]
101
102  include_dirs = [
103    "../../../include",
104    "../..",
105    "..",
106  ]
107}
108