Driver project on QtCreator

Find and share HowTos to various installations / configurations!
10 posts • Page 1 of 1
CyaNn
Posts:97
Joined: Tue Nov 23, 2010 9:48 am

Driver project on QtCreator

Post by CyaNn »

Hello,

I just want to now how to configure a QT creator to compile a driver project.
Standard WinCC API provides VS templates for driver but not Qt one.

Qt creator should be more powerfull IDE to mangage QObject and Slots that VS with Addins
Please can you indicate me a configuration with includes and linker if it is possible. (I have made some tries, but not conclusive)

Thanks in advance
best regards
Yann

leoknipp
Posts:2928
Joined: Tue Aug 24, 2010 7:28 pm

Re: Driver project on QtCreator

Post by leoknipp »

Hello,

if you want to use the WinCC OA API-toolkit to create an own WinCC OA driver you have to use Visual C++ / Visual Studio 2010 (VC10) as described in the WinCC OA online help --> Installation --> Requirements for WinCC OA.

Best Regards
Leopold Knipp
Senior Support Specialist

CyaNn
Posts:97
Joined: Tue Nov 23, 2010 9:48 am

Re: Driver project on QtCreator

Post by CyaNn »

ha ok, there is no possibility to use another IDE ????

leoknipp
Posts:2928
Joined: Tue Aug 24, 2010 7:28 pm

Re: Driver project on QtCreator

Post by leoknipp »

Hello,

for editing the source code you can use any tool you want.
The compiler which is part of the Visual Studio toolkit has to be used on Windows, on Linux you have to use gcc-4.1.2.

Best Regards
Leopold Knipp
Senior Support Specialist

CyaNn
Posts:97
Joined: Tue Nov 23, 2010 9:48 am

Re: Driver project on QtCreator

Post by CyaNn »

Yes, but qt creator works with visual studio VS9.0 compiler too.
That's why I answer my question.
As compiler is the same, I think it is possible to use qt creator to compile PVSS driver.
The only problem I found is the .pro configuration file with good libraries.

leoknipp
Posts:2928
Joined: Tue Aug 24, 2010 7:28 pm

Re: Driver project on QtCreator

Post by leoknipp »

Hello,

I was searching at the internet and Visual Studio 9.0 seems to be Visual Studio 2008.
As described before you have to use the compiler which is part of Visual Studio 2010, this is the officially supported toolkit.

QT creator is a tool to edit the source code files. You can use any tool you want to edit the files, also it would be possible to edit the files using a simple text editor.
The .pro-files are part of the QT software development toolkit and therefore it has nothing to do with WinCC OA.

Best Regards
Leopold Knipp
Senior Support Specialist

mpoint
Posts:49
Joined: Thu Oct 28, 2010 11:28 am

Re: Driver project on QtCreator

Post by mpoint »

Hi,

I'm just guessing here, but it should probably be enough to fill the qmake vars INCLUDEPATH, DEFINES, LIBS with the appropriate values from the generated Visual Studio project. One issue could be the forced include "win32.h" which we are using. qmake does not seem to have a setting for that (I looked at http://doc.qt.digia.com/stable/qmake-va ... rence.html). You might be able to put it in QMAKE_CXXFLAGS.

But as Leo mentioned, you probably won't get any support if your qmake-compiled driver does not work. Since you said that QtCreator would be a more powerful IDE for slots and meta-object stuff, it would also be sufficient to use QtCreator just for editing, and compile externally with Visual Studio, right? You don't even have to open Visual Studio for that, "devenv /Build" should work too.

To use QtCreator just for editing, filling INCLUDEPATH and DEFINES should be enough. The forced include could be an issue too, not sure where to put that. Manually including it as the first file would work, I guess.

mpoint
Posts:49
Joined: Thu Oct 28, 2010 11:28 am

Re: Driver project on QtCreator

Post by mpoint »

Just tried it out with version 3.11. I followed the instructions in api/README.NT to create a new driver project, and then manually wrote a qmake .pro-file for it. The autocompletion for WinCC OA API classes works fine AFAICT. I only set the INCLUDEPATH, not DEFINES or anything else. Apparently the QtCreator autocompletion doesn't care enough about the details to require Compiler-Defines and everything.

My .pro-file looks like this:

Code: Select all

QT += core

TARGET = FooDrv
TEMPLATE = app

API_ROOT = c:/Siemens/Automation/WinCC_OA/3.11/api
INCLUDEPATH += ./ $$API_ROOT/include/winnt/pvssincl $$API_ROOT/include/Basics/Utilities $$API_ROOT/include/Basics/Variables $$API_ROOT/include/Basics/NoPosix $$API_ROOT/include/Basics/DpBasics $$API_ROOT/include/BCMNew $$API_ROOT/include/Configs $$API_ROOT/include/Configs/DrvConfigs/DrvCommon $$API_ROOT/include/Configs/DrvConfigs/ConvSmooth $$API_ROOT/include/Datapoint $$API_ROOT/include/Messages $$API_ROOT/include/Manager $$API_ROOT/include/ComDrv $$API_ROOT/include/Ctrl

SOURCES += FooDrv.cxx FooHWMapper.cxx FooHWService.cxx FooMain.cxx FooResources.cxx FooTrans.cxx addVerInfo.cxx

HEADERS += FooDrv.hxx FooHWMapper.hxx FooHWService.hxx FooResources.hxx FooTrans.hxx

CyaNn
Posts:97
Joined: Tue Nov 23, 2010 9:48 am

Re: Driver project on QtCreator

Post by CyaNn »

Markus Pointner wrote:
Since you said that QtCreator would be a more powerful IDE for slots and meta-object stuff, it would also be sufficient to use QtCreator just for editing, and compile externally with Visual Studio, right? You don't even have to open Visual Studio for that, "devenv /Build" should work too.
Yes, and QTCreator integrate the MOC pre-processor and VS not.
To use it (needed to compile if I use Q_OBJECT macro) with VS I have to install VS addins, and VS addins does not work with VS Express.
In fact, if we have choice, we prefer buying Qt framework than buying VS.
Actually, if we want to write drivers and EWO objects we have to buy both.

(If I really had the choice, I stay in netbeans .... lol.... but it is not the subject....) ;) :P


I had tried the same way to create a correct pro file, but witout success. (I have certainly made something wrong).
I am not sure : Is it possible with your pro file to compile from QT-creator ? Or is it just to edit source code ?

Anyway, thank you a lot for your help. I will try this this afternoon or tomorow.

mpoint
Posts:49
Joined: Thu Oct 28, 2010 11:28 am

Re: Driver project on QtCreator

Post by mpoint »

Caron Yann wrote:
I am not sure : Is it possible with your pro file to compile from QT-creator ? Or is it just to edit source code ?
No, I just set it up for editing. Maybe compiling will work too, if you fill DEFINES and LIBS correctly and find a solution for the forced include.

Regarding the moc preprocessor, maybe this can be configured as a custom build step in VS? (like this: http://www.nextpoint.se/?p=242)

10 posts • Page 1 of 1