-
Notifications
You must be signed in to change notification settings - Fork 134
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
Embed framework #62
Comments
@hartman Have you fix this problem?I add some code,and it works. |
@akame no, not really. The issues I encountered were: |
@hartman Did you use XCSourceFile or another approach? We can either update docs with working solution or provide a dedicated method. |
I hacked something up with hardcoded modifiers etc, but it's not really usable for anyone else due to the hardcoded assumptions I make and unfortunately it doesn't seem like I have any time available soon to fix it 'properly'. The proper way would be to move the 'build file' identifier logic that is in XSourceFile (see the buildFileKey property) into the buildPhases logic of XCTarget instead, or even to make build phases and their keys a separate class. The build fileref entries also need their own build attribute properties, since embedded frameworks carry the attributes Some relevant fragments from an actual project file: Sourcefile entry:
Buildkey entries:
These are then referenced from two buildphases
Note how EmbedFrameworks is a rather generic CopyFilesBuildPhase, with the distinguishing feature of it being named "Embed Frameworks", which is... well if I were Apple, I think I'd simply introduced a new PBX build phase class for that, instead of relying on a strcmp to a modifiable name... Also this build phase is not present by default in Xcode projects, so you need to create it manually, which is another problem, since that is another thing that isn't implemented in XcodeEditor yet. Oh, and you have to add this to your build configuration.
assuming your framework is 'somewhere' inside your project dir. |
Oh, and you need to figure out how you would be able to distinguish between an old style static framework and a embedded framework, because they require different 'addMember' strategies and I haven't really been able to find a good/reliable/efficient way to (on the fly) distinguish the two. If anyone has any good tips for that, love to hear them. |
I add some Code
****in XCTarget.m ***
***_in XCSourceFile.m_
|
Of course we should change buildFileKey function in XCSourceFile.m
_XCSourceFile.m_ |
At last I change XcodeBuildConfiguration: for (NSString *configName in [target configurations]) { //Debug Release XCProjectBuildConfig *config = [target configurationWithName:configName]; NSString *ldRunPath = @"$(inherited) @executable_path/Frameworks"; [config addOrReplaceSetting:ldRunPath forKey:@"LD_RUNPATH_SEARCH_PATHS"]; } |
@akame thanks! it works. |
Anyone figured out a way to add a framework to a target and add it to the embed binaries build phase ?
The text was updated successfully, but these errors were encountered: