Here is my folder structure:
├── bin
├── build
├── CMakeLists.txt
├── include
│ └── project
│ ├── base_socket.h
├── LICENSE.txt
├── README.md
└── src
└── project
├── base_socket.cpp
├── CMakeLists.txt
├── main.cpp
|── assets
├── imageone.jpg
This is for an OpenGL project where there are several shader (text) files and images.
I have problems because I use relative paths in my .cpp files (for instance, roughly, `./assets/imageone.jpg
The issue is that I want to (and CMake does) have the built binaries go into the top level /bin
directory. When I do that, and run the debug and release executable, the binary paths are obviously broken.
One solution to this would be to try to embed all of the resourced "in the executable" but I do not like this approach with large, binary files.
Is there some possible way to store "Assets", and reference them with local paths, and have these local paths work across platforms?
For instance, Visual Studio puts binaries in /bin/Release
g++
does not, so I can't even have a parent level "Assets" folder that always works with relative paths.
In short I am guessing how to make a cross platform asset referencing method for a C++ program.
How do the pros do it?
Is this something CMAKE can help with?
Thanks