forked from KhronosGroup/Vulkan-Loader
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BUILD.gn
139 lines (129 loc) · 3.87 KB
/
BUILD.gn
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# Copyright (C) 2018-2019 The ANGLE Project Authors.
# Copyright (C) 2019 LunarG, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
import("//build_overrides/vulkan_loader.gni")
# Fuchsia has non-upstream changes to the vulkan loader, so we don't want
# to build it from upstream sources.
assert(!is_fuchsia)
if (!is_android) {
vulkan_undefine_configs = []
}
if (is_win) {
vulkan_undefine_configs += [
"//build/config/win:nominmax",
"//build/config/win:unicode",
]
}
config("vulkan_internal_config") {
defines = [ "VULKAN_NON_CMAKE_BUILD" ]
if (is_clang || !is_win) {
cflags = [ "-Wno-unused-function" ]
}
if (is_linux || is_mac) {
defines += [
"SYSCONFDIR=\"/etc\"",
"FALLBACK_CONFIG_DIRS=\"/etc/xdg\"",
"FALLBACK_DATA_DIRS=\"/usr/local/share:/usr/share\"",
]
}
}
# Vulkan loader
# -------------
config("vulkan_loader_config") {
include_dirs = [
"loader/generated",
"loader",
]
defines = [
"API_NAME=\"Vulkan\"",
"USE_UNSAFE_FILE_SEARCH=1"
]
if (is_win) {
cflags = [ "/wd4201" ]
}
if (is_linux) {
# assume secure_getenv() is available
defines += [ "HAVE_SECURE_GETENV" ]
}
}
if (!is_android) {
if (vulkan_loader_shared) {
library_type = "shared_library"
} else {
library_type = "static_library"
}
target(library_type, "libvulkan") {
sources = [
"loader/asm_offset.c",
"loader/cJSON.c",
"loader/cJSON.h",
"loader/debug_utils.c",
"loader/debug_utils.h",
"loader/dev_ext_trampoline.c",
"loader/extension_manual.c",
"loader/extension_manual.h",
"loader/gpa_helper.h",
"loader/loader.c",
"loader/loader.h",
"loader/murmurhash.c",
"loader/murmurhash.h",
"loader/phys_dev_ext.c",
"loader/trampoline.c",
# TODO(jmadill): Use assembler where available.
"loader/unknown_ext_chain.c",
"loader/vk_loader_platform.h",
"loader/wsi.c",
"loader/wsi.h",
]
if (is_win) {
output_name = "vulkan-1"
sources += [
"loader/dirent_on_windows.c",
"loader/dirent_on_windows.h",
"loader/dxgi_loader.c",
"loader/dxgi_loader.h",
"loader/vulkan-1.def",
]
if (!is_clang) {
cflags = [
"/wd4054", # Type cast from function pointer
"/wd4055", # Type cast from data pointer
"/wd4100", # Unreferenced formal parameter
"/wd4152", # Nonstandard extension used (pointer conversion)
"/wd4201", # Nonstandard extension used: nameless struct/union
"/wd4214", # Nonstandard extension used: bit field types other than int
"/wd4232", # Nonstandard extension used: address of dllimport is not static
"/wd4305", # Type cast truncation
"/wd4706", # Assignment within conditional expression
"/wd4996", # Unsafe stdlib function
]
}
if (is_clang) {
cflags = [ "-Wno-incompatible-pointer-types" ]
}
libs = [ "Cfgmgr32.lib" ]
}
if (is_mac) {
libs = [ "CoreFoundation.framework" ]
}
public_deps = [
"$vulkan_headers_dir:vulkan_headers",
]
configs -= [ "//build/config/compiler:chromium_code" ]
configs += [ "//build/config/compiler:no_chromium_code" ]
configs += [ ":vulkan_internal_config" ]
public_configs = [ ":vulkan_loader_config" ]
configs -= vulkan_undefine_configs
}
}