linebender / resvg

An SVG rendering library.
Apache License 2.0
2.84k stars 229 forks source link

Add the cargo-c metadata #812

Closed lu-zero closed 2 months ago

lu-zero commented 2 months ago

Fixes #592

The default cargo cinstall --destdir some/path produces on macos:

└── usr
    └── local
        ├── include
        │   └── resvg
        │       └── resvg.h
        └── lib
            ├── libresvg.0.43.0.dylib
            ├── libresvg.0.43.dylib -> libresvg.0.43.0.dylib
            ├── libresvg.a
            ├── libresvg.dylib -> libresvg.0.43.0.dylib
            └── pkgconfig
                └── resvg.pc
RazrFalcon commented 2 months ago

Can you elaborate what cinstall is and how it should be used?

lu-zero commented 2 months ago

It is part of cargo-c, it builds and install the C-API crate as a normal C-library (both static and shared) including the pkg-config file.

It uses the metadata I added to Cargo.toml to find the crate(s) that should be made libraries and optionally generates the C header or install pre-made ones.

RazrFalcon commented 2 months ago

Can you add a note about it to crates/c-api/README.md? So people would know how to use it. I don't want to add a random stuff to Cargo.toml. Since it will only confuse people.

lu-zero commented 2 months ago

Here an update with another commit to convert the example to use the uninstalled pkg-config.

RazrFalcon commented 2 months ago

This time it's too much. Most people should still use just a regular cargo build. Let's keep just the Cargo.toml changes. I will update the readme later.

RazrFalcon commented 2 months ago

Thanks.