Skip to content

Commit

Permalink
Implement export_deprecated_macro_name for generate_export_header.bzl
Browse files Browse the repository at this point in the history
  • Loading branch information
j-rivero committed Jan 9, 2018
1 parent 73e0b49 commit d649028
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tools/workspace/generate_export_header.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ def _generate_export_header_impl(ctx):
"# define %s __attribute__ ((__deprecated__))" % ctx.attr.deprecated_macro_name, # noqa
"#endif",
"",
"#ifndef %s_EXPORT" % ctx.attr.deprecated_macro_name,
"# define %s_EXPORT %s FCL_EXPORT %s" % (ctx.attr.deprecated_macro_name, ctx.attr.export_macro_name, ctx.attr.deprecated_macro_name), # noqa
"#ifndef %s" % ctx.attr.export_deprecated_macro_name,
"# define %s %s %s" % (ctx.attr.export_deprecated_macro_name, ctx.attr.export_macro_name, ctx.attr.deprecated_macro_name), # noqa
"#endif",
"",
"#endif",
Expand All @@ -42,6 +42,7 @@ _generate_export_header_gen = rule(
"out": attr.output(mandatory = True),
"export_macro_name": attr.string(),
"deprecated_macro_name": attr.string(),
"export_deprecated_macro_name": attr.string(),
"static_define": attr.string(),
},
output_to_genfiles = True,
Expand All @@ -54,6 +55,7 @@ def generate_export_header(
out = None,
export_macro_name = None,
deprecated_macro_name = None,
export_deprecated_macro_name = None,
static_define = None,
**kwargs):
"""Creates a rule to generate an export header for a named library. This
Expand All @@ -78,11 +80,14 @@ def generate_export_header(
export_macro_name = "%s_EXPORT" % lib.upper()
if deprecated_macro_name == None:
deprecated_macro_name = "%s_DEPRECATED" % lib.upper()
if export_deprecated_macro_name == None:
export_deprecated_macro_name = "%s_EXPORT_DEPRECATED" % lib.upper()

_generate_export_header_gen(
name = name,
out = out,
export_macro_name = export_macro_name,
deprecated_macro_name = deprecated_macro_name,
export_deprecated_macro_name = export_deprecated_macro_name,
static_define = static_define,
**kwargs)

0 comments on commit d649028

Please sign in to comment.