Compiling external C++ library for use with iOS project

后端 未结 6 1607
滥情空心
滥情空心 2020-11-29 01:49

I\'m completely new to using C++ libraries, so appreciate this might be a bit specific for my case (let me know and I can provide more details).

I have an external

6条回答
  •  长情又很酷
    2020-11-29 02:22

    The script by Mobile Ben is great, apart from the final line hardcodes a library filename into the script. The following is a replacement for the last lipo command and dynamically uses lipo merges each library file created after compilation.

    Change Mobile Ben's line:

    $LIPO -create $pwd/output/armv7/lib/libpresage.a  $pwd/output/armv7s/lib/libpresage.a $pwd/output/arm64/lib/libpresage.a $pwd/output/x86_64/lib/libpresage.a $pwd/output/i386/lib/libpresage.a -output libpresage.a
    

    to:

    for t in `ls $pwd/output/armv7/lib/*.a` ;
    do
            export LIB=`basename $t`
            export ARCHSTRING=""
            for a in `ls $pwd/output`
            do
                    export ARCSTRING="$ARCSTRING $pwd/output/$a/lib/$LIB "
            done
            $LIPO -create $ARCSTRING  -output $LIB
    done
    

    Note: I didn't want to edit Mobile Ben's answer with new code functionality, and adding this as a comment lost formatting.

提交回复
热议问题