support external jsmn implementations #121
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi,
This is my first time making a PR/contribution to someone else's project - so please forgive me for any schoolboy errors.
I'm using CGLTF in a personal project where I am also using JSMN on its own to parse some JSON files. My project builds via Unity Builds, so I was getting an error that JSMN code was already being defined in another source file - it was the embedded JSMN implementation inside cgltf.h.
I put in a change for myself where passing a define in before including
cgltf.h
doesn't use the embedded JSMN implementation but then thought these changes might be useful in the library for others?I added a quick test to make sure that it still compiles with the define turned on (
CGLTF_EXTERNAL_JSMN
) and with the external jsmn file included. Everything passes on Travis.One thing I did notice was that the JSMN implementation seems to be a bit behind the latest version, which required a typecast at
cgltf.h
line 5072. Other than the#define
I've added and the bump in version number (I don't know what your convention for version numbers is with this project but I can always revert it if you like), that's the only other change I've made.The only thing I've not done is update the documentation. I figured it was only worth me doing that if you OK'd the change. =)
I'd be very interested to hear your feedback on this. I appreciate this is probably an edge-case problem - but hopefully this will be useful?
Thanks,