[bazel] MVP for building GUI related things with bazel (#7934)

Co-authored-by: David Vo <auscompgeek@users.noreply.github.com>
This commit is contained in:
PJ Reiniger
2025-05-12 10:24:41 -04:00
committed by GitHub
parent 0a38400734
commit 0e5a6f38d8
13 changed files with 839 additions and 2 deletions

View File

@@ -0,0 +1,37 @@
load("@rules_cc//cc:defs.bzl", "objc_library")
# These flags are added to match the current native-utils flags in https://github.com/wpilibsuite/native-utils/blob/d8555ca479438c9c08b4a2400a58f280fec90c3f/src/main/java/edu/wpi/first/nativeutils/WPINativeUtilsExtension.java
OBJC_COMPILER_FLAGS = [
"-stdlib=libc++",
"-fPIC",
]
def wpilib_objc_library(
name,
srcs = [],
deps = [],
copts = None,
is_cpp = True,
include_arc = True,
**kwargs):
"""
Helper macro for defining .
Args:
is_cpp: If this is a C++ library. Specifying this will add additional C++ specific compiler flags
include_arc: If true, this will add compiler flags for ARC (Automatic Reference Counting)
"""
copts = copts or []
if is_cpp:
copts.append("-std=c++20")
if include_arc:
copts += ["-fobjc-weak", "-fobjc-arc"]
objc_library(
name = name,
srcs = srcs,
copts = copts + OBJC_COMPILER_FLAGS,
target_compatible_with = ["@platforms//os:osx"],
deps = deps,
**kwargs
)