Likely via platform-dependent makefiles, or whatever is used to compile the source code. TL;DR, when you compile the source code, the build system detects which OS you're running (or accepts a command line argument for cross-compilation) and either builds one version or the other.
↧