$ python gencpp.py
This command generates a cpp file foo.cpp
in the working directory.
I'd like to run this command in bazel
before building to be able to include foo.cpp
in cc_binary
's srcs
attribute.
What I've tried:
genrule(
name = 'foo',
outs = ['foo.cpp'],
cmd = 'python gencpp.py',
)
cc_library(
srcs = ['foo.cpp'], # tried also with :foo
...
)
declared output 'external/somelib/foo.cpp' was not created by genrule. This is probably because the genrule actually didn't create this output, or because the output was a directory and the genrule was run remotely (note that only the contents of declared file outputs are copied from genrules run remotely).
I know that there is a solution that requires gencpp.py
to be modified a little bit, but it's not what I'm looking for.