Template for Command Line Interface (CLI) tool in C++ using argparse.
# install Command Line Tools (CLT) for Xcode:
xcode-select --install
# install
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# install
brew install cmake
# verify
cmake --version
# install
git clone https://github.com/microsoft/vcpkg "$HOME/vcpkg"
cd $HOME/vcpkg && ./bootstrap-vcpkg.sh
Needed for docs:
brew install doxygen
Install Python version manager pyenv. Also needed for docs:
brew install pyenv
Download and install from Visual Studio Code site.
Open Visual Studio Code and press Cmd + Shift + p
. Select Shell Command: Install 'code' command in PATH
.
Configure project:
source configure.sh
Open the project in Visual Studio Code:
code .
# list presets
cmake --list-presets
# configure and build Debug
cmake --preset Debug
cmake --build --preset Debug
# or to build Release
cmake --preset Release
cmake --build --preset Release
echo "John" > name.txt
./build/Debug/cli-cpp greet name.txt
./build/Debug/cli-cpp greet --language es name.txt
./build/Debug/cli-cpp greet -l bg name.txt
# run via ctest
ctest --preset Debug
ctest --preset Release
# run via GoogleTest
pushd ./build/Debug && ./cli-cpp-test && popd
pushd ./build/Release && ./cli-cpp-test && popd
This installs Sphinx, Breathe, and themes:
source configure-docs.sh
./docs.sh
mkdir -p docs
cd docs
sphinx-quickstart