sudara / melatonin_inspector

A JUCE module that gives you the ability to inspect and visually edit (non-destructively) components in your UI.
MIT License
156 stars 18 forks source link

Add compile binary data option #36

Closed andyjtb closed 1 year ago

andyjtb commented 1 year ago

Allow module consumers to compile the binary data without requiring edits to the source

This means I don't need to maintain a fork to enable the BinaryData to be compiled as part of my build

sudara commented 1 year ago

Hi there!

Thanks for the PR.

This means I don't need to maintain a fork to enable the BinaryData to be compiled as part of my build

Could you elaborate on this? Why would you need to compile the InspectorBinaryData? The reason it's compiled by default is Projucer support.

The only time it would need to be compiled is when adding/modifying features to the inspector with icons. Is the intention to make this process easier?

andyjtb commented 1 year ago

@sudara Thanks for taking a look

The precompiled Binary data header is called InspectorBinaryData.h and as such it doesn't compile out of the box

Alternatively, I could add the LatestCompiledAssets directory as an include directory as well as adding the sources files to a library, but this felt like the most complete solution and the overhead of compiling the resources each time is extremely minimal at this stage

I'd be fine with changing this to use the pre compiled files if you'd prefer though

sudara commented 1 year ago

@AndyBrown91

Thanks for the reply. Unfortunately I still don't understand...

The precompiled Binary data header is called InspectorBinaryData.h and as such it doesn't compile out of the box

I'm not quite following this. Did you have an error compiling after adding melatonin inspector to an existing JUCE project with CMake? If so, what was it?

Alternatively, I could add the LatestCompiledAssets directory as an include directory as well as adding the sources files to a library

melatonin_inspector.h already includes LatestCompiledAssets/InspectorBinaryData.h and the cpp also brings in the BinaryData cpp files, which is why I'm a bit confused...

I'll try to setup a fresh project to see if there's an issue. But any more detail you can give me about what issue you ran into would be helpful...

andyjtb commented 1 year ago

@sudara This is the problematic line: https://github.com/sudara/melatonin_inspector/blob/24a8ceb7ed5d7419642020e50aa93c3a8c3da153/melatonin/inspector_component.h#L19

I've done a simple reproduction here to save you setting one up, including both CMake projects and Projucer https://github.com/AndyBrown91/inspector

Thank you for questioning this though, I've rearranged the PR to a system that works better

You can define whether or not to build the assets from outside the library, the library will use the precompiled assets and compile out of the box from CMake and Projucer

sudara commented 1 year ago

Hey Andy,

Thank you for pointing out the issue! Unfortunately it's a typo! There is no "BinaryData.h" in melatonin inspector — yikes! Must have been a copy and paste error, sorry that ate up your time. It's now fixed on main.