Author Topic: Adding a pre compilation step dependency  (Read 10466 times)

Offline sparhawk

  • Multiple posting newcomer
  • *
  • Posts: 26
Adding a pre compilation step dependency
« on: April 11, 2014, 10:14:29 am »
I'm createing a project using Qt5. When I create a window layout with the QtDesginer, it creates a "file.ui" which then must be compiled into a ".java" or a ".h" file.

Example:

Code
d:\opt\qt-5.2.1\bin\uic.exe -g cpp -o main_frame.h main_frame.ui


The problem now is, how do I setup the dependency of a custom build step for this generated include? I added the "ui" file to my workspace and created a build command for it, but in the build log, I can see that the build of the include is done after the cpp file is compiled. Then I added a pre build step, but this is always executed. So how can I tell CB to only do this if the "ui" file has been changed, just like any other regular compiled file?

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline sparhawk

  • Multiple posting newcomer
  • *
  • Posts: 26
Re: Adding a pre compilation step dependency
« Reply #2 on: April 13, 2014, 04:22:09 pm »
Not sure if I'm missing the point. I tried to to do this as is shown in the WIKI, but that doesn't seem to work.

The screenshot from the WIKI I can only find in the global compiler settings. There is of course no suitable compiler and there is no option to add a new compiler, so I was trying to do it with the "**No Compiler**" and adding the command line in that window. As soon as I close the dialog and reopen it, the commandline is gone and dialog is as empty as it was originally.

I haven't found any other option so far. I know I can add a compiler for this but then I have to mess again with the XML and setup files as I did when I added MASM32 support. I guess I have to do it this way for now. It would be great though if there would be some setup where one can add new compilers more easily than this. Maybe this is a planned feature for a future release?

Offline sparhawk

  • Multiple posting newcomer
  • *
  • Posts: 26
Re: Adding a pre compilation step dependency
« Reply #3 on: April 13, 2014, 07:54:21 pm »
So I finally understood how I can add this UIC compiler from Qt. However, CB now seems to generate the file every time and the linker stage is also executed. Strangely the cpp file where it is included is not recompiled unless I really change the UI file. So how can I tell CB that this file shouldn't trigger linking?

Here is the build log when I start the build without any changes:

Code
-------------- Build: Debug in Datinator (compiler: GNU GCC Compiler)---------------

d:\opt\qt-5.2.1\bin\uic.exe -g cpp -o D:\src\c\Datinator\main_frame.h D:\src\c\Datinator\main_frame.ui
g++.exe -LD:\opt\qt-5.2.1\lib -o Debug\Datinator.exe Debug\obj\main.o   -lgdi32 -luser32 -lkernel32 -lcomctl32 -lQt5Core -lQt5Gui -lGLESv2d -lQt5Widgetsd -mwindows
Output file is Debug\Datinator.exe with size 423.63 KB
Process terminated with status 0 (0 minute(s), 6 second(s))
0 error(s), 0 warning(s) (0 minute(s), 6 second(s))
« Last Edit: April 13, 2014, 07:57:02 pm by sparhawk »

Offline stahta01

  • Lives here!
  • ****
  • Posts: 7591
    • My Best Post
Re: Adding a pre compilation step dependency
« Reply #4 on: April 13, 2014, 09:13:25 pm »
IIRC, right click on file and choose property there should be 3 or 4 tabs one has link and compile check boxes.

Tim S.
C Programmer working to learn more about C++ and Git.
On Windows 7 64 bit and Windows 10 64 bit.
--
When in doubt, read the CB WiKi FAQ. http://wiki.codeblocks.org

Offline sparhawk

  • Multiple posting newcomer
  • *
  • Posts: 26
Re: Adding a pre compilation step dependency
« Reply #5 on: April 14, 2014, 08:49:28 am »
Yes, I know, but the link button is unchecked and it still links every time.