Platform flattening overhaul (#1393)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Bart Louwers <bart@emeel.net>
This commit is contained in:
mwilsnd
2023-07-26 10:50:34 -05:00
committed by GitHub
parent 1145d0079b
commit 20d9e1028c
932 changed files with 5445 additions and 11714 deletions

View File

@@ -1,27 +1,91 @@
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",
)
# This is defined by both
# platform/default/filesource-files.json
# and
# src/core-files.json
# because they have dependencies on each other
# 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 = glob(
[
"src/**/*.cpp",
"src/**/*.hpp",
],
allow_empty = False,
),
hdrs = glob(
[
"include/**/*.hpp",
],
allow_empty = False,
),
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",
@@ -31,6 +95,8 @@ cc_library(
],
visibility = ["//visibility:public"],
deps = [
":mbgl-core-generated-private-artifacts",
":mbgl-core-generated-public-artifacts",
"//vendor:boost",
"//vendor:csscolorparser",
"//vendor:earcut.hpp",
@@ -46,7 +112,7 @@ cc_library(
"//:ios": [
"//vendor:icu",
],
"//:linux": [],
"//conditions:default": [],
}),
)
@@ -85,6 +151,13 @@ config_setting(
},
)
config_setting(
name = "windows",
flag_values = {
":maplibre_platform": "windows",
},
)
exports_files(
[
"LICENSE.md",