-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Migrate iOS and OS X targets to checked-in Xcode projects #4641
Conversation
Is there an advantage to having multiple .xcodeproj files and a workspace, versus a monolithic .xcodeproj with multiple targets? |
Ultimately, I'd like for there to be a workspace with two projects: one that pulls in mbgl, as generated by gyp, and the other that includes targets for iossdk, iosapp, etc. |
To adjust from the changes in #4608, you'll need to:
I think that's it. |
Another change that I recommend making as part of this is to move all the Objective C sources from the I did this for the osx platform in #4608 but held off for ios because I'm not familiar with the packaging requirements. |
Thanks for trying to minimize conflicts – much appreciated. The OS X SDK project is a little simpler because it only produces a dynamic framework. The iOS project produces an intermediate static framework that we actually ship. I think it'll be possible to move them out of the platform-lib target though. |
772f37b
to
bbe571c
Compare
9b0df97
to
f45a895
Compare
After moving the SDK classes into the dynamic framework proper, the fat framework sees a 40% size reduction versus the 3.2.0 official build (25 MB), a 66% size reduction if you exclude simulator content (12 MB), and that’s before the extra |
7a2d766
to
3884e19
Compare
The size savings are due in part to setting |
3884e19
to
c03e7a5
Compare
a5845a1
to
c1cda8a
Compare
2eec87e
to
d27a6b4
Compare
iOS builds continue to fail on Bitrise but not locally with:
|
I don't know why it would be different on Bitrise than locally for you, but the gyp-generated projects use this hack to force xcodebuild output to |
Added a new Cocoa dynamic framework target target to the main OS X Xcode project. The target is based on the template provided by Xcode. It contains headers and source files in the darwin/ and osx/ subdirectories. Headers are explicitly marked public or project-internal instead of implicitly by subdirectory. Removed the osxsdk target from platform.gypi. The SDK target has a few dependencies that are managed by mason. Transform the config.gypi generated by configure into an .xcconfig file that Xcode uses to fill in compiler and linker flags. Added a CI scheme that builds the All aggregate target generated by gyp and the osxapp and SDK test targets.
Fixed some issues that were obscured by the old gyp-generated build settings.
cf5b1ea
to
6da746a
Compare
Now that #4641 has removed the prohibition against C99 extensions, this change removes many pragma statements that suppress warnings about variadic macros and designated initializers. Designated initializers and Elvis operators have been introduced wherever appropriate.
👏 |
🎉 |
Starting with version 3.3 alpha-1 is not possible to connect a static framework. Perhaps additional settings are needed? Version 3.2 connects without problems. #5071 |
This PR replaces the various iOS-specific targets in ios.xcodeproj and OS X–specific targets in osx.xcodeproj with checked-in targets created within Xcode. The core targets remain in the GYP-generated platform.xcodeproj projects. New Xcode workspaces bind ios.xcodeproj to platform.xcodeproj and manages dependencies between the two; likewise for osx.xcodeproj. The ios.xcworkspace also contains ios-test.xcodeproj and KIF.xcodeproj for convenience. (Although we really should be pulling in KIF via a package manager like CocoaPods: #1522.)
You still set up your development environment with
make iproj
andmake xproj
, but now those make rules open the workspace. Other workflows have been streamlined:make iproj
.make iproj
ormake xproj
with the workspace still open.xcodebuild
command line tool, so you no longer have to rebuild from scratch when switching between the two. Cleaning in one environment automatically affects the other environment.MAPBOX_ACCESS_TOKEN
environment variable no longer gets blown away every time you have to regenerate the GYP targets, as long as you set the variable on a shared scheme (iosapp, ios-bench, CI, etc.) or a non-shared, non-GYP-generated scheme (which could be a duplicate of a GYP-generated scheme).make clean
is more thorough, wiping away Xcode’s index and module cache along with the intermediate files.libmbgl-platform-ios.a has been reduced to a very small library that contains just the iOS-specific code needed by core code. (The same was done for libmbgl-platform-osx.a in #4608.) The iOS SDK dynamic framework and iOS SDK static library link the core static libraries directly, making it possible for the two to have differing content should the need ever arise. To significantly reduce binary sizes and build times, the iOS SDK no longer builds the
armv7s
slice; iPhone 5 and iPhone 5c will fall back to thearmv7
slice automatically without a noticeable performance hit.make test-ios
additionally runs the same “Darwin” unit tests that we’ve been running against the OS X SDK. It’d be trivial to add functional tests (whether the existing KIF tests or future XCUITest tests) to this make rule.The workspaces come with disabled Objective-C exception breakpoints by default. They also include schemes that exactly replicate what gets built on Bitrise and what gets built by package.sh for distribution.
Project upgrade warnings in GYP targets have been fixed. The default warnings that come with Xcode’s target templates exposed some additional warnings for issues that have been lurking silently in GYP-generated targets; those issues have been fixed. Conversely, the iOS and OS X targets no longer pull in pedantic warnings (treated as errors) from the core targets, so now we can use modern Objective-C syntax, including designated initializers.
The new iOS SDK static library target comes with
OTHER_LDFLAGS=-ObjC
by default, so the various workarounds we’ve been using to avoid-ObjC
have been removed. The size decrease from removing thearmv7s
slice and from switching to-Os
optimization in #3183 more than makes up for the addition of-ObjC
. Developers who manually install the static framework no longer need to set-ObjC
in their own application targets, so the net effect is a potentially drastic decrease in application size.Numerous images used by iosapp and the iOS benchmarking application have been placed inside asset catalogs. Storyboards are now localizable. Unused SVG files have been removed from the SDK’s resource bundle.
Fold ios-tests.xcodeproj into ios.xcodeprojFixes #3275, fixes #4481, fixes #4191, fixes #4264, fixes #4704, and fixes #4495.
/cc @boundsj @friedbunny @jfirebaugh @kkaefer