Bazel Updates, Code generation (#1285)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
mwilsnd
2023-07-05 18:41:03 -05:00
committed by Bart Louwers
parent 220d4af7d1
commit 8779aab3bc
8 changed files with 331 additions and 184 deletions

View File

@@ -4,7 +4,7 @@ Applies to objective-c files that can't take the added CPP_FLAGS.
Included in the CPP flags below.
"""
WARNING_FLAGS = [
GCC_CLANG_COMMON_FLAGS = [
"-Wall",
"-Werror",
"-Wextra",
@@ -12,8 +12,52 @@ WARNING_FLAGS = [
"-Wno-unused-variable",
"-Wno-variadic-macros",
"-Wno-unknown-pragmas",
] + select({
"//:ios": [
]
MSVC_FLAGS = [
"/Wall",
"/WX",
"/wd4068", # Unknown pragma
"/wd4820", # Padding
"/wd5045", # Compiler will insert Spectre mitigation for memory load
"/wd4643", # Non-conformant forward decl
"/wd4623", # Default ctor implicitly deleted
"/wd5027", # Default move ctor implicitly deleted
"/wd4626", # Assignment operator implicitly deleted
"/wd4514", # Unreferenced inline function has been removed
"/wd4582", # Constructor is not implicitly called
"/wd4365", # Signed/unsigned mismatch
"/wd4388", # Signed/unsigned mismatch
"/wd4244", # Conversion, possible loss of data
"/wd4242", # Conversion, possible loss of data
"/wd4625", # Copy constructor was implicitly defined as deleted
"/wd5026", # Move constructor was implicitly defined as deleted
"/wd5219", # Implicit conversion, possible loss of data
"/wd5246", # Initialization of a subobject should be wrapped in braces
"/wd4201", # Nonstandard extension used: nameless struct/union
"/wd4868", # Compiler may not enforce left-to-right evaluation order in braced initializer list
"/wd4061", # Eenumerator in switch of enum is not explicitly handled by a case label
"/wd4464", # Relative include path contains '..'
"/wd4668", # <x> is not defined as a preprocessor macro, replacing with '0' for '#if/#elif'
"/wd4800", # Implicit conversion from 'unsigned __int64' to bool. Possible information loss
"/wd4355", # 'this': used in base member initializer list
"/wd5204", # Class has virtual functions, but its trivial destructor is not virtual; instances of objects derived from this class may not be destructed
"/wd5220", # A non-static data member with a volatile qualified type no longer implies
"/wd4619", # (boost) #pragma warning: there is no warning number <x>
"/wd5031", # (boost) #pragma warning(pop): likely mismatch, popping warning state pushed in different file
"/wd5243", # (boost) using incomplete class <x> can cause potential one definition rule violation due to ABI limitation
"/wd4371", # (boost) layout of class may have changed from a previous version of the compiler due to better packing of member <x>
"/wd4435", # (boost) Object layout under /vd2 will change due to virtual base
"/wd4702", # Unreachable code
"/wd4710", # Function not inlined
"/wd5041", # out-of-line definition for constexpr static data member is not needed and is deprecated in C++17
"/wd4946", # reinterpret_cast used between related classes
"/wd4459", # declaration of 'x' hides global declaration
"/wd4373", # virtual function overrides 'x', previous versions of the compiler did not override when parameters only differed by const/volatile qualifiers
]
WARNING_FLAGS = select({
"//:ios": GCC_CLANG_COMMON_FLAGS + [
"-Wno-newline-eof",
"-Wno-nested-anon-types",
"-Wno-c++11-narrowing",
@@ -21,19 +65,35 @@ WARNING_FLAGS = [
"-Wno-tautological-constant-compare",
"-Wno-gnu-anonymous-struct",
],
"//:linux": [],
"//:linux": GCC_CLANG_COMMON_FLAGS,
"//:windows": MSVC_FLAGS,
})
"""
Compilation flags used for all .cpp and .mm targets.
"""
CPP_FLAGS = WARNING_FLAGS + [
GCC_CLANG_CPP_FLAGS = GCC_CLANG_COMMON_FLAGS + [
"-fexceptions",
"-fno-rtti",
"-ftemplate-depth=1024",
"-std=c++17",
]
MSVC_CPP_FLAGS = MSVC_FLAGS + [
"/EHsc",
"/std:c++17",
"/GR-",
"/permissive-",
"/utf-8",
]
CPP_FLAGS = select({
"//:ios": GCC_CLANG_CPP_FLAGS,
"//:linux": GCC_CLANG_CPP_FLAGS,
"//:windows": MSVC_CPP_FLAGS,
})
"""
Compilation flags related to the Maplibre codebase. Relevant for all .cpp .mm and .m code
- src/*
@@ -42,8 +102,15 @@ Compilation flags related to the Maplibre codebase. Relevant for all .cpp .mm an
Not important for any vendors that are imported.
"""
MAPLIBRE_FLAGS = [
"-DMBGL_USE_GLES2=1",
"-DMBGL_RENDER_BACKEND_OPENGL=1",
"-DGLES_SILENCE_DEPRECATION",
]
MAPLIBRE_FLAGS = select({
"//:windows": [
"/DMBGL_USE_GLES2=1",
"/DMBGL_RENDER_BACKEND_OPENGL=1",
"/D_USE_MATH_DEFINES",
],
"//conditions:default": [
"-DMBGL_USE_GLES2=1",
"-DMBGL_RENDER_BACKEND_OPENGL=1",
"-DGLES_SILENCE_DEPRECATION",
]
})