Recent

Author Topic: saving compiled files in a different folder to source?  (Read 5800 times)

dieselnutjob

  • Full Member
  • ***
  • Posts: 217
saving compiled files in a different folder to source?
« on: April 13, 2021, 03:50:19 pm »
Hi
I am running Lazarus IDE v2.0.12 32 bit on Windows 10 64 bit.

Say I have a folder on my disk containing all of the source code for a project (a .ico, .lpi, .lpr, .lps, .res, .lfm and some .pas files).

How do I configure Lazarus so that when I "compile" or "run" it adds nothing to this source folder but instead uses a completely different folder to put all of its "stuff" and the resultant exe file?

thanks, DNJ

Handoko

  • Hero Member
  • *****
  • Posts: 5129
  • My goal: build my own game engine using Lazarus
Re: saving compiled files in a different folder to source?
« Reply #1 on: April 13, 2021, 03:53:00 pm »
I haven't tried but I believe you can change it by:

Lazarus main menu
> Project > Project Options > left panel: Compiler Options > Paths

dieselnutjob

  • Full Member
  • ***
  • Posts: 217
Re: saving compiled files in a different folder to source?
« Reply #2 on: April 13, 2021, 08:19:52 pm »
Project > Project Options > Compiler Options > Paths > Unit output directory

This had the effect of putting .o .or .ppu and .compiled files in the specified folder, however the .exe file still ends up in the same folder as the source code files

Handoko

  • Hero Member
  • *****
  • Posts: 5129
  • My goal: build my own game engine using Lazarus
Re: saving compiled files in a different folder to source?
« Reply #3 on: April 13, 2021, 08:38:34 pm »
Tested on Lazarus 2.0.10 Linux, it works if I set the path and filename: Target file name (-o).
« Last Edit: April 13, 2021, 08:41:39 pm by Handoko »

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4459
  • I like bugs.
Re: saving compiled files in a different folder to source?
« Reply #4 on: April 13, 2021, 09:52:27 pm »
Tested on Lazarus 2.0.10 Linux, it works if I set the path and filename: Target file name (-o).
There is a related bug :
 https://bugs.freepascal.org/view.php?id=38170
Somebody should study the code and fix it. Target was set to the next 2.2 release.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

Gustavo 'Gus' Carreno

  • Hero Member
  • *****
  • Posts: 1111
  • Professional amateur ;-P
Re: saving compiled files in a different folder to source?
« Reply #5 on: April 14, 2021, 06:46:55 am »
Hey dieselnutjob,

I usually have all my source files under:
Project-Folder/src

So all my projects under Project Options(CTRL+SHIFT+F11)->Paths have what you can see on the image.
Pay attention to (-Fu) and (-o), please

This will put all the compiled intermediate files under:
Project-Folder/bin/lib/CPU-OS

And the executable/binary under
Project-Folder/bin/

Hope this helps

Cheers,
Gus
Lazarus 3.99(main) FPC 3.3.1(main) Ubuntu 23.10 64b Dark Theme
Lazarus 3.0.0(stable) FPC 3.2.2(stable) Ubuntu 23.10 64b Dark Theme
http://github.com/gcarreno

Dzandaa

  • Full Member
  • ***
  • Posts: 248
  • From C# to Lazarus
Re: saving compiled files in a different folder to source?
« Reply #6 on: November 13, 2022, 11:57:43 am »
Hi,

This is my configuration:

in: Lazarus main menu > Project > Project Options > left panel: Compiler Options > ... (Create Debug and Release)


In (Target file name -o) for Debug
bin\Debug\$(TargetCPU)-$(TargetOS)\project1

In (Target file name -o) for Release
bin\Release\$(TargetCPU)-$(TargetOS)\project1

And Click "Set compiler Options as default"

This will create separate directory for "bin/Debug/Os" and "bin/Release/OS"

Example:

projet1
 bin
   Debug
    x86_64-linux\projet1
    x86_64-win64\projet1.exe
 bin
   Release
    x86_64-linux\projet1
    x86_64-win64\projet1.exe



Easier to compile for different O.S.
Hope this help.

B->

Dzandaa

 

TinyPortal © 2005-2018