QuoM是一个用于C/C++库的单头生成器。
Quom的Python项目详细描述
质量
QuoM是C/C++库的单头生成器。
安装
pip install quom
只支持python 3.6+。
工作原理
Quom从库的主头文件开始解析所有本地include。
然后,它试图找到相关的源文件,并将它们放置在特定的缝合位置。
如何使用
usage: quom [-h] [--stitch format] [--include_guard format] [--trim]
input output
Single header generator for C/C++ libraries.
positional arguments:
input Input file path of the main header file.
output Output file path of the generated single header file.
optional arguments:
-h, --help show this help message and exit
--stitch format, -s format
Format of the comment where the source files should be
placed. Default: ~> stitch <~
--include_guard format, -g format
Regex format of the include guard. Default: None
--trim, -t Reduce continuous line breaks to one. Default: True
查看examples folder了解更多信息。
简单示例
项目:
|-src/
| |-foo.hpp
| |-foo.cpp
| -foobar.hpp
|-out/
-foobar_gen.hpp
foo.hpp
#pragma once#ifndef FOOBAR_FOO_HPP#endif FOOBAR_FOO_HPPexternintfoo;#endif
foo.cpp
#include"foo.hpp"intfoo=42;
foobar.hpp
#pragma once#ifndef FOOBAR_HPP#endif FOOBAR_HPP#include"foo.hpp"#endif#ifdef FOO_MAIN// ~> stitch <~#endif
命令:
quom src/foobar.hpp foobar_gen.hpp -g FOOBAR_.+_HPP
结果:
#pragma once#ifndef FOOBAR_HPP#endif FOOBAR_HPPexternintfoo;#endif#ifdef FOO_MAINintfoo=42;#endif