How does PX4 SITL simulation works?

What changes does PX4 has in the building process while compiling between an embedded target or a SITL one?

Is the flight control part of the PX4 architecture totally compatible with a linux host? Or perhaps I am missing a key part.

For one thing the build has to work on the PC that the simulations will run on vs an STM32.
When it is built for linux it is.

So there is an additional layer added that ports the autopilot to work with a linux host and accepts the mavlink commands via UDP?

Or what is the meaning of the wot term you used?

Sorry it was β€˜to’ not β€˜wot’.
The simulator emulates the drone so PX4 sends motor command to the simulator. The simulator emulates the sensors and returns sensor readings. Not 100% sure how this happens, could be API calls.

PX4 connects to QCG via UDP and sends back telemetry and QCG sends RC controller stick movements and Flight modes and probably other stuff.

Im interested in the implementation details of how this is feasable, since it is a really appealing methodoly for other control embedded applications.