-
At configure-time, programmers use the K3D_COMPILE_RESOURCE macro to identify each external resource to be embedded in a binary. The macro takes three arguments: an output variable, the name of the external resource file, and the runtime resource identifier. The macro output will be a list of C++ resource files that should be added to the executable or library build:
K3D_COMPILE_RESOURCE(RESOURCES bar.py "/foo/bar.py")
K3D_COMPILE_RESOURCE(RESOURCES baz.py "/foo/baz.py")
...
ADD_EXECUTABLE(foobar ${HEADERS} ${SOURCES} ${RESOURCES})
-
At compile-time, the k3d-resource-compiler executable will be invoked for each binary resource file, converting it into C++ source code located in the build directory.
-
The resources will be compiled and linked along with “normal” code.
-
At runtime, programmers can retrieve resources using their identifiers. For example:
#include <k3dsdk/resource/resource.h>
std::string = k3d::resource::get_string("/foo/bar.py");