How do I build a command line tool that links against the iPhone Simulator SDK?

馋奶兔 提交于 2019-12-08 06:58:42

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/3951028/how-do-i-build-a-command-line-tool-that-links-against-the-iphone-simulator-sdk

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!