cc_project_template_cmake

A cmake, ninja, and googletest-based C++ project template
git clone https://git.bracken.jp/cc_project_template_cmake.git
Log | Files | Refs | Submodules | README | LICENSE

README.md (1154B)


      1 ProjectTemplate
      2 ===============
      3 
      4 A [cmake](https://cmake.org),
      5 [ninja](https://github.com/ninja-build/ninja), and
      6 [googletest](https://github.com/google/googletest)-based C++ project template.
      7 
      8 
      9 Prerequisites
     10 -------------
     11 
     12 To build, you'll need [cmake](https://cmake.org),
     13 [ninja](https://github.com/ninja-build/ninja), and a clang build toolchain
     14 installed on your system.
     15 
     16 
     17 Obtaining the source
     18 --------------------
     19 
     20 First, clone the repo. Then, initialise and fetch git submodules:
     21 
     22     # Initialise local configuration file.
     23     git submodule init
     24 
     25     # Fetch submodules (googletest).
     26     git submodule update
     27 
     28 
     29 Updating git submodules
     30 -----------------------
     31 
     32 To update the git submodules to a newer commit, simply run:
     33 
     34     git submodule update --remote
     35 
     36 
     37 Building and running
     38 --------------------
     39 
     40 First, generate the ninja build files:
     41 
     42     # For debug build:
     43     cmake -DCMAKE_BUILD_TYPE=Debug -GNinja
     44 
     45     # For release build:
     46     cmake -DCMAKE_BUILD_TYPE=Release -GNinja
     47 
     48 
     49 ### Unit tests
     50 
     51 To build and run the unit tests, run:
     52 
     53     ninja
     54     ./bin/libfoo_tests
     55 
     56 
     57 ### Executable binary
     58 
     59 To build and run the binary:
     60 
     61     ninja
     62     ./bin/main