Skip to content

Commit acc869f

Browse files
committed
Support iOS
1 parent 1122a5b commit acc869f

File tree

7 files changed

+124
-0
lines changed

7 files changed

+124
-0
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,5 @@ before_install:
44
- gem install xcpretty --no-document
55
script:
66
- set -o pipefail && xcodebuild -project Commander.xcodeproj -scheme Commander -sdk macosx test | xcpretty -c
7+
- set -o pipefail && xcodebuild -project Commander.xcodeproj -scheme Commander -sdk iphonesimulator ONLY_ACTIVE_ARCH=NO test | xcpretty -c
78
- pod lib lint

Commander.xcodeproj/project.pbxproj

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@
3232
/* End PBXContainerItemProxy section */
3333

3434
/* Begin PBXFileReference section */
35+
27593EE51BB335590018278E /* UniversalFramework_Base.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = UniversalFramework_Base.xcconfig; sourceTree = "<group>"; };
36+
27593EE61BB335590018278E /* UniversalFramework_Framework.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = UniversalFramework_Framework.xcconfig; sourceTree = "<group>"; };
37+
27593EE71BB335590018278E /* UniversalFramework_Test.xcconfig */ = {isa = PBXFileReference; lastKnownFileType = text.xcconfig; path = UniversalFramework_Test.xcconfig; sourceTree = "<group>"; };
3538
2768A2201BACC38C00F994EE /* Commander.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Commander.framework; sourceTree = BUILT_PRODUCTS_DIR; };
3639
2768A2231BACC38C00F994EE /* Commander.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Commander.h; sourceTree = "<group>"; };
3740
2768A2251BACC38C00F994EE /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
@@ -69,9 +72,20 @@
6972
/* End PBXFrameworksBuildPhase section */
7073

7174
/* Begin PBXGroup section */
75+
27593EE21BB335590018278E /* xcconfigs */ = {
76+
isa = PBXGroup;
77+
children = (
78+
27593EE51BB335590018278E /* UniversalFramework_Base.xcconfig */,
79+
27593EE61BB335590018278E /* UniversalFramework_Framework.xcconfig */,
80+
27593EE71BB335590018278E /* UniversalFramework_Test.xcconfig */,
81+
);
82+
path = xcconfigs;
83+
sourceTree = "<group>";
84+
};
7285
2768A2161BACC38C00F994EE = {
7386
isa = PBXGroup;
7487
children = (
88+
27593EE21BB335590018278E /* xcconfigs */,
7589
279256B91BB32E4200E66B9E /* Commander.playground */,
7690
2768A2221BACC38C00F994EE /* Commander */,
7791
2768A22E1BACC38C00F994EE /* CommanderTests */,
@@ -340,6 +354,7 @@
340354
};
341355
2768A2351BACC38C00F994EE /* Debug */ = {
342356
isa = XCBuildConfiguration;
357+
baseConfigurationReference = 27593EE61BB335590018278E /* UniversalFramework_Framework.xcconfig */;
343358
buildSettings = {
344359
CLANG_ENABLE_MODULES = YES;
345360
COMBINE_HIDPI_IMAGES = YES;
@@ -360,6 +375,7 @@
360375
};
361376
2768A2361BACC38C00F994EE /* Release */ = {
362377
isa = XCBuildConfiguration;
378+
baseConfigurationReference = 27593EE61BB335590018278E /* UniversalFramework_Framework.xcconfig */;
363379
buildSettings = {
364380
CLANG_ENABLE_MODULES = YES;
365381
COMBINE_HIDPI_IMAGES = YES;
@@ -379,6 +395,7 @@
379395
};
380396
2768A2381BACC38C00F994EE /* Debug */ = {
381397
isa = XCBuildConfiguration;
398+
baseConfigurationReference = 27593EE71BB335590018278E /* UniversalFramework_Test.xcconfig */;
382399
buildSettings = {
383400
COMBINE_HIDPI_IMAGES = YES;
384401
INFOPLIST_FILE = CommanderTests/Info.plist;
@@ -390,6 +407,7 @@
390407
};
391408
2768A2391BACC38C00F994EE /* Release */ = {
392409
isa = XCBuildConfiguration;
410+
baseConfigurationReference = 27593EE71BB335590018278E /* UniversalFramework_Test.xcconfig */;
393411
buildSettings = {
394412
COMBINE_HIDPI_IMAGES = YES;
395413
INFOPLIST_FILE = CommanderTests/Info.plist;

xcconfigs/LICENSE

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2015 Marius Rackwitz
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
22+

xcconfigs/README.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# xcconfigs for Universal Frameworks
2+
3+
> Build iOS, OS X and watchOS frameworks on base of one target.
4+
5+
If you maintain a framework on multiple platforms, you usually have to duplicate your framework target. Normally you have to maintain all build settings in two or more places, and then you have to duplicate the target membership lists for all source code files and build phases.
6+
7+
This project intends to aggregate common or universal Xcode configuration settings, specifically for frameworks. Keeping them in hierarchical Xcode configuration files for easy modification and reuse. All build settings for platform-specific values are scoped by conditional variable assignments. This means you can have one framework target and select at build time, which platform it should be build against and the right default build settings are selected automatically.
8+
9+
## Usage
10+
11+
### Manual Integration
12+
13+
1. `$ git submodule add https://github.com/mrackwitz/xcconfigs.git xcconfigs`
14+
* Drop the files into the root group of your framework target.
15+
* Make sure to check `Create groups` instead of `Create folder references`
16+
* Select the project in the file navigator
17+
* Select the project in the left pane of the project editor
18+
* Select the Info tab
19+
* Expand the Configurations pane, if needed
20+
* Expand `Debug`, `Release` and further configurations, if present
21+
* Select `UniversalFramework_Framework` for your framework target
22+
* Select `UniversalFramework_Test` for your test target of your framework target
23+
24+
### Carthage
25+
26+
Carthage supports universal frameworks on master.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//
2+
// Put this file alongside to the other both, as it contains what
3+
// both have in common. Don't rename this file.
4+
//
5+
// Copyright (c) 2014-2015 Marius Rackwitz. All rights reserved.
6+
//
7+
8+
// Make it universal
9+
SUPPORTED_PLATFORMS = macosx iphonesimulator iphoneos watchos watchsimulator
10+
VALID_ARCHS[sdk=macosx*] = i386 x86_64
11+
VALID_ARCHS[sdk=iphoneos*] = arm64 armv7 armv7s
12+
VALID_ARCHS[sdk=iphonesimulator*] = arm64 armv7 armv7s
13+
VALID_ARCHS[sdk=watchos*] = armv7k
14+
VALID_ARCHS[sdk=watchsimulator*] = armv7k
15+
16+
// Dynamic linking uses different default copy paths
17+
LD_RUNPATH_SEARCH_PATHS[sdk=macosx*] = $(inherited) '@executable_path/../Frameworks' '@loader_path/Frameworks'
18+
LD_RUNPATH_SEARCH_PATHS[sdk=iphoneos*] = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
19+
LD_RUNPATH_SEARCH_PATHS[sdk=iphonesimulator*] = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
20+
LD_RUNPATH_SEARCH_PATHS[sdk=watchos*] = $(inherited) '@executable_path/Frameworks'
21+
LD_RUNPATH_SEARCH_PATHS[sdk=watchsimulator*] = $(inherited) '@executable_path/Frameworks'
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
//
2+
// Inherit from this config in your framework target.
3+
//
4+
// Copyright (c) 2014-2015 Marius Rackwitz. All rights reserved.
5+
//
6+
7+
#include "UniversalFramework_Base.xcconfig"
8+
9+
// OSX-specific default settings
10+
FRAMEWORK_VERSION[sdk=macosx*] = A
11+
COMBINE_HIDPI_IMAGES[sdk=macosx*] = YES
12+
13+
// iOS-specific default settings
14+
CODE_SIGN_IDENTITY[sdk=iphoneos*] = iPhone Developer
15+
TARGETED_DEVICE_FAMILY[sdk=iphonesimulator*] = 1,2
16+
TARGETED_DEVICE_FAMILY[sdk=iphone*] = 1,2
17+
18+
// Watch-specific default settings
19+
TARGETED_DEVICE_FAMILY[sdk=watchsimulator*] = 4
20+
TARGETED_DEVICE_FAMILY[sdk=watch*] = 4
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
//
2+
// Inherit from this config in the test target for your framework.
3+
//
4+
// Copyright (c) 2014-2015 Marius Rackwitz. All rights reserved.
5+
//
6+
7+
#include "UniversalFramework_Base.xcconfig"
8+
9+
FRAMEWORK_SEARCH_PATHS = $(inherited) '$(PLATFORM_DIR)/Developer/Library/Frameworks'
10+
11+
// Yep.
12+
LD_RUNPATH_SEARCH_PATHS[sdk=macosx*] = $(inherited) '@executable_path/../Frameworks' '@loader_path/../Frameworks'
13+
LD_RUNPATH_SEARCH_PATHS[sdk=iphoneos*] = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
14+
LD_RUNPATH_SEARCH_PATHS[sdk=iphonesimulator*] = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
15+
LD_RUNPATH_SEARCH_PATHS[sdk=watchos*] = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
16+
LD_RUNPATH_SEARCH_PATHS[sdk=watchsimulator*] = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'

0 commit comments

Comments
 (0)