What exactly does `-c release` do?

Hi!

1: What exactly does -c release do when passed to swiftui build in a package? From looking at SPMs source briefly, I'd say things like -Xlinker -dead_strip, -O, and -O2 (C flag, so probably with -Xcc?), but is that documented anywhere?

2: I'd like to reproduce the same behavior by invoking swiftc, is that possible; and if so, how?

cheers

I can't speak to the linker flags, but broadly speaking it enables whole-module compilation (-wmo swiftc flag) and optimizations (-O).

swiftc -wmo -O -module-name MyApp file1.swift file2.swift file3.swift

Note that -wmo doesn't do anything if there is only one source file.

Add --verbose or --very-verbose to your swift build command.

4 Likes

Thanks!