memononen / nanosvg

Simple stupid SVG parser
zlib License
1.71k stars 363 forks source link

Add CMake build script to the project #209

Closed tamasmeszaros closed 2 years ago

tamasmeszaros commented 2 years ago

Hello there! I'm sending this PR on behalf of the PrusaSlicer team. We are using nanosvg in our software and having trouble with symbol duplication since wxWidgets also started using this library.

Since both our team and the wxWidgets team is using CMake, I've written the CMake build and install scripts to be able to import the library in both projects without duplication issues.

I've also added a short extension to the readme file to address the new integration method.

I know that this goes somewhat against the philosophy of the library to be simple to integrate and the examples already use a different build system but this is the solution we could provide quickly and believe it would have the most widespread acceptance in the community.

tamasmeszaros commented 2 years ago

Related discussion https://github.com/wxWidgets/wxWidgets/pull/22393

memononen commented 2 years ago

@tamasmeszaros I'm willing to merge this if I can summon you to fix the cmake issues in the future :) Would that work for you?

tamasmeszaros commented 2 years ago

Hi @memononen! Thank you, I can handle it for you.

tamasmeszaros commented 2 years ago

It would be good to consider the versioning before merging the PR. What concerns me is this line https://github.com/memononen/nanosvg/pull/209/commits/b21ebe01b8c5f9b58b3fac2024d98a525184ccaf#diff-1e7de1ae2d059d21e1dd75d5812d5a34b0222cef273b7c3a2af62eb747f9d20aR25

Which assumes that this library is at version 1.0 and any matching or newer version is usable as a drop-in. This versioning thing could be omitted but I think it's safer to leave it there and agree on a version now, and maybe even make the compatibility somewhat stricter, (e.g. only matching major versions are compatible). But if you are confident that the library is now finished and will not change much in the future, it's not that big of a deal.

memononen commented 2 years ago

Good point about versions. With the time i have to maintain this project (which is close to zero), it's quite hard to maintain releases. I'm fine with 1.0, and if that allows us to later differentiate incompatible versions, that is great.

bubnikv commented 2 years ago

Great, thanks to all involved!