如何构建一个链接到iPhone Simulator SDK的命令行工具? [英] How do I build a command line tool that links against the iPhone Simulator SDK?
问题描述
通过检查出现在Xcode构建窗口中的命令行,我得到了这样的结果(在Makefile格式中,为了清楚起见,认真!):
ARCH = i386
PLATFORM = / Developer / Platforms / iPhoneSimulator.platform / Developer
GCC = $(PLATFORM)/usr/bin/gcc-4.2
ISYSROOT = $(PLATFORM)/SDKs/iPhoneSimulator3.2.sdk
glsllint:glsllint.c
$(GCC)-arch $(ARCH)-isysroot $(ISYSROOT)-mmacosx-version- min = 10.5 -framework OpenGLES \
glsllint.c -o glsllint
C文件本身很小;它只包含对 glCreateShader()
的调用,以便我可以判断它是否正确链接。上面提供了一个可执行文件,但是当我尝试运行它时:
dyld:库未加载:/ System / Library / Frameworks /OpenGLES.framework/OpenGLES
这是错误的位置。我该如何做到这一点,所以可执行文件在正确的位置寻找框架?
我知道这不被支持,但该死的,如果它不是很酷工作?要清楚的是,我不希望这个程序绘制任何东西,我只是想加载着色器源代码,使用OpenGL编译它,并打印出错误(如果有的话)。
$ b $现在,问题是,我可以生成一个运行的可执行文件吗? 我没有Mac或iPhone模拟器,所以我不能真正解决问题的这个方面,但是你能链接到不同的OpenGL ES实现的库吗?例如。 OpenTK 或文森特。
这可能不匹配iPhone的100%执行,但可能会让你关闭。
Why the hell would I want to do that? The OpenGL Shader Builder is a great development tool, but it compiles shaders using desktop OpenGL, which allows some things that ES does not. I figure if I can create a tool that links against the OpenGLES.framework in the iPhone Simulator SDK, I can get some error reporting without having to build/install/run my application.
By inspecting the command lines appearing in the Xcode build window, I got as far as this (in Makefile format, for clarity. Seriously!):
ARCH=i386
PLATFORM=/Developer/Platforms/iPhoneSimulator.platform/Developer
GCC=$(PLATFORM)/usr/bin/gcc-4.2
ISYSROOT=$(PLATFORM)/SDKs/iPhoneSimulator3.2.sdk
glsllint: glsllint.c
$(GCC) -arch $(ARCH) -isysroot $(ISYSROOT) -mmacosx-version-min=10.5 -framework OpenGLES \
glsllint.c -o glsllint
The C file itself is minimal; it contains only a call to glCreateShader()
, so that I can tell if it is linking properly. The above produces an executable, but when I try to run it:
dyld: Library not loaded: /System/Library/Frameworks/OpenGLES.framework/OpenGLES
That's the wrong location. How do I make it so the executable looks for the framework in the correct location?
I know this is not supported, but damn, wouldn't it be cool if it worked? To be clear, I'm not expecting this program to draw anything, I just want to load shader source code, use OpenGL to compile it, and print out the errors, if any.
Right now, the question is, can I produce an executable that runs?
I don't have a Mac or an iPhone simulator, so I can't really address that aspect of the question, but can you link to a different OpenGL ES implementation's library? E.g. OpenTK or Vincent.
This may not match 100% the iPhone's implementation, but might get you close.
这篇关于如何构建一个链接到iPhone Simulator SDK的命令行工具?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!