Recent

Author Topic: [SOLVED] Separate output folders for debug and release executables.  (Read 317 times)

GypsyPrince

  • Guest
I have a query similar to the one at this link:

https://forum.lazarus.freepascal.org/index.php/topic,7266.msg34271.html#msg34271

The gentleman in this post wanted to move all his temp and library files (produced during compilation) into a different folder - out and away from his executable which remains in his project folder.
 
I, however, want to do this the other way. I want the library and temp files to continue being written where they currently are. But I want to designate 'bin' subfolders for the debug and the release executable files.

Example:
"...My Documents\Lazarus\Projects\" is my default project folder on my Windows 10 system.

When I create a new project, I create a new folder for that application:

"...My Documents\Lazarus\Projects\MyAppName\"

This directory is where my source code is stored and to where the executable is written. Also, a subfolder called "lib" is added with several compiled library/object files.  This is the default setting for Lazarus. And for the most part, I want to leave it like this. However, I want the output configuration for my executable files to be like this:

"...My Documents\Lazarus\Projects\MyAppName\bin\debug\"
"...My Documents\Lazarus\Projects\MyAppName\bin\release\"

Is it possible to configure Lazarus options to do this? If so, where would I make the change? If I could not make a separate configuration for debug and release, I would be happy with a single output subfolder such as:

"...My Documents\Lazarus\Projects\MyAppName\bin\"

The reason I ask this is my application will usually link to several files during runtime (database, help, images, etc.) for which each type will be kept in a separate subfolder. So... I would like to have my executable and all the runtime subfolders/files completely separate from the design-time and source files.

The "output" folder would act as the application's installation folder while I'm testing changes to my app. Any files which would be installed on the end-user's machine would not be mixed in with the source files and folders.

Can this currently be set in one of the compiler options (paths) for each project?
« Last Edit: March 18, 2020, 07:00:53 pm by GypsyPrince »

GetMem

  • Hero Member
  • *****
  • Posts: 3669
Re: Separate output folders for debug and release executables.
« Reply #1 on: March 17, 2020, 07:50:05 am »
Go to Project->Project Options->Compiler Options->Paths->Build Modes. Create a "Build and Release modes" then for each mode set the targetfilename(-0):
bin\debug\MyAppName and bin\release\MyAppName.

GypsyPrince

  • Guest
Re: Separate output folders for debug and release executables.
« Reply #2 on: March 17, 2020, 08:00:02 am »
@Getmem
Thank you!!! That is exactly what I wanted. Awesome!

 

TinyPortal © 2005-2018