Loosly quoting Fred:
There is a third way in addition to giving a .xml or a .json file as input for the platform definition. Programmatic descriptions can be standalone and be compiled as shared library. This .so file can be passed then instead.
As an example the routing_cluster.cpp in the Simgrid examples is such a standalone file (compiled here https://framagit.org/simgrid/simgrid/-/blob/master/examples/platforms/CMakeLists.txt and used there https://framagit.org/simgrid/simgrid/-/blob/master/examples/cpp/app-token-ring/s4u-app-token-ring.tesh#L19).