Skip to content

Commit

Permalink
添加build脚本
Browse files Browse the repository at this point in the history
  • Loading branch information
chenliming committed Oct 21, 2016
1 parent 8b39f68 commit 3f80463
Show file tree
Hide file tree
Showing 2 changed files with 129 additions and 2 deletions.
100 changes: 98 additions & 2 deletions FrameWork/LFLiveKit.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,21 @@
objectVersion = 46;
objects = {

/* Begin PBXAggregateTarget section */
84D003751DB8FE1000560583 /* LFLiveKitFramework-universal */ = {
isa = PBXAggregateTarget;
buildConfigurationList = 84D003761DB8FE1000560583 /* Build configuration list for PBXAggregateTarget "LFLiveKitFramework-universal" */;
buildPhases = (
84D0037B1DB8FE1C00560583 /* ShellScript */,
);
dependencies = (
84D0037A1DB8FE1800560583 /* PBXTargetDependency */,
);
name = "LFLiveKitFramework-universal";
productName = "LFLiveKitFramework-universal";
};
/* End PBXAggregateTarget section */

/* Begin PBXBuildFile section */
8495F66F1DB8F14600542124 /* LFLiveKitFramework.h in Headers */ = {isa = PBXBuildFile; fileRef = 8495F66D1DB8F14600542124 /* LFLiveKitFramework.h */; settings = {ATTRIBUTES = (Public, ); }; };
8495F6731DB8F1EE00542124 /* LFAudioCapture.h in Headers */ = {isa = PBXBuildFile; fileRef = 84D8B5851D768B6E00752B56 /* LFAudioCapture.h */; };
Expand Down Expand Up @@ -110,6 +125,16 @@
84D8B5EA1D768B6E00752B56 /* NSMutableArray+LFAdd.m in Sources */ = {isa = PBXBuildFile; fileRef = 84D8B5BA1D768B6E00752B56 /* NSMutableArray+LFAdd.m */; };
/* End PBXBuildFile section */

/* Begin PBXContainerItemProxy section */
84D003791DB8FE1800560583 /* PBXContainerItemProxy */ = {
isa = PBXContainerItemProxy;
containerPortal = 84D8B3871D7574D600752B56 /* Project object */;
proxyType = 1;
remoteGlobalIDString = 8495F66A1DB8F14600542124;
remoteInfo = LFLiveKitFramework;
};
/* End PBXContainerItemProxy section */

/* Begin PBXFileReference section */
8495F66B1DB8F14600542124 /* LFLiveKit.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = LFLiveKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
8495F66D1DB8F14600542124 /* LFLiveKitFramework.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = LFLiveKitFramework.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -429,6 +454,7 @@
8495F6671DB8F14600542124 /* Frameworks */,
8495F6681DB8F14600542124 /* Headers */,
8495F6691DB8F14600542124 /* Resources */,
84D0037D1DB9023F00560583 /* ShellScript */,
);
buildRules = (
);
Expand Down Expand Up @@ -469,6 +495,11 @@
CreatedOnToolsVersion = 8.0;
ProvisioningStyle = Automatic;
};
84D003751DB8FE1000560583 = {
CreatedOnToolsVersion = 8.0;
DevelopmentTeam = G497YX6CBT;
ProvisioningStyle = Automatic;
};
84D8B38F1D7574D600752B56 = {
CreatedOnToolsVersion = 7.3.1;
};
Expand All @@ -488,6 +519,7 @@
targets = (
84D8B38F1D7574D600752B56 /* LFLiveKit */,
8495F66A1DB8F14600542124 /* LFLiveKitFramework */,
84D003751DB8FE1000560583 /* LFLiveKitFramework-universal */,
);
};
/* End PBXProject section */
Expand All @@ -502,6 +534,35 @@
};
/* End PBXResourcesBuildPhase section */

/* Begin PBXShellScriptBuildPhase section */
84D0037B1DB8FE1C00560583 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "../scripts/build-universal-framework.sh\n";
};
84D0037D1DB9023F00560583 /* ShellScript */ = {
isa = PBXShellScriptBuildPhase;
buildActionMask = 2147483647;
files = (
);
inputPaths = (
);
outputPaths = (
);
runOnlyForDeploymentPostprocessing = 0;
shellPath = /bin/sh;
shellScript = "echo \"${env}\"";
};
/* End PBXShellScriptBuildPhase section */

/* Begin PBXSourcesBuildPhase section */
8495F6661DB8F14600542124 /* Sources */ = {
isa = PBXSourcesBuildPhase;
Expand Down Expand Up @@ -563,6 +624,14 @@
};
/* End PBXSourcesBuildPhase section */

/* Begin PBXTargetDependency section */
84D0037A1DB8FE1800560583 /* PBXTargetDependency */ = {
isa = PBXTargetDependency;
target = 8495F66A1DB8F14600542124 /* LFLiveKitFramework */;
targetProxy = 84D003791DB8FE1800560583 /* PBXContainerItemProxy */;
};
/* End PBXTargetDependency section */

/* Begin XCBuildConfiguration section */
8495F6711DB8F14600542124 /* Debug */ = {
isa = XCBuildConfiguration;
Expand All @@ -588,6 +657,7 @@
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MACH_O_TYPE = staticlib;
OTHER_LDFLAGS = "-ObjC";
PRODUCT_BUNDLE_IDENTIFIER = com.youku.LFLiveKit;
PRODUCT_NAME = LFLiveKit;
SKIP_INSTALL = YES;
Expand Down Expand Up @@ -618,12 +688,29 @@
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
MACH_O_TYPE = staticlib;
OTHER_LDFLAGS = "-ObjC";
PRODUCT_BUNDLE_IDENTIFIER = com.youku.LFLiveKit;
PRODUCT_NAME = LFLiveKit;
SKIP_INSTALL = YES;
};
name = Release;
};
84D003771DB8FE1000560583 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
DEVELOPMENT_TEAM = G497YX6CBT;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Debug;
};
84D003781DB8FE1000560583 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
DEVELOPMENT_TEAM = G497YX6CBT;
PRODUCT_NAME = "$(TARGET_NAME)";
};
name = Release;
};
84D8B3961D7574D600752B56 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
Expand Down Expand Up @@ -723,7 +810,7 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
HEADER_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/../LFLiveKitDemo/Pods\"/**",
"\"$(SRCROOT)/../samples/LFLiveKitDemo/Pods\"/**",
);
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
Expand All @@ -747,7 +834,7 @@
DYLIB_INSTALL_NAME_BASE = "@rpath";
HEADER_SEARCH_PATHS = (
"$(inherited)",
"\"$(SRCROOT)/../LFLiveKitDemo/Pods\"/**",
"\"$(SRCROOT)/../samples/LFLiveKitDemo/Pods\"/**",
);
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
Expand All @@ -774,6 +861,15 @@
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
84D003761DB8FE1000560583 /* Build configuration list for PBXAggregateTarget "LFLiveKitFramework-universal" */ = {
isa = XCConfigurationList;
buildConfigurations = (
84D003771DB8FE1000560583 /* Debug */,
84D003781DB8FE1000560583 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
84D8B38A1D7574D600752B56 /* Build configuration list for PBXProject "LFLiveKit" */ = {
isa = XCConfigurationList;
buildConfigurations = (
Expand Down
31 changes: 31 additions & 0 deletions scripts/build-universal-framework.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/sh

UNIVERSAL_OUTPUT_FOLDER="${PROJECT_DIR}/build/"

# make the output directory and delete the framework directory
mkdir -p "${UNIVERSAL_OUTPUT_FOLDER}"
rm -rf "${UNIVERSAL_OUTPUT_FOLDER}/${PROJECT_NAME}.framework"

# Step 1. Build Device and Simulator versions
xcodebuild -target "${PROJECT_NAME}" ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphoneos BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build
xcodebuild -target "${PROJECT_NAME}" ONLY_ACTIVE_ARCH=NO -configuration ${CONFIGURATION} -sdk iphonesimulator BUILD_DIR="${BUILD_DIR}" BUILD_ROOT="${BUILD_ROOT}" clean build

# Step 2. Copy the framework structure to the universal folder
echo "==============Step 2=============="
echo "${BUILD_DIR}/${CONFIGURATION}-iphoneos/${PROJECT_NAME}.framework"

cp -R "${BUILD_DIR}/${CONFIGURATION}-iphoneos/${PROJECT_NAME}.framework" "${UNIVERSAL_OUTPUT_FOLDER}/"

# Step 3. Create universal binary file using lipo and place the combined executable in the copied framework directory
lipo -create -output "${UNIVERSAL_OUTPUT_FOLDER}/${PROJECT_NAME}.framework/${PROJECT_NAME}" "${BUILD_DIR}/${CONFIGURATION}-iphonesimulator/${PROJECT_NAME}.framework/${PROJECT_NAME}" "${BUILD_DIR}/${CONFIGURATION}-iphoneos/${PROJECT_NAME}.framework/${PROJECT_NAME}"

echo "==============Completion=============="
echo "${UNIVERSAL_OUTPUT_FOLDER}/${PROJECT_NAME}.framework/${PROJECT_NAME}"

# Step 4. Copy strings bundle if exists
STRINGS_INPUT_FOLDER="${PROJECT_NAME}Strings.bundle"
if [ -d "${STRINGS_INPUT_FOLDER}" ]; then
STRINGS_OUTPUT_FOLDER="${UNIVERSAL_OUTPUT_FOLDER}/${PROJECT_NAME}Strings.bundle"
rm -rf "${STRINGS_OUTPUT_FOLDER}"
cp -R "${STRINGS_INPUT_FOLDER}" "${STRINGS_OUTPUT_FOLDER}"
fi

0 comments on commit 3f80463

Please sign in to comment.