搜索iOS上OpenCL信息的时候找到这篇文章,针对Xcode 5做了一些修改,最终在iPhone上跑起来了~但有报错,不得不留言麻烦linusyang兄看看~
makefile里的一些配置,在Xcode 5里有所改变,主要是安装Command Line Tools之后,路径变了,现在的配置是:
CC = /usr/bin/clang
LD = /usr/bin/ld
LDID = /usr/local/bin/ldid
CFLAGS = -arch armv7 -Os -I/Applications/
Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/include/ -I./include -framework OpenCL -miphoneos-version-min=3.0 -L/Applications/
Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/usr/lib/ -F/Applications/
Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk/System/Library/PrivateFrameworks -isysroot /Applications/
Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.0.sdk其中ldid需要自己在网上找一下。
但我不知道怎么用make之后的binary……最终还是用Xcode 5来测试~
具体操作是:
1,新建一个项目。
2,删掉AppDelegate等ObjC的文件,删掉main.m,删掉UnitTest相关文件。
3,将include文件夹、endianness.c和transmission.c添加到项目
4,在项目Target设置的Header Search Paths里面,添加include目录所在路径
5,endianness.c、transmission.c这两个文件,只要有一个勾上Target Membership即可。
6,然后真机运行测试。
我遇到的报错分别是:
[OpenCL Endianness Demo - Linus Yang]
[Device: ARM CPU Compute Device]
Error: Failed to build program executable!
<program source>:9:9: warning: comparison of integers of different signs: 'int' and 'const unsigned int'
if(i < count)
~ ^ ~~~~~
[OpenCL Transmission Demo - Linus Yang]
[Device: ARM CPU Compute Device]
Step 1: 15.063000 ms, 531.102702 MB/s
Error: Failed to build program executable!
<program source>:8:9: warning: comparison of integers of different signs: 'int' and 'const unsigned int'
if(i < count)
~ ^ ~~~~~
我对OpenCL完全陌生,不知道该怎么处理这些错误。如果linusyang兄有时间的话,请指点一二~