delphidelphi-ide

How not to compile installed packages everytime anew with the Application that uses it?


When I install a package in the IDE and use it in a project, it gets recompiled (DCUs are replaced) everytime I compile my project.

I can't imagine that this is intended - the RTL and VCL are not compiled each time either, are they?

I have played a bit with the paths in Tools > Options > Environment Options > Delphi Options > Library, but without success.

I have found a construction allowing compilation of my project without recompiling the package having DCUs and PASs in diffenent paths, but in this construction Delphi is not able to locate the sources at all from the Code Editor (SHIFT-clicking for example), so this is not an option.


Solution

  • To avoid recompilation you have to have separate folders for .dcu files and .pas files.

    Usually this is done by settings the output dir in a package contained in the library. You build the package and it will produce the .dcu files in a output folder that is different from the source folder.

    To use the package you then:

    This gets a little more complicated when you have .dfm files in the package as well.

    Every .pas file that the compiler sees in the library path is recompiled. (Actually only the last instance, because you can have the same unit in different directories that are listed in the library path).

    To enable IDE features like CTRL-click you have to set the {$Y+} compiler switch in your package which can be done in the IDE Compiling options:

    http://docwiki.embarcadero.com/RADStudio/XE4/en/Compiling#Debugging_Options