How to selectively include source files according to universal binary architecture?

I’m trying to compile my project into Mac universal binaries. However, some of the SDK source code I used only works for x86. How can I make these files only being compiled in x86 part? If there’s no way to do so, I have to edit all these SDK files to wrap them inside x86-specific macros.

There are __x86_64__ and __aarch64__ preprocessor definitions you can check for.