Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions common_settings.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ load("//:distro.bzl", "distro_flag")
def ovms_cc_library(**kwargs):
"""
Wrapper for cc_library that sets default copts and linkopts if not provided.
Transitive defines (PYTHON_DISABLE, MEDIAPIPE_DISABLE) are always set via 'defines'
so that any target depending on an ovms_cc_library automatically gets these macros.
"""
if "copts" not in kwargs:
kwargs["copts"] = COMMON_STATIC_LIBS_COPTS + select({
Expand All @@ -41,10 +43,14 @@ def ovms_cc_library(**kwargs):
})
if "local_defines" not in kwargs:
kwargs["local_defines"] = COMMON_LOCAL_DEFINES
if "defines" not in kwargs:
kwargs["defines"] = COMMON_DEFINES
if "additional_copts" in kwargs:
kwargs["copts"] += kwargs.pop("additional_copts")
if "additional_linkopts" in kwargs:
kwargs["linkopts"] += kwargs.pop("additional_linkopts")
if "additional_local_defines" in kwargs:
kwargs["local_defines"] += kwargs.pop("additional_local_defines")

native.cc_library(
**kwargs
Expand Down Expand Up @@ -235,18 +241,18 @@ COMMON_STATIC_LIBS_LINKOPTS = select({
"/LTCG",
],
})
COPTS_PYTHON = select({
"//conditions:default": ["-DPYTHON_DISABLE=1"],
"//:not_disable_python" : ["-DPYTHON_DISABLE=0"],
})
COPTS_MEDIAPIPE = select({
"//conditions:default": ["-DMEDIAPIPE_DISABLE=1"],
"//:not_disable_mediapipe" : ["-DMEDIAPIPE_DISABLE=0"],
})
COPTS_DROGON = select({
"//conditions:default": ["-DUSE_DROGON=0"],
"//:enable_drogon" : ["-DUSE_DROGON=1"],
})
DEFINES_PYTHON = select({
"//conditions:default": ["PYTHON_DISABLE=1"],
"//:not_disable_python" : ["PYTHON_DISABLE=0"],
})
DEFINES_MEDIAPIPE = select({
"//conditions:default": ["MEDIAPIPE_DISABLE=1"],
"//:not_disable_mediapipe" : ["MEDIAPIPE_DISABLE=0"],
})
COMMON_FUZZER_COPTS = [
"-fsanitize=address",
"-fprofile-generate",
Expand All @@ -259,6 +265,7 @@ COMMON_FUZZER_LINKOPTS = [
"-static-libasan",
]
COMMON_LOCAL_DEFINES = ["SPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_TRACE"]
COMMON_DEFINES = DEFINES_PYTHON + DEFINES_MEDIAPIPE
PYBIND_DEPS = [
"//third_party:python3",
"@pybind11//:pybind11_embed",
Expand Down
Loading