Hi Ankur,
Not sure whether that helps, but BOUT++ (requires MPI) switched to a custom back end [1]
when it switched to cmake [2] from configure + calling setup.py. The main motivation was
to enable packaging in fedora, but it also allowed to just pip install the whole package,
as BOUT++ is now PEP-517 enabled.
This doesn't call the pyproject macros, but just the cmake ones [3], so not sure this
is applicable to what you need, but maybe it offers at least some insight into how it is
done for other MPI codes ...
Best,
David
[1]
https://github.com/boutproject/BOUT-dev/blob/master/tools/pylib/_boutpp_b...
[2]
https://github.com/boutproject/BOUT-dev/blob/master/tools/pylib/_boutpp_b...
[3]
https://src.fedoraproject.org/rpms/bout++/blob/rawhide/f/bout++.spec