This is a WIP project, some ideas to be examined:
- Use the 'wiki' tab for misc things ...
- Learn more about github: https://docs.github.com/en/github/using-git/pushing-commits-to-a-remote-repository
- Include Travis + license scan
- See the templates already done by *tista (see my notes)
- Split up the current template in two: one for Optional, another for no optional (mandatory)
- Return pair (all return values there) vs return boolean (just return a bool for a more fluent API, and return other output arguments as part of the function call arguments)
- Return a bool + err description
- Validate callback to do extra work and return value as : return ParseReturn || ValidateReturn
- I am just managing builtins + optional builtins. Next step is vector of builtins + optional vector
- See the 'High order Perl ideas': list of 'things to do' to fix the recursion pattern
- 'likely' and 'unlikely' optimizatoins (with parameter to be use as a hint?)
- Name the current functions with 'builtin'
- Use the libraries for C++ introspection (see my notes) to walk through the fields of the struct
- Explain the dependency with rapidjson
- Have a look at these cmake options to incorporate here:https://github.com/rauhersu/test-cmake-template
- See anl** github for inspiration
konvertjson is a minimal project that's kept deliberately very small. When you build it using CMake/make (see below) it generates:
- A tiny static library
lib/libdivision.a
, - A command line binary
bin/divider
, which links with the library, - An executable unit test
bin/divider_tests
using Google Test library. - An optional BASH build script
build-and-run
that you can use to quickly test if the project compiles, and runs.
$ cmake .
$ make -j12 && make install (this install stuff under '/bin/')
$ ./bin/divider_tests
You will need:
- A modern C/C++ compiler
- CMake 3.1+ installed
First, we need to check out the git repo:
❯ mkdir ~/workspace
❯ cd ~/workspace
❯ git submodule update --init --recursive
❯ git clone https://github.com/rauhersu/konvertjson
❯ cd my-project
❯ bash build-and-run
The script build-and-run
is a short-cut — you shouldn't really be using this script to build your project.
There are three empty folders: lib
, bin
, and include
. Those are populated by make install
.
The rest should be obvious: src
is the sources, and test
is where we put our unit tests.
Now we can build this project:
❯ rm -rf build && mkdir build
❯ git submodule update --init --recursive
❯ cd build
❯ cmake ..
❯ make && make install
❯ cd ..
src/*
— C++ code that ultimately compiles into a librarytest/lib
— C++ libraries used for tests (eg, Google Test)test/src
— C++ test suitebin/
,lib
,include
are all empty directories, until themake install
install the project artifacts there.
Tests:
- Tests compile into a single binary
test/bin/runner
that is run on a command line to run the tests. test/lib
folder with a git submodule intest/lib/googletest
, and possibly other libraries.
Pull Requests are WELCOME! Please submit any fixes or improvements, and I promise to review it as soon as I can at the project URL:
© 2021 Raúl Hernández.
Open sourced under MIT license, the terms of which can be read here — MIT License.
This project uses the CMake Tutorial, and the cmake-project-template.