delphidelphi-2010

How to automatically copy resources to the DCU output folder


I would like to know, is there a way to automatically make the IDE/Compiler/other copy all the resource that needs to be linked with the DCU to the DCU output folder.

I often use forms that I pre-compile to avoid the needs to recompile the unit all the time in my main projects. The DCU gets updated, but we need to copy the DFM manually everytime it changes. Same goes for any {$R *.res} specified. Maybe we could maintain those file directly in the DCU folder... but doesn't quite make sense to have a .DFM in a different folder than a .PAS

I looked for a compiler switch that would do it... Unsuccesfully.

Anyone knows if/how it can be achieved?

I'm using Delphi 2010


Solution

  • You could create a simple Post Build event which performed the copying. That way whenever you did a build, the system would copy the necessary files for you. The build events are available from the Project Options menu, there is a Pre-build and a Post-Build script.