Hi , I know this isn’t a forum dedicated for cmake , but it has a bit to do with how cuda manages separable compilation.
I created this post on SO for context :
The problem is actually simple :
In cmake , let’s say I have 3 main targets :
- target lib1 , which has a class with a device method
- target kernel , launching a global_ function executing the method of the class in lib1
- target lib2 containing host code , executing the kernel.
- target lib3, lib4 , … , libn representing the rest of the application , and important , some targets here have cyclical dependency to each others , for ex , lib3<->lib4 , and one of those targets depends on lib2 .
What is the correct way of compiling such an application ?
For example , to me , I need to enable separable compilation for each target , even those who have nothing to do with cuda , or have no device code whatsoever.
Using only gcc , static libraries having cyclical dependencies isn’t such a big deal , but when introducing nvcc in the middle , that cycle between lib3 and lib4 will cause the compiler to be unable to link the two libraries, unless I enable separable compilation for both , which , again strikes me as odd if the current target has nothing to do with any device code.
Is there a way to separate cleanly both sides of the build process ?