compat.nanosvg
#includeNanoSVG — small SVG parser that flattens paths to beziers, with an optional rasterizer
#include <nanosvg.h>
mcpp add compat.nanosvg@2026.07.09
用法
来自本仓库自己的测试项目 —— CI 真的编译并运行过,不是为了网站写的。
// compat.nanosvg — parse a real SVG document and rasterize it.
//
// This asserts three separate things the package must get right:
// 1. `<nanosvg.h>` / `<nanosvgrast.h>` resolve (include_dirs points at src/),
// 2. the parser's output is real geometry, not an empty image, and
// 3. the generated implementation TU is actually linked -- BOTH halves of it.
// nsvgParse comes from nanosvg.h's implementation and nsvgRasterize from
// nanosvgrast.h's, so if the package only instantiated one of the two this
// test fails at link time rather than silently passing.
#include <nanosvg.h>
#include <nanosvgrast.h>
import std;
int main() {
bool ok = true;
auto check = [&](bool cond, std::string_view what) {
if (!cond) {
std::println("FAIL: {}", what);
ok = false;
}
};
// …
tests/examples/nanosvg/tests/parse.cpp · 项目 tests/examples/nanosvg
构建
- targets
nanosvg (lib)- language
c++23- C standard
c11- import std
- no
- include dirs
*/src
源文件 (1)
mcpp_generated/nanosvg_impl.c
生成的文件
mcpp_generated/nanosvg_impl.c