This post describes how to implement the OpenSSF Compiler Options Hardening Guide for C and C++ in CMake.
Read more...Cmake
In a previous blog post, I described how I took Emscripten-created JS and turned it into an UMD module. One of the reasons I did this was because I wanted more control over the generated JavaScript and for it to be usable in more contexts, such as with the RequireJS module loader.
As I am a responsible developer, I desired to create a number of automated unit tests to ensure that the client-visible API for my Emscripten module works as I intended. I began by searching for a browser automated test framework and settled upon Nightwatch.js. Now I just had to figure out how to get Nightwatch.js tests running in my existing, CMake-based build system. Here’s how I did it.
Read more...By default, Emscripten creates a module which can be used from both Node.JS and the browser, but it has the following issues:
- The module pollutes the global namespace
- The module is created with the name
Module
(in my case, I requirestreamingPercentiles
) - The module cannot be loaded by some module loaders such as require.js
While the above issues can (mostly) be corrected by using –s MODULARIZE=1
, it changes the semantics of the resulting JavaScript file, as the module now returns a function rather than an object. For example, code which previously read var x = new Module.Klass()
would become var x = new Module().Klass()
. I found this semantic change unacceptable, so I decided to abandon Emscripten’s -s MODULARIZE=1
option in favor of hand-crafting a UMD module.