CryptoPP in a Juce module

Hi community,
I am trying to adapt Wei Dai's Crypto++ Library into a Juce Module format. I have managed to sort out many problems but there is one that I cannot figure out how to solve.
 The problem is that the CryptoPP's translation units seem not to be ready to be collected in a single .cpp file. There are several same type definition, for instance:

typedef BlockGetAndPut<word32, LittleEndian> Block;


typedef BlockGetAndPut<word32, LittleEndian> Block;

Same thing happens with function templates.
I just wonder if there is any way to cope with this situation, I mean, to sort out this amalgamated compilation in order to try to compile CryptoPP similar in the original way.
Thank you in advance

Demand DRYness from the souce? :)

Good point, but IMO I think it is a mature project, so, difficult to modify it.

Any alternative?

Not that I know of, sadly... You could derive the repository and do the edits yourself? Looks like it's under the Boost Software License - I think you're safe, but IANAL and so suggest you double-check if you think that's a good idea.

I'm trying to do it, but tough to cope with it.

I wrote a script that generates a separate .cpp file for the module and it worked for me.





for f in "${flist[@]}"
if [[ f == *"|"* ]]; then s=({f//|/ })
module_file_name={s[0]} include_file_name={s[1]}
include_file_name=f fi fname="{module_name}_$module_file_name.cpp"
echo "Creating $fname"
echo “#include “$cryptopplib/$include_file_name.cpp”” > $fname

echo “Done.”

1 Like