Skip to content

Platform independent embedded resources #54

Description

@Yuri6037
  • Create C++ executable as part of the Framework that will turn any file into a resource .cpp file to embed in the executable.
  • Use extern "C" in the generated cpp file to avoid name mangling.
  • Store data as a const char [].
  • Store an fsize for the size of the data.
  • Reference resources using LoadLibrary/dlopen on the calling exe itself in order to locate the symbols for the resources.
  • Create a build integration with add_custom_command
  • Implement Application.GetResource(Name) which should return a read only byte buffer
  • Implement Application.GetResourceAsStream(Name) which should return an IInputStream
Example of generated embedded resource
#include <Framework/Types.hpp>
using namespace bpf;

extern "C"
{
	const char RESOURCE_DATA_<FileNameProcessed>[] = {0x0, 0x0, ...};
	const fsize RESOURCE_SIZE_<FileNameProcessed> = 2;
}

WARNING: FileName is not allowed to contain ' ', or that is an error.
WARNING 2: Path must contain */res/* or *\res\* (Maybe not will see when implementing)

FileNameProcessed = FileName.Replace("/", "_").Replace(".", "_")

Metadata

Metadata

Labels

APIAPI changesBaseCore module baseCMakeCMake Framework

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions