def cpp_define(macro, params, val):
    """CPP macro definition, optionally with parameters."""
    return "#define {macro}{params} {val}".format(
        macro = macro,
        params = "({})".format(",".join(params)) if params else "",
        val = val,
    )