Board index » cppbuilder » improved PCH support - WAS: parallel bcc32 build tool

improved PCH support - WAS: parallel bcc32 build tool


2005-08-28 04:34:30 AM
cppbuilder0
While adding bcc32 support to Qt 4.0.1 I developed a little tool that
makes PCH usage a lot easier and more powerfull. msvc can "force include"
a header file. This is used by Qt4 to include a precompiled header set.
bcc32 does not offer such a command line switch so you always have to add
lines like
#include <my_pch.h>
#pragma hdrstop"
to every file.
The bcc32pch tool now injects this PCH code into every file during
compilation and recompiled the PCH if change something in one of the
included headers.
See borland.public.attachment
How to use bcc32pch:
1. Create a new header file "myproject_pch.h" and include in that file
every header you want to have precompiled (be carefull with "code in
header",
"initialized data found").
2. Export your project to a makefile (bpr2mak)
3. Replace the "BCC32 = bcc32" by "BCC32 = bcc32pch -pch=myproject_pch.h"
4. Start make and see the compilation boost.
How it works:
bcc32pch uses the specified PCH file (-pch=filename_pch.h) to generate a
precompiled
header file. First it create a new .cpp that contains the PCH inclusion
code
#include "filename_pch.h"
#pragma hdrstop
#line 1 "filename.cpp"
and compiles it with "create precompiled headers". This file is deleted
after the
compilation. Now it preprocesses all specified files by renaming them to
filename.cpp_original.cpp and writing a new filename.cpp file with the
injected
PCH inclusion code. After that the compiler is started with "use
precompiled headers".
After all files are compiled or an error occured the original files are
restored.
The generated PCH is stored to the directory that is specified by the
-nDirectory or
-oPath\Filename.obj command line switch. If neight -n nor -o is available
it puts the
file to the PCH header file.
Because the regeneration of the PCH is time consuming the bcc32pch tool
reads the
dependency information of the PCH generated .obj file. This allows
bcc32pch to
recompile the PCH if one header file has changed. (also headers which are
included
be included headers, ...)
If you specify the -H="filename.csm" parameter bcc32pch will use this
filename for
it's PCH file.
--
Regards,
Andreas Hausladen
(andy.jgknet.de/blog)
 
 

Re:improved PCH support - WAS: parallel bcc32 build tool

An IDE plugin is in work.
--
Regards,
Andreas Hausladen
(andy.jgknet.de/blog)
 

Re:improved PCH support - WAS: parallel bcc32 build tool

Andreas Hausladen wrote:
Quote
An IDE plugin is in work.
And now it is finished. It replaces the builtin compiler (but not the
codeinsight one). So if you compile you will see the command line compiler
reporting the errors and warnings. The advanced PCH support by bcc32pch is
also included.
I have uploaded a precompiled version for BCB 6 (compiled with Delphi 6)
to b.p.attachment.
--
Regards,
Andreas Hausladen
(andy.jgknet.de/blog)
 

{smallsort}

Re:improved PCH support - WAS: parallel bcc32 build tool

"Andreas Hausladen" < XXXX@XXXXX.COM >wrote in
message news:43123fc7$ XXXX@XXXXX.COM ...
Quote
Andreas Hausladen wrote:

>An IDE plugin is in work.

And now it is finished. It replaces the builtin compiler (but
not the
codeinsight one). So if you compile you will see the command
line compiler
reporting the errors and warnings. The advanced PCH support by
bcc32pch is
also included.

I have uploaded a precompiled version for BCB 6 (compiled with
Delphi 6)
to b.p.attachment.

--
Regards,

Andreas Hausladen
(andy.jgknet.de/blog)
How about one for BCB 5?
Thanks,
- Arnie
 

Re:improved PCH support - WAS: parallel bcc32 build tool

Arnie wrote:
Quote
How about one for BCB 5?
I hope there are not that many differences between Delphi 5 and BCB 5.
andy.jgknet.de/misc/bcc32pchide.zip
This zip contains:
- precompiled bcc32pchPlugin50.bpl
- precompiled bcc32pchPlugin60.bpl
- precompiled bcc32pch.exe
- source code of bcc32pchPlugin
- source code of bcc32pch.exe (D6 or higher requred)
--
Regards,
Andreas Hausladen
(andy.jgknet.de/blog)
 

Re:improved PCH support - WAS: parallel bcc32 build tool

"Andreas Hausladen" < XXXX@XXXXX.COM >wrote in message
Quote
And now it is finished. It replaces the builtin compiler (but not the
codeinsight one). So if you compile you will see the command line compiler
reporting the errors and warnings. The advanced PCH support by bcc32pch is
also included.
Just curious, but how does it report the errors? In a separate command
prompt window or within the IDE? If within the IDE can you click on an error
to take you to the source code?
If you have managed to create a plugin that compiles using the command line
but returns clickable errors to the IDE then that is going to be a very
useful utility, completely aside from any PCH improvements.
Des
 

Re:improved PCH support - WAS: parallel bcc32 build tool

Des O'Toole wrote:
Quote
Just curious, but how does it report the errors? In a separate command
prompt window or within the IDE?
There is a detailed message dialog that shows the captured console output
and the number of errors and warnings.
There is a compile-progress dialog showing the filename of the currently
compiled file and the number of errors and warnings.
You can setup with of these two dialogs you want.
All errors, warnings and hints are added to the MessageView window of the
IDE.
Quote
If within the IDE can you click on an error to take you to the source
code?
Yes you can. Click on a error/warning/hint and the corresponding file is
opened (that does the IDE, I only add the message with a filename and line
number). Unfortunatelly the command line compiler does not report the
column of the error, so this is set to 1.
Extended compiler error information are added as treenode childs to the
error messages (like the IDE compiler does it). And they are also
clickable.
Quote
If you have managed to create a plugin that compiles using the command
line but returns clickable errors to the IDE then that is going to be a
very useful utility, completely aside from any PCH improvements.
The PCH improvements are only used if you have a <projectname>_pch.h file
in the project directory.
--
Regards,
Andreas Hausladen
(andy.jgknet.de/blog)
 

Re:improved PCH support - WAS: parallel bcc32 build tool

Here some screenshots
andy.jgknet.de/cpp/
--
Regards,
Andreas Hausladen
(andy.jgknet.de/blog)
 

Re:improved PCH support - WAS: parallel bcc32 build tool

"Andreas Hausladen" < XXXX@XXXXX.COM >wrote in message
Quote
All errors, warnings and hints are added to the MessageView window of the
IDE.

Yes you can. Click on a error/warning/hint and the corresponding file is
opened (that does the IDE, I only add the message with a filename and line
number).
Wow !
If it works the way I hope it does (eg it doesn't have to spawn a new
instance of BCC32 for each single file) then you are going to be a very
popular person around here.
Des
 

Re:improved PCH support - WAS: parallel bcc32 build tool

On 27 Aug 2005 13:34:30 -0700, Andreas Hausladen wrote:
Quote
The bcc32pch tool now injects this PCH code into every file during
compilation and recompiled the PCH if change something in one of the
included headers.
Cool
--
liz
 

Re:improved PCH support - WAS: parallel bcc32 build tool

I've just tried it, unfortunately I get the following error message whenever
I try to compile/build.
Exception:
------------------------------------------------------------------------
2.1 Date : Mon, 29 Aug 2005 19:41:01 +0100
2.2 Address: 40015299
2.3 Module : rtl60.bpl
2.4 Type : EOSError
2.5 Message: System Error. Code: 267. The directory name is invalid.
Any thoughts?
Desw
 

Re:improved PCH support - WAS: parallel bcc32 build tool

Des O'Toole wrote:
Quote
I've just tried it, unfortunately I get the following error message
whenever I try to compile/build.
Does this error also happen when you use the "Build project with PCH" menu
item?
--
Regards,
Andreas Hausladen
(andy.jgknet.de/blog)
 

Re:improved PCH support - WAS: parallel bcc32 build tool

"Andreas Hausladen" < XXXX@XXXXX.COM >wrote in message
Quote
Des O'Toole wrote:

>I've just tried it, unfortunately I get the following error message
>whenever I try to compile/build.

Does this error also happen when you use the "Build project with PCH" menu
item?
Yes
 

Re:improved PCH support - WAS: parallel bcc32 build tool

Des O'Toole wrote:
Quote
Yes
Could you try this special version.
andy.jgknet.de/cpp/bcc32pchPlugin60.zip
It creates the file C:\bcc32pch.log. So I can see where it raises the
exception.
--
Regards,
Andreas Hausladen
(andy.jgknet.de/blog)
 

Re:improved PCH support - WAS: parallel bcc32 build tool

Hi Andreas
Your log contents are:-
Init Compile
Project files saved
Tools available
Dialog started
Bpr2Mak initialized
Bpr2Mak: FileAge OK
Init Compile
Project files saved
Tools available
Dialog started
Bpr2Mak initialized
Bpr2Mak: FileAge OK
Des