4

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.

Jens Mühlenhoff
  • 14,565
  • 6
  • 56
  • 113
RSE
  • 322
  • 1
  • 10
  • 1
    To enable CTRL-click navigation set `Delphi Compiler/Compiling/Debugging/Symbol Reference Info` option for your package to `Reference Info`. – kludg Jun 18 '14 at 10:27
  • Additionally, include source directory in the browsing path. – Sertac Akyuz Jun 18 '14 at 12:31
  • @user246408 I'm aware of this. The construction I wrote about would not have the pas files in any folder known to the IDE, so the IDE would have no chance to find them, neither for compilation nor for CTRL-click navigation... that's why this is not the solution. – RSE Jun 18 '14 at 14:10

1 Answers1

6

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:

  • have to point the library path to the output folder (with the compiled .dcu files).
  • can optionally point the search path to the source folder (with the .pas files).

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

Jens Mühlenhoff
  • 14,565
  • 6
  • 56
  • 113
  • In the actual case the package is VirtualTreeView, which ran fine through the installation process. The thing is, it didn't even create a VirtualTrees.dcu - which is the central unit to use when using the TVirtualStringTree. After creating one manually (through temporary adding the path to the pas to the library path and then move it to the actual library path), your suggestion worked like a charm. Thanks! – RSE Jun 18 '14 at 14:27