Background - I've an existing C library which uses autotools as the build system. - I want to add some Cuda source files(.cu) to this library. - Unlike C source files, .cu files are compiled by a different compiler (nvcc).
Here's an example of what I'm trying to do : https://github.com/labeeb-7z/cuda-gnu/tree/main/shared-library Basically : compile .c source files with gcc, .cu files with nvcc and finally link them together with gcc. I've tried adding a rule to handle .cu files differently and it does create object files for it separately. However while linking, libtool does not include these object files! I believe this is because when libtool compiles all the C files, it also generates a corresponding .lo (libtool object) file for each of them and while linking it only considers files which have a corresponding .lo file. Since .cu files are compiled by a different compiler(nvcc) (not done by libtool), their object files are not linked while creating the final library. Question : Is there any way I can include the object files generated by nvcc in the final linking command which creates the shared library? Maybe any special variable to which I can add the names of all the object files?(which I want in linking to the final library). Thankyou, Labib