linebender / resvg

An SVG rendering library.
Mozilla Public License 2.0
2.79k stars 225 forks source link

Add the cargo-c metadata #812

Closed lu-zero closed 1 month ago

lu-zero commented 1 month 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 1 month ago

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

lu-zero commented 1 month 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 1 month 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 1 month ago

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

RazrFalcon commented 1 month 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 1 month ago

Thanks.