Skip to content

Build Tool to embed resources into the binary and query them at runtime

License

Notifications You must be signed in to change notification settings

ankurvdev/embedresource

Repository files navigation

README

Overview

Build Status

Cross platform tool for embedding resources into the binaries

CMake Initialization

Supports either git-submodule or vcpkg / cmake-package based initialization

    # Git Submodule https://github.com/ankurvdev/embedresource
    add_subdirectory(embedresource)

OR

    # CMake pre-installed location
    find_package(EmbedResource REQUIRED)

CMake Integration

    find_package(EmbedResource REQUIRED)
    add_resource_library(foo OBJECT RESOURCE_COLLECTION_NAME bar RESOURCES "bar1.bin;bar2.bin")
    target_link_libraries(main PRIVATE foo)

Code

#include <EmbeddedResource.h>
#include <iostream>

DECLARE_RESOURCE_COLLECTION(foo);

int main(int argc, char* argv[])
{
    auto resourceCollection = LOAD_RESOURCE_COLLECTION(foo);
    for (auto const r : resourceCollection) { std::cout << r.string(); }
    return 0;
}