Is it possible for the SPM to compile Cuda files and build a lib?

Using CMake, I have successfully compiled Cuda files with nvcc, built a static lib, then linked and called the Cuda kernels from Swift code. However, I can't seem to figure out if there is any way to do it with the SPM?? It would be great to drop CMake.

Any help is greatly appreciated, Ed

It isn't currently possible to delegate to other build systems in SwiftPM. It's a goal to allow extending integrating other build tools in SwiftPM but it requires considerable design discussions. There was a draft posted here a while back.

However, you can use the -Xcc/-Xswiftc/-Xlinker escape hatches to provide custom compiler flags. Something like this should work: swift build -Xswiftc -I/path/to/headers -Xlinker -lsomelib.

Terms of Service

Privacy Policy

Cookie Policy