MikeLankamp / fpm

C++ header-only fixed-point math library
https://mikelankamp.github.io/fpm
MIT License
672 stars 85 forks source link

Add support for PlatformIO #32

Closed flaviut closed 1 year ago

flaviut commented 2 years ago

This file is needed to get this library to work seamlessly with PlatformIO. Docs for the file can be found at https://docs.platformio.org/en/latest/librarymanager/config.html

This has been tested with a platformio project by setting

lib_deps =
    https://github.com/flaviut/fpm.git#aa0a3aa265ea0733f3c6410785f31b53b0a0db03

and works fine.

MikeLankamp commented 2 years ago

Hi @flaviut, thanks for your PR. I wasn't aware of PlatformIO as package/library manager but I looked it up and this looks ok in principle. The only issue I have with this is the extra step required when publishing new versions. Currently, this is just creating a new tag, but now it requires a new commit to bump the version in this library.json, which could be forgotten.

If I compare this to e.g. Conan, the latter allows grabbing the version from Git tags at time of publishing. Does PlatformIO have something similar?

Also, what happens if you specify FPM as dependency to PlatformIO without this file present?

flaviut commented 2 years ago

Currently, this is just creating a new tag, but now it requires a new commit to bump the version in this library.json, which could be forgotten.

The only use of the version number in the library.json is to provide metadata for registry.platformio.org. I don't see a point in uploading this package there, using it from git works just fine and is much less hassle. The version could be "HEAD" or something.

If I compare this to e.g. Conan, the latter allows grabbing the version from Git tags at time of publishing. Does PlatformIO have something similar?

Yes: the thing after the # is a git ref or commit hash.

Also, what happens if you specify FPM as dependency to PlatformIO without this file present?

When build.srcFilter is the default, platformio will try and build all the stuff like benchmarks, tests, and 3rd-party things. There's no point in building all this stuff, and building (without other configs set up) it doesn't actually work.

Unfortunately, I don't think there's a way to do this configuration in my project instead of this library.

flaviut commented 1 year ago

Doesn't seem like anyone else is interested in this, and I don't use platformio anymore.