Conversation
|
Do you have a hard requirement for this to be a static library? If not, we can just switch the existing product to |
|
I just saw this pattern in SwiftPM docs: I just want to explicitly cite in my Package.swift that ClangSwift is statically linked hence llvm doesn't need to be installed on the host machine |
|
The package manager is going to build a copy of this library if it’s cited as a dependency at least once, no matter if it’s static or dynamic. The way around this would be distributing a static archive, but that’s inherently dangerous and unsupported. |
|
Does introducing additional explicit products for Static/Dynamic linkage actually create any problems? I guess SwiftPM will only build the products that are used as a dependency, so adding those additional ones looks like giving a bit more control to library users, no? |
|
It’s not that it creates problems, just that it’s simpler to let the package manager sort these things out if we can help it. FWIW, the current package manager tries to statically link |
This is particularly useful when creating standalone executables. Generated Xcode project doesn't support this AFAICS, but
swift buildhandles it just right.