/rules_cc

Wrappers for Bazel's C/C++ rules

Primary LanguagePythonApache License 2.0Apache-2.0

Wrappers for C/C++ rules

Status: This is ALPHA software.

Rules

Overview

This repository contains simple wrappers around the native C/C++ rules provided by Bazel. Using them provides no functional gain over the built-in rules, except that it permits users to substitute the implementation by other (Starlark-based) rules.

Setup

load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")

git_repository(
    name = "io_bazel_rules_cc",
    remote = "https://github.com/bazelbuild/rules_cc.git",
    # NOT VALID!  Replace this with a Git commit SHA.
    commit = "{HEAD}",
)

Then in your BUILD files load the C/C++ rules with:

load(
    "@io_bazel_rules_cc//cc:cc.bzl",
    "cc_binary", "cc_library", "cc_test",
)

cc_binary(
    name = "main",
    ...
)