开发者

Creating an application bundle on OSX with eclipse C++

开发者 https://www.devze.com 2023-02-13 12:14 出处:网络
I have compiled a project using Eclipse with C/C++ plugin (using http://libcinder.org library, and it\'s working pretty good.

I have compiled a project using Eclipse with C/C++ plugin (using http://libcinder.org library, and it's working pretty good. Sort of...

It is a windowed application, and opengl is开发者_StackOverflow社区 correctly redrawing the screen, mouse events are correct, etc. However, I can only run the application from the terminal, otherwise when i attempt to hit debug I can see my console statements but there's no window to speak of.

When i output the CWD from the application, it appears to think it is running from my user directory.

How can I make this application seem more 'mac like', specifically when you rightclick a mac application you can view it's contents, and be able to load files relative to the applications executable.

Also, any insight as to why it does not appear when launching via debugger in eclipse would be helpful too.

I have put this project together for anyone else who might find it useful here: https://github.com/onedayitwillmake/EclipseLovesCinder


Hmmm. This is an architecture problem. I don't know how resources are bundled by Eclipse normally, but they don't use the application bundle architecture that OSX has built in.

Here's the Apple developer docs on NSBundle. Start your reading here!


Apparently it's really a matter of just creating the directories. I found some good information on this page: http://webcache.googleusercontent.com/search?q=cache:NUzzPvEcP04J:max.berger.name/howto/wxWidgets/wxWidgets_Eclipse.jsp+application+bundle+${BuildArtifactFileName}&cd=1&hl=en&ct=clnk&gl=us&source=www.google.com

I'm specifically using this in the projects, C/C++ Build -> Settings -> BuildSteps -> Post Build Steps:

All one line, with ; between them
mkdir -p ${BuildArtifactFileName}.app/Contents/MacOS ;
mv ${BuildArtifactFileName} ${BuildArtifactFileName}.app/Contents/MacOS/ ;
cp -rf ../Resources ${BuildArtifactFileName}.app/Contents/Resources ;
cp -rf ../Resources/Info.plist ${BuildArtifactFileName}.app/Contents/Info.plist

This will create the directory structure, and copy everything in the projects /resources/ folder to the application bundles resources directory.

I apologize for for answering my own question

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号