Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

MacOS X: Compiling OpenGL apps using a Makefile

2 views
Skip to first unread message

Peter Stöhr

unread,
Sep 10, 2002, 10:01:42 AM9/10/02
to
Hi *,

after upgrading from 10.1.x to 10.2 I have some problems compiling
OpenGL applications without using ProjectBuilder.
With 10.1.x adding
-framework OpenGL -framework glut -framework cocoa
to the linker command line was enough to generate a programm
that could be started from the terminal.
With 10.2, using this options generates a programm that could be
started, unfortunately the OpenGL application never gets the focus, thus
all terminal input goes to the terminal application.
Generating the OpenGL applications using ProjectBuilder gives
applcations that work perfectly.
As I have to support several platforms unsing ProjectBuilder would be a
major drawback, T prefer makefiles in such a situation.

Any help is appreciated
Peter
--
Fachhochschule Hof
Prof. Dr. Peter Stöhr Tel: 09281 - 409 485
Alfons-Goppel-Platz 1 Fax: 09281 - 409 400
95028 Hof / Germany

Ruud van Gaal

unread,
Sep 11, 2002, 9:28:01 AM9/11/02
to
On Tue, 10 Sep 2002 16:01:42 +0200, Peter Stöhr
<peter....@fh-hof.de> wrote:

>Hi *,
>
>after upgrading from 10.1.x to 10.2 I have some problems compiling
>OpenGL applications without using ProjectBuilder.

I have the opposite; get vague errors (see build log, which just gives
an 'error' at the last point) when trying to link with PB. :)

>With 10.1.x adding
> -framework OpenGL -framework glut -framework cocoa
>to the linker command line was enough to generate a programm
>that could be started from the terminal.

Not here; I never got focus that way, although I could get it to work
using 'open myapp.app'. Running the exe directly (i.e. './myapp') did
get output to the terminal (printf()) but no focus.
I believe the problem is the resources (menu and such)... Haven't got
it working, except when I use 'open' (as if it was double-clicked).

Try using 'open'.
But let me understand this correctly; you can run your program as
'myapp' (not using 'open') and that gave focus to the app nevertheless
in 10.1.x? (never got that to work)


Ruud van Gaal
Free car sim: http://www.racer.nl/
Pencil art : http://www.marketgraph.nl/gallery/

Mike

unread,
Sep 11, 2002, 8:36:52 PM9/11/02
to
In article <3d7f442d....@news.xs4all.nl>, Ruud van Gaal
<ru...@marketgraph.nl> wrote:

I ran into this with the later Jag releases. There's something that
prevents the app from getting updates & clicks if it lacks some
combination of an Info.plist, and I think the creator code or
extension. Sorry, but once I figured out that was it, I promptly
ignored it. Make sure you have a good plist, and try making the
executable openable in the Terminal in the Get Info. Once I made the
plist, and did one of those changes in the Get Info, I fixed it. If you
can't figure it out, email me and I'll try to reporduce it.

Jason Allen

unread,
Sep 11, 2002, 9:50:37 PM9/11/02
to
I just got this working by creating a <myapp>.app folder, then creating a
Contents folder inside this, then a MacOS folder inside this one. Then place
the compiled exe created by your makefile into <myapp>.app/Contents/MacOS.
Then you need to create a Info.plist file in <myapp>.app/Contents/ that
looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleExecutable</key>
<string>myapp</string> <--- replace "myapp" with the
exact name of your file in Contents/MacOS/
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>0.0.1d1</string>
</dict>
</plist>

Then you can launch the app by going into <myapp>.app/Contents/MacOS and
executing the file in there.

Jason A.

"Peter Stöhr" <peter....@fh-hof.de> wrote in message
news:alktvr$1qbjuq$1...@ID-54822.news.dfncis.de...

Paul Bourke

unread,
Sep 12, 2002, 4:04:14 AM9/12/02
to
> I just got this working by creating a <myapp>.app folder, then creating a
> Contents folder inside this, then a MacOS folder inside this one. Then place
> the compiled exe created by your makefile into <myapp>.app/Contents/MacOS.
> Then you need to create a Info.plist file in <myapp>.app/Contents/ that
> looks like this:

This is a joke right!
If one really needs to get up to this crap to create vanilla OpenGL
apps under OS-X then it's doomed.

> <?xml version="1.0" encoding="UTF-8"?>
> <plist version="1.0">
> <dict>
> <key>CFBundleDevelopmentRegion</key>
> <string>English</string>
> <key>CFBundleExecutable</key>
> <string>myapp</string> <--- replace "myapp" with the
> exact name of your file in Contents/MacOS/
> <key>CFBundleInfoDictionaryVersion</key>
> <string>6.0</string>
> <key>CFBundlePackageType</key>
> <string>APPL</string>
> <key>CFBundleSignature</key>
> <string>????</string>
> <key>CFBundleVersion</key>
> <string>0.0.1d1</string>
> </dict>
> </plist>

P a u l B o u r k e
Visualisation Research Fellow
mailto:pbo...@swin.edu.au
http://astronomy.swin.edu.au/~pbourke/

Peter Stöhr

unread,
Sep 12, 2002, 5:32:01 AM9/12/02
to
Hi Ruud,

> But let me understand this correctly; you can run your program as
> 'myapp' (not using 'open') and that gave focus to the app nevertheless
> in 10.1.x? (never got that to work)

yes, it worked perfectely with 10.1.5 ...

Greetings from Hof

Ruud van Gaal

unread,
Sep 12, 2002, 7:52:01 AM9/12/02
to
On Thu, 12 Sep 2002 19:04:14 +1100, pbo...@swin.edu.au (Paul Bourke)
wrote:

>> I just got this working by creating a <myapp>.app folder, then creating a
>> Contents folder inside this, then a MacOS folder inside this one. Then place
>> the compiled exe created by your makefile into <myapp>.app/Contents/MacOS.
>> Then you need to create a Info.plist file in <myapp>.app/Contents/ that
>> looks like this:
>
>This is a joke right!
>If one really needs to get up to this crap to create vanilla OpenGL
>apps under OS-X then it's doomed.

No joke. I couldn't get my window to be activated (receive keyboard
events) until I did this. The Finder shows these directories as one
icon. Just like packages (for installation) which are also really a
big .mpkg (or some other extension) directory.

It's not that bad, just wicked and prone for a lot of chaos as time
moves on! ;-) (the reason is to support multiple machine type
application executables within 1 .app dir, but I would suppose that
would never be used too much anyway).


Ruud van Gaal

Jason Allen

unread,
Sep 12, 2002, 1:54:14 PM9/12/02
to
Yes, this is unfortunately the only way I could get it to work, and it
really sucks. I'll likely end up just creating a Perl script or a shell
script to generate the directory structure and copy the necessary files to
the correct locations, then create a symlink from the exe in
<myapp>.app/Contents/MacOS to the source directory so you can execute it
directly.

Jason A.

"Paul Bourke" <pbo...@swin.edu.au> wrote in message
news:pbourke-1209...@1cust54.tnt7.mel1.da.uu.net...

0 new messages