Changing build config for a single included package

Using Xcode 11.3 on Mojhave. I have a project that includes a number of packages via SPM integration. I'd like to change one imported package to always compile in release mode, even for debug builds (that package is 3x faster in release mode).


Is this possible?

You'll have to look at the build settings for this package and figure out what settings are different between Release and Debug. I would concentrate on differences in optimization settings, and, if there are C/C++/Objective-C components, you might want to look at the preprocessor macros, but any differences between the Release and Debug build settings should be investigated.


Once you figured out what the significant differences between Release and Debug are for the package in question, you need to change the Debug settings to match the relevant Release settings. I would be careful about this, or give yourself some means by which you can go back to the Debug setting if you ever have to debug this package. Some optimizations commonly used to speed up Release speeds do a lot of code restructuring that makes it extremely difficult to debug, if there is a problem.


You can change the settings manually, or you can put the changes in an .xcconfig file. Note that if you ever end up upgrading the package to a new version, you will need to re-apply the build setting changes. If you use an .xcconfig file to record the changes, you can store that .xcconfig in your project workspace, and re-apply it after the package gets updated.


I'm assuming that the package manifest is not under your control. If you have control over the manifest file contents, there is potential in the .unsafeFlags methods for the swiftSettings/cSettings/cxxSettings method in the target descriptions, but, as the name applies, these are considered unsafe by the SPM builders and maintainers, and there are restrictions on the use of these methods.

Changing build config for a single included package
 
 
Q