常用三方库的跨iOS平台编译(freeimage、gdal、geos、proj4、freetype、cximage)

  • 第三方跨IOS平台编译
    • FreeImage

此次编译使用的Xcode4.6版本 macOS X10.9版本 

1.1打开make –f makefile文件

1.2编译正常完成后生成的对应armv7架构的和模器架构的.a文件。

    • Gdal

xcode4.6应用目录下

此次编译使用的Xcode4.6版本 macOS X10.9版本  gdal版本 1.11.0

1.1 打开https://gist.github.com/JesseCrocker/22eee94485bce5b3a6eabuild_gdal_ios.sh拷入gdal

1.2  打开gdal文件找到build_gdal_ios.sh文件并打开

1.3 配置SDK路径,CC++编译器路径(build_gdal_ios.sh文件第81~97)




platform_dir="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer"

platform_bin_dir="$/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/llvm-gcc-4.2/bin"

platform_sdk_dir="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.1.sdk"

prefix="${prefix}/${arch}/${platform}.platform/${platform}${IPHONEOS_DEPLOYMENT_TARGET}.sdk"


echo

echo library will be exported to $prefix


#setup compiler flags

export CC="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc"

export CFLAGS="-arch ${arch} -pipe -Os -gdwarf-2 -isysroot ${platform_sdk_dir} ${extra_cflags}"

export LDFLAGS="-arch ${arch} -isysroot ${platform_sdk_dir}"

export CXX="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++"

export CXXFLAGS="${CFLAGS}"

export CPP="/Applications/Xcode.app/Contents/Developer/usr/bin/cpp"

export CXXCPP="${CPP}"

echo CFLAGS ${CFLAGS}


重要的相关配置(115~148行)


--enable-static \ 生成静态库

--with-geos=no     是否支持geos

--with-static-proj4=${prefix} \ 是否支持proj4



1.4并保存

1.5 打开

1.6  cd 入文件目


1.7 

行命令

 `sh build_gdal_ios.sh -p "location where you want to save the resulting files" simulator`

例如: 

sh build_gdal_ios.sh -p /Users/stargistj/Desktop/3rd/gdal-1.11.1/lib simulator



生成模拟器的静态库文件。

执行命令

`sh build_gdal_ios.sh -p "location where you want to save the resulting files" -a "architecture" device`

例如:

sh build_gdal_ios.sh -p 

/Users/stargistj/Desktop/3rd/gdal-1.10.1/lib -a armv7 device

生成各个模拟器的静态库文件

1.8 最后行命令生成的模器和真机静态库文件合并

 lipo “armv7路径  armv7s路径 ”-create



    • Geos

geos3.8.8码到桌面使用xcode5.1.1编译

1、打开geos-3.3.8文件修改CMakeLists.txt


在第158行添加有关APPLE平台的内容

(内容为简洁易懂部分保存在GeosMake文本文件内)

目的:使其iOS态库编译

2、打开CMake 2.8-12 将Cmakelist.txt拖入并设置生成目录

点击configure进行配置将所有搜索/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/

的地方修改为搜索

/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/

3、

将geos_svn_revision.h问拷贝到目标文件夹即可

4、进入生成的Xcode工程选择真机进行编译

即可生成对应静态库 




    • proj4

编译环Xcode4.6

1、编build_proj_ios.sh

主要内容有设置编译器路径

#setup compiler flags

export CC="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc"

export CFLAGS="-arch ${arch} -pipe -Os -gdwarf-2 -isysroot ${platform_sdk_dir} ${extra_cflags}"

export LDFLAGS="-arch ${arch} -isysroot ${platform_sdk_dir}"

export CXX="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/g++"

export CXXFLAGS="${CFLAGS}"

export CPP="/Applications/Xcode.app/Contents/Developer/usr/bin/cpp"

export CXXCPP="${CPP}"


设置proj静态库安装路径

proj_prefix="/Users/stargistj/Desktop/iOS_GDAL"


进入proj源码目录

cd /Users/stargistj/Desktop/needlib/proj-4.8.0


对proj进行配置


./configure \

--prefix=${proj_prefix} \

--enable-shared=no \

--enable-static=yes \

--host=$host \

"$@" || exit


安装proj

time make install || exit


该完整内容保存在projsh文本文件中


2、打开终端进入proj源码文件

cd /Users/stargistj/Desktop/needlib/proj-4.8.0

3、执行.sh文件

sh build_proj_ios.sh -p /Users/stargistj/Desktop/libGDAL device


4、在指定目录生成了相应的proj的静态库。


    • freetype

1、打开入源文件

2、依次编译freetype文本文件的命令

3、最在源文件中生成静态库文件


    • cximage

重点:选择xcode4.6编译

将需要编译的源直接在xocde4.6编译即可


评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值