Bastian Seeleib
Bastian Seeleib

Reputation: 307

How to create an .app File in Xcode for an command line tool programm

For normal cocoa applications it's easy to create an .app file. But what do i have to do to create an .app file from an command line project. I know that it usually doesn't make sense to create an .app from an command line tool, but in this case im using GLFW (an OpenGL lib) to create an Window. Or what would be the correct way to set up an c/c++ project and create an .app file from that project?

I hope you do understand what i mean, if not please ask.

Upvotes: 1

Views: 1984

Answers (2)

Dietrich Epp
Dietrich Epp

Reputation: 213568

On OS X, there is no difference between command-line programs and application executables--there is only one kind of executable. This is the same way other Unix systems like Linux work, but different from Windows. OS X "application bundles" are just a certain way of packaging up an executable with related resources in a directory tree.

The easiest way to create a application that uses GLFW in Xcode is to create a Cocoa application project, then delete all references to Cocoa from the target. Delete the reference to the Cocoa framework, delete all the source code the template created, delete the MainMenu.xib, et cetera. You will need to leave the Info.plist intact as this is an essential part of OS X application bundles.

Upvotes: 1

Andon M. Coleman
Andon M. Coleman

Reputation: 43359

This actually is not as unreasonable as you think, .app is just a special kind of "bundle" on OS X.

You can easily package this up yourself, but you need to know the proper file structure. In fact, virtually all the software I write for OS X is actually done this way; I am not a fan of the Xcode IDE.

Here is a general overview. The Info.plist file is the most important thing to focus on.

Upvotes: 1

Related Questions