Assuming that you've already created a new workspace and added a project to it, there are a few project settings to set in order to properly build, run and debug applications under OS X.

The Automatic Way

Applications on OS X are bundles. Codelite ships with a plugin that turns your application into a bundle and sets all the required project settings accordingly.

Once created a new project, right-click on the project and select 'Make this project output a bundle'

Attach:MakeProjectBundleMenu.png Δ

A dialog will show up with the targets to turn into bundles, an Info.plist data, and the app icon.

Attach:MakeProjectBundleDialog.png Δ

Your app should now be a valid OS X bundle.

Note 1:
If you complied wxWidgets with the -arch i386 flag (for 32-bit builds on 10.6, more), you'd need to add this flag under:

  • Project Settings > Compiler > C++ Compiler Options
  • Project Settings > Compiler > C Compiler Options
  • Project Settings > Linker > C++ Options

Note 2:
If you change Project Settings > General > Output File (which, by the way, can only involve a relative path) you'd want to also change Project Settings > Customize > Custom Makefile Rules

The Manual Way

Either click the appropriate button in the Workspace View toolbar, or right-click over the project's name in the Workspace View and, from the context menu, select Settings.... The 'Project Settings' dialog will appear.

At the top of the dialog you'll see the Configuration Type combobox, which will normally contain Debug or Release. To the right of that is a button that takes you to the Configuration Manager, where you can edit these choices and add others.

General

Output File

When creating Mac application with WX widgets, you need to make it a bundle application. This simply means that the actual executable needs to reside in a folder hierarchy with specific names.

An output file ./HelloWorld.app/Contents/MacOS/HelloWorld will create a folder (bundle) called HelloWorld, within which there will be a folder called Contents, within which there will be a folder called MacOS, within which your application will reside. In Finder you will see the bundle as an application that you can execute; to see its content, you can right-click on it and choose 'Show Package Contents'.

Note: make sure that your bundle name and executable have the same name, as in: './HelloWorld.app/Contents/MacOS/HelloWorld

More info: wxWiki, Apple.

Command

open HelloWorld.app tells the shell to run your bundle.

Every time you press Run in CodeLite, a new terminal window will open. && exit tells the terminal window to exit after running the application. However, terminal windows do not close themselves by default with exit commands. You can set Terminal to do so by: Terminal > Preferences... > Settings > Shell > When the shell exits > Close the window.

Working Directory

You can set this to an absolute path, but setting it to ./ (the project file folder) will mean that you wont need to update this setting if you are to move your project folder.

Compiler

Compiler Options

For debug builds of wxWidgets application use:
-g;$(shell wx-config --cxxflags --unicode=yes --debug=yes)

For release builds:
;$(shell wx-config --cxxflags --unicode=yes --debug=no)

Preprocessor

If you are building wxWidgets application, enter __WX__

Linker

For debug builds of wxWidgets:
-O2;$(shell wx-config --debug=yes --libs --unicode=yes);

For release builds:
-O2;$(shell wx-config --debug=no --libs --unicode=yes);

Debugger

On the field 'Enter here any commands that should be passed to the debugger on startup', you should enter file followed by the output file. So, in our case:
file ./HelloWorld.app/Contents/MacOS/HelloWorld

Edit - History - Print - Recent Changes - Search
Page last modified on June 26, 2011, at 09:46 PM