[Development] ActiveQt AxServer with CMake

Fricot, Daniel daniel.fricot at barco.com
Thu Feb 13 13:47:28 CET 2014


Rob,
Your cmake snippet is basically what I do in my build.
Idc is the problem. This gives the " Timers can only be used with threads started with QThread" error.
After some more playing around, I noticed something. If I place a breakpoint in the beginning of my main, I got the following stacktrace (build with cmake, without IDL commands):
    0    main                 main.cpp    44     0x81ea7
    1    __tmainCRTStartup    crtexe.c    536    0xafad9
    2    mainCRTStartup       crtexe.c    377    0xafc1d
    3    BaseThreadInitThunk  kernel32           0x76f8336a
    4    __RtlUserThreadStart ntdll              0x77979f72
    5    _RtlUserThreadStart  ntdll              0x77979f45
If I do the same with something I build with qmake (which does the IDL commands for you), I got:
    0    main                 main.cpp           252    0x1002ad6
    1    WinMain              qaxservermain.cpp  260    0x101bdb1
    2    __tmainCRTStartup    crtexe.c           528    0x102fb62
    3    WinMainCRTStartup    crtexe.c           377    0x102f92d
    4    BaseThreadInitThunk  kernel32                  0x76f8336a
    5    __RtlUserThreadStart ntdll                     0x77979f72
    6    _RtlUserThreadStart  ntdll                     0x77979f45
(Note that the main.cpp in the two stacktraces are two different files, so don't mind the difference in line numbers in main.cpp)
As you can see, in the activeqt server, build with qmake, the main is called from WinMain in qaxservermain.cpp. I don't know if this is the result of the IDL commands (in which case, the cmake build obviously does not have the WinMain in the stacktrace) or this should also be in the stacktrace of the cmake build, even before running the IDL commands?
Thanks,
Daniel


-----Original Message-----
From: Robert Knight [mailto:robertknight at gmail.com]
Sent: woensdag 12 februari 2014 16:48
To: Fricot, Daniel
Cc: development at qt-project.org
Subject: Re: [Development] ActiveQt AxServer with CMake

> Has anyone managed to create an ActiveQt server with CMake?

To clarify, is the problem with running the IDC/IDL tools or some other step? The CMake logic we've used for this is roughly:

set(IDL_COMMANDS
  COMMAND idl ${BINARY_PATH} -idl ${BINARY_PATH}.idl
  COMMAND midl ${BINARY_PATH}.idl ${BINARY_PATH}.tlb
  COMMAND idc ${BINARY_PATH} -tlb ${BINARY_PATH}.tlb)

add_custom_command(TARGET ${SERVER_TARGET} POST_BUILD ${IDL_COMMANDS}
  COMMENT "Generating and embedding type library")

Where ${SERVER_TARGET} is the name of the executable target that is the ActiveX server and ${BINARY_PATH} is set to '$<TARGET_FILE:SERVER_TARGET>' - CMake automatically expands that to the .exe path at build time.
So the target is built as normal and then idl/idc is run as a post-build step whenever the target is rebuilt.

Regards,
Rob.

On 12 February 2014 14:24, Fricot, Daniel <daniel.fricot at barco.com<mailto:daniel.fricot at barco.com>> wrote:
> Hi,
>
> Has anyone managed to create an ActiveQt server with CMake? I got it
> working with qmake but we need to do this with CMake. I also tried idc
> manually after CMake but then I keep getting the error:
>
> QObject::startTimer: Timers can only be used with threads started with
> QThread
>
> IDL generation failed trying to run program myapp.exe!
>
> Thanks,
>
> Daniel
>
> This message is subject to the following terms and conditions: MAIL
> DISCLAIMER
>
> _______________________________________________
> Development mailing list
> Development at qt-project.org<mailto:Development at qt-project.org>
> http://lists.qt-project.org/mailman/listinfo/development
>

This message is subject to the following terms and conditions: MAIL DISCLAIMER<http://www.barco.com/en/maildisclaimer>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20140213/0326506a/attachment.html>


More information about the Development mailing list