Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Bart Louwers <bart@emeel.net>
168 lines
4.1 KiB
Python
168 lines
4.1 KiB
Python
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"],
|
|
)
|