swift-nio icon indicating copy to clipboard operation
swift-nio copied to clipboard

CMake support

Open cqundefine opened this issue 8 months ago • 3 comments

Having CMake support would be useful for people who don't want to use SwiftPM. A bunch of other Apple Swift libraries already have CMakeLists.txt files present.

cqundefine avatar Apr 17 '25 10:04 cqundefine

Thanks for filing this! I think this is a reasonable feature request. However, before we do too much here, I'd like to suggest that we should investigate whether Swift Package Manager could produce CMakeLists.txt files automatically. That would make life a lot easier when it comes to integrating Swift Packages into CMake builds, especially as SwiftPM already knows how it would go about building these libraries.

What do you think?

Lukasa avatar Apr 17 '25 12:04 Lukasa

Yeah, if SwiftPM was able to generate CMake build configurations automatically that would be a way better solution, as it would remove the need to maintain two build systems across all the Swift libraries. At the current moment CMake is way more powerful when it comes to mixed Swift and C++ projects and in those cases using SwiftPM is usually not really an option which dramatically limits the available usage of the Swift ecosystem. Being able to import any SwiftPM project in CMake would remove that limitation entirely. But on the other hand, getting SwiftPM to generate CMake files would require a lot of work.

cqundefine avatar Apr 17 '25 13:04 cqundefine

I'm not sure it'd be that much work. We currently auto-generate the cmake file list for all of our repos, which works pretty well. It's conceptually not that hard to build the feature into SwiftPM, which already has a module graph.

Nonetheless, we'd accept a patch which adds the scaffolding to swift-nio as well.

Lukasa avatar Apr 17 '25 13:04 Lukasa