Search:
Menu VisualVoice / QtXcode

Visual Voice Home


About Artistic Vision People Teams Contact us


Activities



Publications Media Images/Movies


Opportunities


Related Links


Local Only


Website problems?

edit SideBar

Converting a Qt project to Xcode

Whenever a new Qt based class is added to the project, it is necessary to remake the Xcode project from Qt to reflect this change. Otherwise linking errors will occur when the project is compiled (As Xcode does not know about the newly added Qt-based files). <-this is probably not a great explanation... please edit for clarity.

1. Open .pro Qt project file
2. Add the new files
3. Save the .pro Qt project file
4. run "qmake -spec macx-xcode PROJECT_name.pro
5. open the newly created Xcode project.

An alternative to editing the existing Qt project file is to create a new Qt project file from scratch. Do this by running qmake -project. Qt will automatically create a Qt project file with the same name as the current directory, containing all source files in the current directory. Note that it might be a good idea to check the Qt project file that was created to make sure it doesn't include any absolute path names. If it does, just remove them.

After that, additional include directories, preprocessor definitions and some external libraries may have to be re-added manually (until we figure out a way to do this in Qt?)

First we have to add the external libraries, Stk and CoreAudio:

1. Right click on the project in Xcode, and select "Add Existing Frameworks"
2. CoreAudio is in /System/Library/Frameworks
3. The compiled Stk library (libstk.a) is in /stk-x.x.x/src

After this, there are three things left to do:

1. Add the Stk include directory (/stk-x.x.x/include) to "Header Search Paths" under the TARGET setting. (note: make sure it is the TARGET setting and not the PROJECT setting, as the TARGET setting ultimately overrides the project settings, and that may cause the headers not to be seen by Xcode.

2. Add the preprocessor defition to target, "__MACOSX_CORE__" under "Proprocessor Macros" in the TARGET setting. This is necessary for the system to make use of CoreAudio in OSX for sound output.

3. Remove absolute path names from the project. These are inserted when Qt writes the make file and preprocessor definitions for the new Xcode project. The places to look are in the target. Expand the target (under "Targets") and check Qt Qmake, Qt Preprocesors, and Project Copy. Double-click or Get Info on these items. Replace the absolute path names with ./

.... and everything should work.