Skip to content

terrisgit/K-9ModernCppStarter

Repository files navigation

K-9 Starter Project for Modern C++

Introduction

This is a modern, opinionated, multi-platform, multi-threaded C++11 project that parses JSON files. It is intended for educational purposes and as a starting point for new projects. Go build something awesome in modern C++!

Name

This project is named K-9 because I was thinking about dogs.

License

Apache 2.0

Disclaimer

The author, Terris Linenbach, makes no promises about the contents herein and is not responsible for anything. Use at your own risk. Void where prohibited.

Prerequisites

If you're using OSX, run the 'osx' script. Otherwise, install the following:

Dependencies

Origin

This project was created via the Abseil Bazel Quickstart on March 2019.

Contributions

PR's are welcome. Please obey the .editorconfig file.

Builder

Bazel is IMO the best C++ build tool available today. On the other hand, CMake is the most popular. Nobody appears to be using boost-build besides Boost.

I chose Bazel (by Google) because it works well with Abseil and GoogleTest (also by Google). Although Bazel is tricky to configure, CMake is worse. Bazel is well documented for my needs but beware old examples that use deprecated features.

The hardest part was getting a 2019 version of Bazel working with nlohmann/json, which doesn't use Bazel. I started with https://github.com/nathanws/bazel-examples but it is out date and required literally hours (not days, at least) of trial and error. The WORKSPACE file herein is a working example that will assist you greatly when adding dependencies that don't use Bazel.

Clean

bazel clean --expunge

Run tests

bazel test //:k9-test

Build tests

bazel build -s //:k9-test

Run 'main' executable

Currently just exits

bazel run //:k9 -- arg1 arg2 arg3

VisualStudio Code Configuration

Extensions

  • vscode-bazel
  • C/C++ (Microsoft)
  • C/C++ Advanced Lint
    • See also
    • To disable the warning about flexlint, add this to your settings:
      • "c-cpp-flylint.flexelint.enable": false
  • Clang-Format
  • EditorConfig
  • Rainbow Brackets
  • GitLens
  • Git History

Notes

ToDo

  1. Doxygen-to-HTML
  2. Lint
  3. Automatically format source code
  4. Get rid of the OSX-only warning:
clang: warning: argument unused during compilation: '-pthread'

About

Modern C++ Starter Project

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published