You can simply get current arch usign following code, where on windows can be used GetNativeSystemInfo() and on macos and linux uname() function:

OS detection can be done for example on cmake side or with other definition like __WIN32: