Hello I am having a difficult time making my 1st custom generator and was hoping someone more experienced would be able to guide me. I am currently using a standard generator to produce a C and an H file from a PREPROCESSED_C file:
type.register MOCK_C : : C ;
type.register MOCK_H : : H ;
generators.register-standard mock.generate : PREPROCESSED_C : MOCK_C(mock_%) MOCK_H(mock_%) ;
This generator is often invoked like this:
mock-c mock : file1.c ;
exe test : mock ;
which correctly compiles and links the C file and ignores the H file. The H file is used elsewhere using <implicit-dependency>mock.
Now I want to also add support for producing this set of C and H files from a set of H files. The chain needs to look something like this: h files -> c file -> preprocessed c file -> mock_c and mock_h. If I do this:
generators.register-standard mock.generate_c : H : C ;
Then rather than ignoring the produced MOCK_H file, in the exe target above, it tries to make a C file from it and then link it in also. This is not desired.
So I am trying to do something like this:
type.register HLIST_C ;
generators.register-standard mock.generate_hlist : H : HLIST_C ;
and then the chain looks like this: h files -> HLIST_C file -> preprocessed c file -> mock_c and mock_h but I cannot figure out how to coerce the HLIST_C file to be passed as input to the preprocessed_c generator without inheriting the C base file type. I tried creating a custom generator that would go from a set of H files to a PREPROCESSED_C file but still could not figure out how to convert an HLIST_C target to be a C target that could be consumed by a PREPROCESSED_C generator. I tried clone-with-different-type() but this caused duplicate targets.
Any help with this is much appreciated.
Thanks,
Chris