How can I use dune and ppxlib to generate library code?

Related: Using ppx for code generation - #5 by jyy