mity / md4c

C Markdown parser. Fast. SAX-like interface. Compliant to CommonMark specification.
MIT License
755 stars 138 forks source link

Add build.zig #254

Open fjebaker opened 2 months ago

fjebaker commented 2 months ago

Hi! md4c is brilliant and I am using it in some of my little Zig projects. To make my life easier, I forked and added a build.zig so that it's easy for my Zig projects to use md4c.

I thought I might contribute it back, as other Zig users might also be interested in making their lives a little easier too. I wrote the script so that it mimics the CMake build.

You can then build md4c with

zig build

or build md2html with

zig build md2html

This will compile the following

zig-out
├── bin
│   └── md2html
├── include
│   └── md4c.h
└── lib
    ├── libmd4c.so -> libmd4c.so.0
    ├── libmd4c.so.0 -> libmd4c.so.0.4.8
    └── libmd4c.so.0.4.8

In using Zig, you get easy cross-compilation for free too :)

Hope this is useful, and thanks for the fantastic library!