Embedding binary resources with CMake and C++11 Code

The problem

Let’s say you want to make a single-binary application that has embedded resources (images, GLSL shaders, etc.). Let’s say you want to automatically wrap your resources in a storage container to make it easier to deal with stuff. Let’s also say that you might even be using CMake as your build system.

CMake doesn’t provide a way of making a custom build rule, and using extern data is a little unwieldy. So here’s an easy-ish way to do both parts, making use of C++11 language features (and a scary preprocessor hack).

The C++11 bit is also useful on its own, even if you aren’t using CMake, although things will have to be adapted to your build system of choice.

Note: Back when I wrote this the general compiler ecosystem was different, especially on macOS. If you just want a library that does all this stuff for you in a platform-independent manner, check out this resource embedding script. Or you might be interested in a CMake-only approach for the resource generation and using that in conjunction with the rest of this article.

Read more…

All-purpose bread dough Food

Here’s the bread dough recipe I’ve been using for a while. I mostly use it for pizza crusts but it’s also great for loaves and rolls and a bunch of other stuff. It’s adapted from the simplest recipes and techniques in Artisan Bread in Five Minutes a Day. There is also a newer edition of the book although I haven’t seen what’s different in it.

Ingredients

  • 3 cups warm water
  • 1.5 tbsp active dry yeast
  • 1.5 tbsp coarse salt (sea salt, kosher salt, etc.)
  • 4 cups bread flour
  • 2 cups whole wheat flour
  • ¼ cup rye flour

Directions

In a large container (I use one of these food storage boxes — don’t forget the lid!) combine the water, yeast, and salt. Wisk until consistent.

Then add the flours and stir until of consistent hydration.

That’s it! Now you just let it rise for a while, and then tear off a hunk of the dough and use it for whatever you want. Keep it in the refrigerator; cover it tightly if you like it to get a beer-like aroma, otherwise leave it cracked open a bit and just make sure you keep on adding enough moisture every few days.

Read more…

The Heroic Type Good Things

20140719-heroic-typing.jpg

July 7, 2014: Cisformation Journal

20140707-cisformation.jpg

July 3, 2014: Brushless Journal

20140703-brushless.jpg