Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SWIFT_COMPILATION_MODE setting is going into SWIFT_OPTIMIZATION_LEVEL #33

Closed
rynosoft opened this issue Oct 23, 2018 · 4 comments
Closed
Assignees

Comments

@rynosoft
Copy link

Extractor did not write the SWIFT_COMPILATION_MODE into the config file. It appears it appended the setting to the SWIFT_OPTIMIZATION_LEVEL setting.

Here's an excerpt:

// Swift Optimization Level
// 
// * *None:* Compile without any optimization. [-Onone]
// * *Optimize for Speed:* [-O]
// * *Optimize for Size:* [-Osize]
// * *Whole Module Optimization:* [-O -whole-module-optimization]

SWIFT_OPTIMIZATION_LEVEL = -Owholemodule
@dempseyatgithub
Copy link
Owner

I haven't been able to reproduce what you are seeing @rynosoft. It would be helpful to be able to see the original Xcode project file you used to generate the xcconfig files. I don't need any of the source files, just the zipped up xcodeproj bundle. If you don't want to attach it here, where it is public, you can email it to [email protected].

Alternately, if you take a screenshot of the Swift build settings in the original project, that could help me figure out what is happening.

(While you have the project selected in Xcode, view the Build Settings. Make sure All and Levels are selected. If you use the search field to filter on Swift, the relevant settings should be visible. A screen shot of these settings in the original project would also help figure out what happened.)

Thank you.
screen shot 2018-10-23 at 4 15 19 pm

@dempseyatgithub
Copy link
Owner

Thank you @rynosoft for sending me your project file and screen shot.

I was able to reproduce what you are seeing with a project created in Xcode 9.0.

At that point, there was a SWIFT_OPTIMIZATION_LEVEL setting -Owholemodule. It had the effect of turning on -O optimization as well as whole module compilation.

With Swift 4.1, it looks like a new SWIFT_COMPILATION_MODE build setting was added with the options singlefile and wholemodule.

Xcode projects created prior to Swift 4.1 used the -Owholemodule setting.

But, at least in Xcode 10 (And possibly as early as Xcode 9.2), even though the setting in the project file remains SWIFT_OPTIMIZATION_LEVEL = -Owholemodule, that one setting appears in the Xcode user interface as the two different settings you are seeing.

So, Build Setting Extractor is behaving as expected and extracting the build setting exactly as it is in the project file.

I've filed #34 to track how to approach situations like this. (I'm reluctant to have Build Setting Extractor try to update the settings in the project. It seems a better approach to extract exactly what is there and then perhaps provide some guidance of things a developer might look at updating.)

In this case, for the Release build settings, I would probably change:
SWIFT_OPTIMIZATION_LEVEL = -Owholemodule
to
SWIFT_OPTIMIZATION_LEVEL = -O
and add the newer setting as well:
SWIFT_COMPILATION_MODE = wholemodule

I'll leave this issue open for a few days in case you have any additional comments @rynosoft, but it is behaving as expected, so I intend to close this issue. Thank you for reporting this and for your help in tracking down what was happening. (And feel free to comment in Issue #34 as well.)

@rynosoft
Copy link
Author

Thanks for looking into this. Keeping Build Setting Extractor as-is seems like the right course.

@dempseyatgithub
Copy link
Owner

Thank you. Closing now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants