automake
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Compile a particular extension files, with a different compiler


From: Labeeb Asari
Subject: Compile a particular extension files, with a different compiler
Date: Sun, 26 Mar 2023 18:03:57 +0530

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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]