Building universal binary on Mac

I posted this question to the Cuda on Mac forum (http://forums.nvidia.com/index.php?showtopic=193555), but there’s been no reply there, so I’m hoping to have better luck here.

How can I build a universal binary for my CUDA code? nvcc requires you to specify either -m32 or -m64. I want it to build both. This should be simple, since nvcc is just wrapping gcc, which knows how to compile for multiple architectures and produce a universal binary, but I haven’t found any documentation on how to do it.

Peter

You can build two binaries for both architecture separately with nvcc. Then use lipo to combine them into a universal binary.