I’m not much use on the topic since I have not tried to make a single portable application like that. However, I can guarantee you cannot mix CUDA 9 and 10. The CPU architecture also differs between a PC and Xavier, but is the same between Xavier and TX2 (so you are probably in luck there). The GPU architecture can be set to define compatibility with both GPUs, but the other issues imply that at best you need two compiles. The mix of CUDA 9 and 10 implies a complete porting is required from 9 to 10 to operate on Xavier.
More specifically, the TX2 and Xavier have the same CPU architecture…different than a PC, but your goal of making this work on both TX2 and Xavier won’t require any CPU architecture changes.
TX2 and Xavier have different GPU architectures. This is specified with the “-gencode arch=…” setting during compile. TX2 is “-gencode arch=compute_62,code=sm_62”, and Xavier is “-gencode arch=compute_72,code=sm_72”. More than one can be added to a single program, for example:
-gencode arch=compute_62,code=sm_62 -gencode arch=compute_72,code=sm_72
You cannot get around the requirement that only CUDA 9 is available on a TX2, and only CUDA 10 is available on Xavier. A future JetPack release should make CUDA 10 available to both (and I don’t know when that is other than “soon”). If you can port your CUDA 9 app to CUDA 10, then not too long from now you should be able to get the single compile you want.