{"action":"created","issue":{"url":"https://api.github.com/repos/billyquith/ponder/issues/59","repository_url":"https://api.github.com/repos/billyquith/ponder","labels_url":"https://api.github.com/repos/billyquith/ponder/issues/59/labels{/name}","comments_url":"https://api.github.com/repos/billyquith/ponder/issues/59/comments","events_url":"https://api.github.com/repos/billyquith/ponder/issues/59/events","html_url":"https://github.com/billyquith/ponder/issues/59","id":181445652,"number":59,"title":"Ponder format lib clashes if another format lib is used","user":{"login":"Weeena","id":19182442,"avatar_url":"https://avatars.githubusercontent.com/u/19182442?v=3","gravatar_id":"","url":"https://api.github.com/users/Weeena","html_url":"https://github.com/Weeena","followers_url":"https://api.github.com/users/Weeena/followers","following_url":"https://api.github.com/users/Weeena/following{/other_user}","gists_url":"https://api.github.com/users/Weeena/gists{/gist_id}","starred_url":"https://api.github.com/users/Weeena/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Weeena/subscriptions","organizations_url":"https://api.github.com/users/Weeena/orgs","repos_url":"https://api.github.com/users/Weeena/repos","events_url":"https://api.github.com/users/Weeena/events{/privacy}","received_events_url":"https://api.github.com/users/Weeena/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2016-10-06T15:20:33Z","updated_at":"2016-10-07T09:51:26Z","closed_at":null,"body":"Ponder now uses the popular formatting library by Victor Zverovich (files `include\\ponder\\detail\\format.hpp` and `src\\format.cpp`).\r\n\r\nSince this formatting library is rather popular, it may be the case that some project or some other library also makes use of it. It  this is the case, the two libraries clash. These are the reasons:\r\n* The include guards `FMT_FORMAT_H_` are identical.\r\n* The names of internal macros (e.g. `FMT_VARIADIC_VOID`) are identical.\r\n* The name of the external macro `FMT_HEADER_ONLY` is identical.\r\n\r\nAdditional note (= bug?): In Ponder's formatting library files, there is code that is controlled by a macro `FMT_HEADER_ONLY`. Alas, `FMT_HEADER_ONLY` must not be defined. If it is defined, there is a compile error since there is no file `format.cc` that could be included.\r\n\r\nIn our case, the other library that also makes use of the formatting library by Victor Zverovich is `spdlog`, a library for logging. This library is somewhat aware of the fact that there may be another version of the formatting library already used. To make use of this other library, it is possible to set a macro `SPDLOG_FMT_EXTERNAL` for `spdlog`. In this case, as the comment for this macro states, \"spdlog will try to include `<fmt/format.h>` so set your -I flag accordingly\". Alas, this possiblity will not work with Ponder's formatting library since 1) the header file has extension `.hpp` rather than `.h` and 2) the files are modified such that the formatting is in namespace `ponder/detail`.\r\n\r\nHow could it be solved? I don't know what the best way would be. One way would be to use the formatting library without any modifications (as `spdlog` does). The other way (which I would personally rate as unfavorable) would be to modify it such that all clashes are eliminated."},"comment":{"url":"https://api.github.com/repos/billyquith/ponder/issues/comments/252200486","html_url":"https://github.com/billyquith/ponder/issues/59#issuecomment-252200486","issue_url":"https://api.github.com/repos/billyquith/ponder/issues/59","id":252200486,"user":{"login":"billyquith","id":1754471,"avatar_url":"https://avatars.githubusercontent.com/u/1754471?v=3","gravatar_id":"","url":"https://api.github.com/users/billyquith","html_url":"https://github.com/billyquith","followers_url":"https://api.github.com/users/billyquith/followers","following_url":"https://api.github.com/users/billyquith/following{/other_user}","gists_url":"https://api.github.com/users/billyquith/gists{/gist_id}","starred_url":"https://api.github.com/users/billyquith/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/billyquith/subscriptions","organizations_url":"https://api.github.com/users/billyquith/orgs","repos_url":"https://api.github.com/users/billyquith/repos","events_url":"https://api.github.com/users/billyquith/events{/privacy}","received_events_url":"https://api.github.com/users/billyquith/received_events","type":"User","site_admin":false},"created_at":"2016-10-07T09:51:26Z","updated_at":"2016-10-07T09:51:26Z","body":"This is interesting user feedback. I did expect to have this conversation one day as this clash is inevitable when a popular library is integrated. It already exists in the ponder namespace, but this is only a partial attempt at \"absorption\". My feeling was to modify it so that it becomes internal, although I appreciate that will lead to substantial modifications. It is used in some templates so cannot be completely hidden in the implementation files.\r\n\r\nThe thinking here is that at some point in the future there may also exist a version of format that, or a library that it is dependent on a version of format, that is not compatible with this one.\r\n\r\n> Additional note (= bug?): In Ponder's formatting library files, there is code that is controlled by a macro FMT_HEADER_ONLY. Alas, FMT_HEADER_ONLY must not be defined. If it is defined, there is a compile error since there is no file format.cc that could be included.\r\n\r\nI renamed `format.cc` to `format.cpp` for consistency and `FMT_HEADER_ONLY` isn't used.\r\n\r\nspdlog's dual modes are of interest: format internal and external.\r\n\r\nAnother option is to remove fmt and treat it as a third party library. It would just be installed like other libraries. I didn't do this because I wanted Ponder to be stand-alone. When I revisit XML and JSON serialisation I also hope to do the same. These libraries will be easier to hide as the Ponder API shouldn't require them.\r\n\r\nOptions:\r\n- Move format externally and treat as third party lib.\r\n- Dual mode, user selects internal/external, like spglog.\r\n- Absorb and refactor.\r\n\r\nDual mode is quite appealing since I'd like the default to be format included. Since it can be included header only this simplifies things, although this does have the problem of conflicting versions. That said, I'm not sure there is a massive risk here and I like to update libraries anyway.\r\n\r\nPonder also has header only include libs now, like the Lua scripting extension. To link that you add a define, rather than link a library. This simplifies the build config."}}
{"actor":{"display_login":"billyquith"}}