hzDocs
hzDocs
文章 / 文档hedzr.com首页

cmdr series

介绍 cmdr

Guide

你的首个 CLI app更适合工程实践的版本
循序渐进
基本概念
命令命令:执行外部程序命令:预设参数命令:重定向命令:动态命令清单命令:在配置文件中定义别名清单命令:事件响应函数标志标志:必须项标志:可翻转组标志:枚举值标志:`Head -1` 风格标志:调用外部工具获得输入标志:自动否定标志:加号 `+` 前缀标志:事件响应函数解析结果内建命令和标志帮助子系统可共享共存的 app 实例辨析顶级函数WithOptsBackstage
如何……
Auto-close the ClosersRead config into structUsing is DetectorsUsing Store

References

What's New
Packages

Others

Examples
Blueprint
产品发布
产品发布之前
介绍 cmdr-cxx

Guide

cmdr supports

Intro

Guide

More features

References

Others

evendeep(-go)

Guide

Usagesdeepcopydeepdiffdeepequal
logg/slog(-go)

Guide

Guide

others

Components
trie-cxx

Guide

Guide

links

On Github

Guide

Trie-tree in cxx-17/20

Guide

For Developers

trie-cxx needs a c++-20 compliant compiler such as gcc-13.

From v0.3.1, trie-cxx was compiled passed under macOS (clang), Linux (gcc-13) and Windows (msvc).

CMake Standard

trie-cxx is findable via CMake Modules.

You could install trie-cxx manually:

git clone https://github.com/hedzr/trie-cxx.git
cd trie-cxx
cmake -DCMAKE_VERBOSE_DEBUG=ON -DCMAKE_AUTOMATE_TESTS=OFF -S . -B build/ -G Ninja
# Or:
#    cmake -S . -B build/
cmake --build build/
cmake --install build/
# Or:
#   cmake --build build/ --target install
#
# Sometimes sudo it:
#   sudo cmake --build build/ --target install
# Or:
#   cmake --install build/ --prefix ./dist/install --strip
#   sudo cp -R ./dist/install/include/* /usr/local/include/
#   sudo cp -R ./dist/install/lib/cmake/* /usr/local/lib/cmake/
rm -rf ./build
cd ..

More cmake commands

# clean (all targets files, but the immedieted files)
cmake --build build/ --target clean
# clean and build (just relinking all targets without recompiling)
cmake --build build/ --clean-first

# clean deeply
rm -rf build/

# clean deeply since cmake 3.24.0
# (your custom settings from command-line will lost.
#   For example, if you ever run `cmake -DCMAKE_VERBOSE_DEBUG=ON -S . -B build',
#   and now cmake --fresh -B build/ will ignore `CMAKE_VERBOSE_DEBUG = ON' 
#   and reconfigure to default state.
# )
cmake --fresh -B build/

# recompiling and relinking (simply passing `-B' to `make')
cmake --build build/ -- -B

# reconfigure
rm ./build/CMakeCache.txt && cmake -DENABLE_AUTOMATE_TESTS=OFF -S . -B build/

# print compiling command before exeuting them
cmake --build build/ -- VERBOSE=1
# Or:
VERBOSE=1 cmake --build build/
# Or:
cmake --build build --verbose

# Run CTest
cmake -E chdir build ctest
# Run a special ctest
cmake -E chdir build ctest -R name_of_your_test

detect running in CTest by env var CTEST_INTERACTIVE_DEBUG_MODE:

#include <stdlib.h>
char const *ev1 = getenv("CTEST_INTERACTIVE_DEBUG_MODE");
if (ev1 && (*ev1 == '0' || *ev1 == '1'))
    return 0;

Preparing Catch2 v3.x

for testing, catch2 v3.7+ is necessary.

openSUSE,

sudo zypper install catch2-devel # don't install catch2-2-devel

Ubuntu 22.04/24.04,

git clone -b v3.7.1 https://github.com/catchorg/Catch2.git
cd Catch2
mkdir build
cmake -S . -B build
cmake --build build
cmake --install build --prefix ./dist/install --strip
sudo cp -R ./dist/install/include/* /usr/local/include/
sudo cp -R ./dist/install/lib/cmake/* /usr/local/lib/cmake/

macOS,

brew install catch2

Windows (x86_64)

vcpkg install catch2:x64-windows

If catch2 not installed via package manager, cmake will try downloading it from github and use it as a child target.

What is Next?

Components

Components

On Github

How is this guide?

最后更新于

目录

Guide
For Developers
CMake Standard
More cmake commands
Preparing Catch2 v3.x