forked from maplibre/maplibre-native
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBUILD.bazel
More file actions
167 lines (153 loc) · 4.1 KB
/
Copy pathBUILD.bazel
File metadata and controls
167 lines (153 loc) · 4.1 KB
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
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
load("//bazel:flags.bzl", "CPP_FLAGS", "MAPLIBRE_FLAGS")
load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
load(
"//bazel:core.bzl",
"MLN_CORE_HEADERS",
"MLN_CORE_SOURCE",
"MLN_GENERATED_SHADER_HEADERS",
"MLN_GENERATED_STYLE_SOURCE",
"MLN_OPENGL_HEADERS",
"MLN_OPENGL_SOURCE",
"MLN_PRIVATE_GENERATED_STYLE_HEADERS",
"MLN_PUBLIC_GENERATED_STYLE_HEADERS",
)
# Generate code required by the core
filegroup(
name = "style_data",
srcs = glob(
["**/*.ejs"],
allow_empty = False,
),
)
genrule(
name = "generated_style_code",
srcs = ["style_data"],
outs = MLN_PUBLIC_GENERATED_STYLE_HEADERS +
MLN_PRIVATE_GENERATED_STYLE_HEADERS +
MLN_GENERATED_STYLE_SOURCE,
cmd = "node $(execpath scripts/generate-style-code.js) --root $(RULEDIR)",
tools = ["scripts/generate-style-code.js"],
)
filegroup(
name = "shader_data",
srcs = ["shaders/manifest.json"] + glob(
["shaders/*.glsl"],
allow_empty = False,
),
)
genrule(
name = "generated_shaders",
srcs = ["shader_data"],
outs = MLN_GENERATED_SHADER_HEADERS,
cmd = "node $(execpath shaders/generate_shader_code.js) --root $(RULEDIR)",
tools = ["shaders/generate_shader_code.js"],
)
# This header only target strips the __generated__ prefix for the compiler
# search paths, making the location of generated code transparent to the build
cc_library(
name = "mbgl-core-generated-public-artifacts",
srcs = [],
hdrs = MLN_PUBLIC_GENERATED_STYLE_HEADERS +
MLN_GENERATED_SHADER_HEADERS,
visibility = ["//visibility:public"],
deps = [
":generated_shaders",
":generated_style_code",
],
)
# ditto, but for private headers (under the src/ path)
cc_library(
name = "mbgl-core-generated-private-artifacts",
srcs = [],
hdrs = MLN_PRIVATE_GENERATED_STYLE_HEADERS,
visibility = ["//visibility:private"],
deps = [
":generated_style_code",
],
)
# Generated source is inserted directly into the core target, no need to remove
# the prefix from the path.
cc_library(
name = "mbgl-core",
srcs = MLN_CORE_SOURCE +
MLN_GENERATED_STYLE_SOURCE +
MLN_OPENGL_SOURCE,
hdrs = MLN_CORE_HEADERS +
MLN_OPENGL_HEADERS,
copts = CPP_FLAGS + MAPLIBRE_FLAGS,
defines = select({
"//:ios": ["GLES_SILENCE_DEPRECATION=1"],
"//conditions:default": [],
}),
includes = [
"include",
"src",
],
local_defines = [
r"MLN_VERSION_REV=\"standalone\"",
],
visibility = ["//visibility:public"],
deps = [
":mbgl-core-generated-private-artifacts",
":mbgl-core-generated-public-artifacts",
"//vendor:boost",
"//vendor:csscolorparser",
"//vendor:earcut.hpp",
"//vendor:eternal",
"//vendor:mapbox-base",
"//vendor:parsedate",
"//vendor:polylabel",
"//vendor:protozero",
"//vendor:unique_resource",
"//vendor:vector-tile",
"//vendor:wagyu",
] + select({
"//:ios": [
"//vendor:icu",
],
"//conditions:default": [],
}),
)
genrule(
name = "git_hash",
outs = ["hash"],
cmd = """
git rev-parse HEAD > $@
""",
local = True,
visibility = ["//visibility:public"],
)
# The next three rules are a bit of a hack
# they are needed until rules_apple has platforms support
# https://github.com/bazelbuild/rules_apple/issues/1658
# Allows passing a command line flag to set the Platform
# bazel build [target] --//:maplibre_platform=ios
string_flag(
name = "maplibre_platform",
build_setting_default = "ios",
)
config_setting(
name = "linux",
flag_values = {
":maplibre_platform": "linux",
},
)
config_setting(
name = "ios",
flag_values = {
":maplibre_platform": "ios",
},
)
config_setting(
name = "windows",
flag_values = {
":maplibre_platform": "windows",
},
)
exports_files(
[
"LICENSE.md",
"scripts/style-spec-reference/v8.json",
],
visibility = ["//visibility:public"],
)