Git Product home page Git Product logo

example-9's Introduction

Overview

This is an example C++ project which uses the gflags library for the parsing of the command-line flags. It demonstrates the use of either Bazel or CMake for the build of the project where the source code of the gflags library is optionally directly included in the example project's source tree using the Git submodule command. When the submodule is not initialized, an external installation of the gflags library is required instead.

Download

Use the git clone command to download this gflags example project:

git clone --depth=1 https://github.com/gflags/example.git gflags-example
cd gflags-example

When gflags should be build as subproject of the example which does not require an external installation of the gflags library, run the following command in the top-level directory of the local Git repository after the clone command. This is only recommended when CMake is used for the build configuration and no separate gflags installation is available.

git submodule update --init

Build with CMake and GNU Make

Create a build directory inside the example project directory and configure the build using CMake to generate the Makefiles for GNU Make:

mkdir build && cd build
cmake -D CMAKE_BUILD_TYPE=Release ..

Then build the example executable named "foo" using GNU Make:

make foo

The resulting binary is bin/foo inside the build directory.

Build with Bazel

The Bazel build tool uses the information in the WORKSPACE file to download and build the gflags library prior to the example binary. To build the example executable target named "foo", run the following command in the top level directory of the gflags example project which contains the WORKSPACE file. This will clone the gflags project and build the gflags library prior to the example executable upon first invocation. Bazel is caching the build files of the external gflags dependency and will not rebuild gflags when the foo/foo.cc file changes.

bazel build foo

The resulting binary is bazel-bin/foo/foo inside the workspace directory.

example-9's People

Contributors

akagi201 avatar schuhschuh 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.