How To Create A BinaryData Object?

Woah, I just noticed this thread is 11 years old, nice…

I don’t usually use CMake, but I can see that the extras/BinaryBuilder folder contains a CMakeLists.txt file, maybe that can help? Then once the BinaryBuilder command line tool is built you can use that to generate the BinaryData.

1 Like

I found the way how to do it:

  • make a sub-folder in your project (e.g. assets)
  • put your files there (you want to embed them as binary resource)
  • create CMakeLists.txt there with the following content:
        juce_add_binary_data(myBinaryResourceTargetName SOURCES
        Jura-Light.ttf ) 
  • in your main project CMakeLists.txt add:
target_link_libraries(vstremote
    PRIVATE
        # GuiAppData            # If we'd created a binary data target, we'd link to it here
        myBinaryResourceTargetName #this is your binary target
        #juce::juce_gui_extra
        #juce::juce_audio_utils
        #juce::juce_dsp
       
    PUBLIC
        #juce::juce_recommended_config_flags
        #juce::juce_recommended_lto_flags
        #juce::juce_recommended_warning_flags)

If you have JuceHeader included, you will be able to access generated resources:
BinaryData::JuraLight_ttf, BinaryData::JuraLight_ttfSize

2 Likes