4 ms·
For gRPC we needed the code to work on all major OS's and had to support a number of different build systems. In no case were the capabilities of the target sys
by euyyn 8y ago
For gRPC we needed the code to work on all major OS's and had to support a number of different build systems. In no case were the capabilities of the target system manually specified, as that wouldn't have been sustainable. And specifying for each build system what files to include or not for each platform would have been onerous and hard to work with (as the person adding some platform-specific code probably isn't fluent in build systems for other platforms).
So the solution we adopted is a header file that detects the target platform capabilities. And each source file being either platform-agnostic, or specific to one platform. In the latter case, the whole file contents would be #ifdef'd out if compiling for a different platform.