Recent

Author Topic: Best way to combine projects  (Read 369 times)

whallis

  • Newbie
  • Posts: 4
Best way to combine projects
« on: August 22, 2022, 02:24:11 pm »
I'm working on several projects that will be standalone executables at first, just to get some data into our database. Eventually, they will all need to be combined into one large executable. Is there a 'best practice' way to do this? Create a project with a menu that calls all the others, for example? Or is there a higher-level entity that would compile all the projects together?

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 10399
  • FPC developer.
Re: Best way to combine projects
« Reply #1 on: August 22, 2022, 02:35:00 pm »
No such way is provided with FPC/Lazarus. There are some hackish ways (as in storing EXEs in resources, extracting them to temp and run them there), but nothing I really can recommend.

Usually it is better to merge the at the source level.

MarkMLl

  • Hero Member
  • *****
  • Posts: 5595
Re: Best way to combine projects
« Reply #2 on: August 22, 2022, 03:23:06 pm »
Noting Marco's comment, but might be viable to put the meat of each standalone app in a unit (or group of units) separate from the main project file and form... call them turkey, duck and chicken or whatever... and then when you're ready write a fourth project file and main form that combines them into a succulent whole.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 10399
  • FPC developer.
Re: Best way to combine projects
« Reply #3 on: August 22, 2022, 03:27:47 pm »
That 's what I meant. Note that the application startup in the .lpr is just code, you can e.g. start another form as default by just inserting code.

Most of my apps have a default and a "setup" mode (to configure IPs, comports etc). The setup mode is a totally different set of forms and associated logic, though basic units are shared between both modes.
« Last Edit: August 22, 2022, 03:49:39 pm by marcov »

whallis

  • Newbie
  • Posts: 4
Re: Best way to combine projects
« Reply #4 on: August 22, 2022, 03:32:54 pm »
Noting Marco's comment, but might be viable to put the meat of each standalone app in a unit (or group of units) separate from the main project file and form... call them turkey, duck and chicken or whatever... and then when you're ready write a fourth project file and main form that combines them into a succulent whole.

MarkMLl

Yes, that's what I was thinking to do, but wanted to see if there was a better way. Thank you both!

Paolo

  • Sr. Member
  • ****
  • Posts: 333
Re: Best way to combine projects
« Reply #5 on: August 22, 2022, 03:42:04 pm »
Maybe it is not what you are looking for, but I have a lot of project made of just one form, then when I want to collect them in one application I do something like in attached project.
Essentially, I add a tpagecontrol and on each tabsheet I put the main form of each subprogram (in the attached project just click on the button to dinamically load form2 in the first tabsheet).

Nicole

  • Hero Member
  • *****
  • Posts: 503
Re: Best way to combine projects
« Reply #6 on: August 22, 2022, 03:53:33 pm »
I work with Frames.
Every project is developed not on a TForm but on a TFrame.
These Frames are created on a Form at runtime and can be previewed by F12 at design-time as well.
At the end of all projects, you generate not ONE Frame on your form, but all of them.

This is, how the code may look alike:

Var
 Frame_ReportsOnMain: TFrame_Frame_Reports = nil;  // this leads into your report unit, which may be developed by Peter


procedure TForm1.FormCreate(Sender: TObject);
begin

  if Frame_ReportsOnfMain = nil then begin
     Frame_ReportsOnMain:=TFrame_Berichte.Create(self);  // into storage
     Frame_ReportsOnMain.Parent:=TabSheet_Reports; // display
                                       end;   
end;

MarkMLl

  • Hero Member
  • *****
  • Posts: 5595
Re: Best way to combine projects
« Reply #7 on: August 22, 2022, 04:39:35 pm »
Yes, that's what I was thinking to do, but wanted to see if there was a better way. Thank you both!

There's an IDE addon called Build Project Group or similar which might help. However I'd suggest not using Project Profiles in conjunction with that, since it will always try to use the most recent profile which has been used for each project rather than locking the most appropriate one in.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

 

TinyPortal © 2005-2018