Add {fmt} library as a git submodule and replace calls to boost::format#1591
Conversation
|
Seems we'll need a |
|
CMake targets are useful, but a pain... I have no idea why still fails after including it in Potentially we could
One more of these very simple ideas that turns into a nightmare. Sigh. |
|
yes, apt installing libfmt was definitely easier than battling with cmake 😅 I'll play around a bit longer, but maybe switching to header only is the most promising |
|
Calling find_package(fmt) earlier on in STIRConfig.cmake.in fixed the issue! Now an installed STIR can be used without any changes. Not sure what the Codacy issue is about - do you have any experience with this @KrisThielemans ? |
|
Also, I seem to have gotten appveyor into a weird state :-/ |
7289460 to
8532f40
Compare
|
The clang-tidy printf and fprintf replacement is a bit underwhelming so far - only picked up a few instances and skipped many others (maybe because I don't build some code). But it also turns out that it doesn't replace sprintf. |
ba3275e to
9ee15b5
Compare
it complains about with "Comparison of a boolean expression with an integer." Doesn't have anything to do with us, so let's ignore it. |
It reports this seems to say that your attempt to auto-update the module fails. Not sure why... I'm not sure if we should do this though. I think I'd be surprised if building my software suddenly updates submodules. I think I'd prefer to give explicit instructions how to clone, as well as an error message that tells them what to do (i.e. either use C++-20, or use the explicit git command). In that case, we'll have to modify appveyor/ci#899 claims this doesn't work well with caching and gives a far more complicated solution. Maybe we can ignore that for a while. |
|
Also, ideally we keep the clang-tidy changes in a separate commit, which we then add to |
9ee15b5 to
8b1e9cd
Compare
Unfortunately, this does not work because we currently do a shallow clone of the repository: Do you think we could switch to specifying a clone depth? |
…pull to appveyor.
sure |
8b1e9cd to
891ec41
Compare
|
Even with STIR master I get the following error when I run "./run_tests_modelling.sh" from within STIR/recon_test_pack. Am I doing something wrong or is this test currently broken? |
|
weird. it works for me. Indeed, it works in the Actions. see for instance |
|
Bad news: fmt definitely doesn't support the "%d" syntax, so for input files we'll have to revert to boost if we want to be backward compatible. Also, I managed to debug into the problematic line in run_tests_modelling.sh and the problem is the "if(*p)". I notice that in my case the character array for the first line shows as "3655\r", so *p interprets to "\r". Turned out to be caused by line endings: my file had CRLF line endings, and when changing the line endings for plasma.if to LF, then reading the file works fine. Afterwards I also had to change the "for fr in |
sigh. what about the following then: if the string contains a %, write a warning recommending to use the new syntax and fall-back to
That's pretty weird. and (in my case: nothing). I checked that on Ubuntu, my file has Unix EOL (i.e. \n), while on Windows it has DOS EOL (i.e. \r \n). Somehow you have a mixture. Maybe this is affected by a git switch for preference? Can you check another text file, e.g. Of course, ideally we'd rewrite the code to cope with "DOS EOL on Unix" (
|
|
That's a good idea! I'll do that. Strangely, all files have CRLF line endings in my case, but none show up as changed in git. It must be something strange with how I cloned the repo - I'll look into it. Ah ok, I would have never guessed that count is a STIR script! Where is the source code for it? The usage in the shell script gives me a ": invalid option" error. |
https://github.com/UCL/STIR/blob/master/scripts/count My guess this is also a CRLF thing. I think we need to add it in .gitattributes ( |
…oost::formatting is used.
|
Also, if any of this was automatic (probably not), please add the relevant commit to |
|
Yes, unfortunately all manual! |
|
sorry, could you update |
…90-replace-boost-format-with-fmt-std-format

Changes in this pull request
Testing performed
Related issues
closes #1590
Checklist before requesting a review
documentation/release_XXX.mdhas been updated with any functionality change (if applicable)