Skip to content

Instantly share code, notes, and snippets.

View njlr's full-sized avatar
🌏
F# ing

njlr njlr

🌏
F# ing
View GitHub Profile
{
  'mathutils.hpp': ':single-header'
}
genrule(
 name = 'single-header',
 out = 'mathutils.hpp',
 cmd = 'echo "' + single_header + '" > $OUT',
)
single_header = '\n'.join([
  '#ifndef MATHUTILS_HPP',
  '#define MATHUTILS_HPP',
  '',
  ] + [
  '#include <mathutils/' + i + '> ' for i, _ in mathutils_headers.items()
  ] + [
  '',
  '#endif',
  '',
{
 'add.hpp': 'mathutils/include/add.hpp', 
 'sub.hpp': 'mathutils/include/sub.hpp'
}
print subdir_glob([
 (‘mathutils/include’, ‘**/*.hpp’),
])
mathutils
├── include
│ ├── add.hpp
│ └── sub.hpp
└── src
 ├── add.cpp
 └── sub.cpp
#include <mathutils/mathutils.hpp>
#ifndef MATHUTILS_SINGLE_INCLUDE_HPP
#define MATHUTILS_SINGLE_INCLUDE_HPP
#include <mathutils/add.hpp>
#include <mathutils/sub.hpp>
// etc…
#endif
#include <mathutils/add.hpp>
#include <mathutils/sub.hpp>
// etc…
mathutils
└── include
 ├── add.hpp
 ├── sub.hpp
 └── …