Monday, 15 March 2010

xcode - Making Multi-Architecture iOS and Mac OS Frameworks -



xcode - Making Multi-Architecture iOS and Mac OS Frameworks -

i'm having issues developing framework new xcode 6 dynamic framework target.

basically, need same result old way (explained in tutorial).

i tried this, problem framework produces couple of arm binaries. need have i386/x86_64 binaries in there, well, finish framework.

i'm sure i'm overlooking something. have clue clueless person?

yeah, looks isn't interesting folks.

ah, well. did going improve version of wenderlich script, i'll post here.

this has important advantage of beingness "first class citizen" framework; not ios8-only dynamic version produced new target.

#! /bin/sh # cribbed here: http://www.raywenderlich.com/65964/create-a-framework-for-ios # script build multiplatform framework project referenced $framework_product_name environment variable. # variable needs set user-defined value in build settings of target (an aggregate target runs script). # project must have static lib target, exact name defined $framework_product_name, , output target needs # static lib "lib${framework_product_name}.a". static lib target needs have "debug" , "release" configuration, # debug configuration embedding symbols/profiling info (as opposed separate dsym file). # no stripping should done non-debug in either configuration (but advised strip debug symbols in "release"). # aggregate target should define $deliverable_directory environment variable. relative posix path ${build_dir} # location, place user wants deliver framework. script create "framework" directory there, "debug" , # "release" directory; each containing re-create of framework. # static lib target needs create "headers" directory exported headers, , "resources" directory (even if empty). set -e # if we're within script die if [ -n "$multiplatform_build_in_progress" ]; exit 0 fi export multiplatform_build_in_progress=1 # function runs static lib target build, in configuration requested. # input: sdk, configuration (either "debug" or "release"), target name function build_static_library { xcrun xcodebuild -project "${project_file_path}" \ -sdk "${1}" \ -configuration "${2}" \ -target "${3}" \ only_active_arch=no \ build_dir="${build_dir}" \ objroot="${objroot}" \ build_root="${build_root}" \ symroot="${symroot}" $action } # function build iphoneos , iphonesimulator versions of framework, , # utilize lipo merge them "fat" binary contains x86 , arm code. # re-create headers , resources framework, static lib target needs create # "headers" directory exported headers, , "resources" directory (even if empty). # input: configuration (example: "release" or "debug"). function buildtwoarchitectures { # 1 - extract platform (iphoneos/iphonesimulator) sdk name if [[ "$sdk_name" =~ ([a-za-z]+) ]]; sdk_platform=${bash_rematch[1]} else echo "could not find platform name sdk_name: $sdk_name" exit 1 fi # 2 - extract version sdk if [[ "$sdk_name" =~ ([0-9]+.*$) ]]; sdk_version=${bash_rematch[1]} else echo "could not find sdk version sdk_name: $sdk_name" exit 1 fi if [ "$sdk_platform" == "iphoneos" ]; other_platform="iphonesimulator" else other_platform="iphoneos" fi # build other platform. build_static_library "${sdk_platform}${sdk_version}" "${1}" "${framework_product_name}" build_static_library "${other_platform}${sdk_version}" "${1}" "${framework_product_name}" built_products_dir="${build_dir}/${1}-${sdk_platform}" other_built_products_dir="${build_dir}/${1}-${other_platform}" # create path real headers dir mkdir -p "${build_dir}/${framework_product_name}.framework/versions/a/headers" mkdir -p "${build_dir}/${framework_product_name}.framework/versions/a/resources" # create required symlinks ln -sfh "${build_dir}/${framework_product_name}.framework/versions/current" ln -sfh versions/current/headers "${build_dir}/${framework_product_name}.framework/headers" ln -sfh versions/current/resources "${build_dir}/${framework_product_name}.framework/resources" ln -sfh "versions/current/${framework_product_name}" "${build_dir}/${framework_product_name}.framework/${framework_product_name}" # re-create public headers framework cp -a "${built_products_dir}/headers/" "${build_dir}/${framework_product_name}.framework/versions/a/headers" # re-create resources framework. cp -a "${built_products_dir}/resources/" "${build_dir}/${framework_product_name}.framework/versions/a/resources" # bring together 2 static libs 1 , force .framework lipo -create "${built_products_dir}/libnkptpf.a" "${other_built_products_dir}/libnkptpf.a" \ -output "${build_dir}/${framework_product_name}.framework/versions/a/${framework_product_name}" # move resultant framework our delivery location. rm -drf "${build_dir}/${deliverable_directory}/framework/${1}/" mkdir -p "${build_dir}/${deliverable_directory}/framework/${1}/" mv -f "${build_dir}/${framework_product_name}.framework" "${build_dir}/${deliverable_directory}/framework/${1}/" } # create so, numbah one... buildtwoarchitectures "debug" buildtwoarchitectures "release"

xcode frameworks ios8

No comments:

Post a Comment