Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 3

Qt-interest Archive, June 2007
How to use Qt4 with XCode project?


Message 1 in thread

Does anyone know how to use Qt4 in XCode project without qmake?

--
 [ signature omitted ] 

Message 2 in thread

Naresh schrieb:
> Does anyone know how to use Qt4 in XCode project without qmake?

You simply need to define your own build rules for

   *.h (with slots and Q_OBJECT macro inside) -> mocced output
   *.ui -> source code
   *.qrc -> embedded source file
   *.etc -> whatever

with whatever build system you would be using in your XCode project.

The bottom line: you would probably be better off with qmake ;) Or use 
Visual Studio and its Addon/Integration products or Eclipse which is now 
also supported (beta Addin, or so I understand).

Cheers, Oliver

-- 
 [ signature omitted ] 

Message 3 in thread

Please reply to the list only, /not/ to me in private.

Naresh schrieb:
> Well qmake doesn't allow me to create more then one target in one pro

Then create a *.pro for each subproject (be it a DLL or an *.exe) and 
create a "top-level" *.pro with the SUBDIRS directive. Qt is build 
exactly like this. Also read the qmake Qt documentation to keep you going.

And if you really need to have "custom targets" you can even create 
those as well.

> file, and my xcode project contains like 10 or more my own frameworks + 
> one application that uses them.

That's a standard case for qmake ;)

> I've created my own scripts that create moc files, but I have some other 
> problems.
> I get errors like this:
> 
> In file included from QObject 1:
> QtCore/qobjectdefs.h: No such file or directory

That's because qmake sets the INCLUDE paths correctly for Qt related 
#includes. And with a simple CONFIG += opengl it also adds the proper 
OpenGL headers and so on. Since Qt 4.x it even supports something called 
'pkg-config'; for example the external library D-BUS provides a 
"pkg-config" interface.

> 
> and more of that. What's funny when project is created with qmake, 
> everything is fine. Thats why I ask how to use it with XCode
   ^^^^^^^^^^^^^^^^^^

And that's why I suggest you should be using qmake instead ;)

"Everything is fine(tm)" - isn't that just great? :-)

Off course you can use any build/makefile system together with Qt, as 
long as you add the proper INCLUDE paths to it (typically at least 
${QTDIR}/include etc.) and the aforementioned build rules (for *.ui, 
*.qrc, moccing, etc.)


Have a nice evening, Oliver

--
 [ signature omitted ] 

Message 4 in thread

On 2007-06-12 11:43:18 -0400, Till Oliver Knoll 
<oliver.knoll@xxxxxxxxxxx> said:

> Please reply to the list only, /not/ to me in private.
> 
> Naresh schrieb:
>> Well qmake doesn't allow me to create more then one target in one pro
> 
> Then create a *.pro for each subproject (be it a DLL or an *.exe) and 
> create a "top-level" *.pro with the SUBDIRS directive. Qt is build 
> exactly like this. Also read the qmake Qt documentation to keep you 
> going.
> 
> And if you really need to have "custom targets" you can even create 
> those as well.
> 
>> file, and my xcode project contains like 10 or more my own frameworks + 
>> one application that uses them.
> 
> That's a standard case for qmake ;)
> 
>> I've created my own scripts that create moc files, but I have some 
>> other problems.
>> I get errors like this:
>> 
>> In file included from QObject 1:
>> QtCore/qobjectdefs.h: No such file or directory
> 
> That's because qmake sets the INCLUDE paths correctly for Qt related 
> #includes. And with a simple CONFIG += opengl it also adds the proper 
> OpenGL headers and so on. Since Qt 4.x it even supports something 
> called 'pkg-config'; for example the external library D-BUS provides a 
> "pkg-config" interface.
> 
>> 
>> and more of that. What's funny when project is created with qmake, 
>> everything is fine. Thats why I ask how to use it with XCode
>    ^^^^^^^^^^^^^^^^^^
> 
> And that's why I suggest you should be using qmake instead ;)
> 
> "Everything is fine(tm)" - isn't that just great? :-)
> 
> Off course you can use any build/makefile system together with Qt, as 
> long as you add the proper INCLUDE paths to it (typically at least 
> ${QTDIR}/include etc.) and the aforementioned build rules (for *.ui, 
> *.qrc, moccing, etc.)
> 
> 
> Have a nice evening, Oliver

Just some thoughts from a Mac Developer. Theoretically you _shouldn't_ 
have to use qmake to use Qt with Xcode. Practically, you _have_ to. 
This is because Qt is so large with so many include paths, libraries 
and other stuff that if you use qmake then all those problems are 
figured out for you. What I would suggest is to learn the basics of 
qmake enough to have qmake generate an Xcode project for you. Then you 
can use Xcode from there on out for your project.

If you have basic Xcode questions then I suggest you ask on the Xcode 
users mail list at http://lists.apple.com/mailman/listinfo/xcode-users

I personally use cmake (www.cmake.org) which generates Makefiles, then 
use Eclipse as my IDE. Generally a nice combination.

HTH
Mike Jackson

--
 [ signature omitted ]