Compile (only) certain files with optimization

I would like to compile certain performance-critical files (modules would also be fine) with -O (or -c release) but still keep debugging functionality for everything else. Is there some attribute I can use for this in the file itself?

Is there some other sanctioned way of doing this with SwiftPM? I can make an Xcode target and provide different compiler flags for it, but this does not fit in with building for non-Apple platforms.

1 Like