Giter VIP home page Giter VIP logo

crt_demo's Introduction

Compiler Repository Toolkit Demonstration

This repository demonstrates how to use the Compiler Repository Toolkit.

Configuration

  • .bazelrc - In order to enable toolchain resolution, this file must contain the following line:

    build --incompatible_enable_cc_toolchain_resolution
    
  • WORKSPACE.bazel - Your workspace file needs to load the crt repository and its dependencies. It must also register the toolchains you want to use.

    load("@crt//config:registration.bzl", "crt_register_toolchains")
    crt_register_toolchains(
        # Choose the toolchains you want:
        arm = True,
        win64 = True,
    )
  • Building software is controlled by constraints. cc_library and cc_binaries can be restricted to certain platforms by use of the target_compatible_with attribute. In order to build software targeted at a particular platform, you can invoke bazel with the --platforms flag:

    bazel build //some:label --platforms=@crt//platforms/arm:cortex_m
  • Platform targets can also be defined using a transition. Transitions cause bazel to evaluate the dependency graph as if a certain configuration were defined. For example, the target_platform rule evaluates the build graph as if --platforms were set to a particular value.

    For example, to build a target for cortex_m:

    target_platform(
        name = "rule-name",
        platform = "@crt//platforms/arm:cortex_m",
        target = "label to a binary artifact",
    )
  • Targets can be executed under a emulation with the runner rule. The runner rule is also a transition rule: it declares the target platform and the execution configuration for that platform.

    For example:

    runner(
        name = "demo",
        binary = ":sieve",
        platform = "@crt//platforms/arm:cortex_m",
        exec_config = "@crt//platforms/arm:qemu",
    )

crt_demo's People

Contributors

cfrantz avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.