Building binary that accesses external files during runtime

I am builing a JUCE project with make on my linux machine.

1 → Is it possible to build the binary for Windows or mac directly from my makefile? or do I need a virtual environment with the particular OS?

2 → Presently I have a straightforward binary that does not need any additional files.
But for a feature it is going to need some image files which are located at ‘<project_dir>/Assets’

I want the binary to be located at ‘<project_dir>/Builds/LinuxMakeFile/builds/LinuxBuild/<binary_file>’,
and I want my Assets to be copied inside the same LinuxBuild directory.The binary opens the image files with relative paths
for example : “./Assets/image1.png”(presently the whole ‘builds’ directory gets cleaned for every build).

I think we need to set an environment variable for this to work(but I do not know how) and such
that it works the same regardless from the position in the file system we opened it from. How to set the Environment variables and achieve the wanted build file structure from projucer?

Any help would be Appreciated.

I am afraid that you need to build it on Windows/macOS. BTW, you may make use of github actions.

Again, pamplejuce has the solution:

After that, you can access them through BinaryData::***.

1 Like

Thank you for the resources, will check them out!

Also I have an other question, presently I am using make to build the project, is there a way to generate CMakeLists.txt file for this project in projucer, cause if I open my project in projucer I only have the Linux MakeFile option in the exporters.

You have to choose CMake OR projucer. If you choose CMake, all configurations are done in the CMakeLists.txt. If your project is not very complex, you can transfer it to CMake easily (based on pamplejuce). The documentation of JUCE CMake API is here:

1 Like