Code Monkey home page Code Monkey logo

hello-bazel's Introduction

Mac OS/Linux
Build Status

Use Bazel for C++ Programming

I find that Bazel is pretty handy for C++ programming and this repository contains some sample code about Bazel during the learning process.

It can be used as a template for later development.

Install Bazel

Go to https://github.com/bazelbuild/bazel/releases and download a .sh file for the corresponding platform.

For example,

wget https://github.com/bazelbuild/bazel/releases/download/0.20.0/bazel-0.20.0-installer-darwin-x86_64.sh
chmod +x bazel-0.20.0-installer-darwin-x86_64.sh
./bazel-0.20.0-installer-darwin-x86_64.sh --user
export PATH=$HOME/bin:${PATH}

To view the current version, run bazel version.

Commandline Completion

When bazel is installed to $HOME/bin, a file named bazel-complete.bash is installed to $HOME/.bazel/bin simultaneously.

Add the following line to $HOME/.bash_profile (macOS) or to $HOME/.bashrc (Linux):

source $HOME/.bazel/bin/bazel-complete.bash

Auto Format BUILD files

Refer to https://github.com/bazelbuild/buildtools/blob/master/buildifier/README.md.

A quick guide is as follows:

go get github.com/bazelbuild/buildtools/buildifier
cd $HOME/go/src/github.com/bazelbuild/buildtools/buildifier
bazel build //buildifier
export PATH=$HOME/go/bin:${PATH}

hello-bazel's People

Contributors

csu-fangjun avatar

Watchers

 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.