Re: [Lazarus] Using packages for often used units across projects?
On Tue, 14 Feb 2023 10:06:50 +0100 Bo Berglund via lazarus wrote: >[...] > Suppose I make a package with about 10 non-GUI utility units and use > the Package Manager to compile them so they will be known to new > projects if I add a dependency to this package. > > Then in a new project I put a single one of the units into my uses > clause, will then the compile include just that unit Yes, that is the default. > or will it grab > all of the package content into the resulting binary? > > I hope that it will just compile the specified unit into the program > and not the complete package, but want to check this in case I am not > understanding how it works Mattias -- ___ lazarus mailing list lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Using packages for often used units across projects?
On Sun, 12 Feb 2023 15:35:27 +0100, Luca Olivetti via lazarus wrote: > >https://wiki.lazarus.freepascal.org/Lazarus_Packages#Creating_a_package_for_your_common_units > > Follow-up question: --- Suppose I make a package with about 10 non-GUI utility units and use the Package Manager to compile them so they will be known to new projects if I add a dependency to this package. Then in a new project I put a single one of the units into my uses clause, will then the compile include just that unit or will it grab all of the package content into the resulting binary? I hope that it will just compile the specified unit into the program and not the complete package, but want to check this in case I am not understanding how it works -- Bo Berglund Developer in Sweden -- ___ lazarus mailing list lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Using packages for often used units across projects?
On Sun, 12 Feb 2023 15:35:27 +0100, Luca Olivetti via lazarus wrote: >El 12/2/23 a les 14:44, Bo Berglund via lazarus ha escrit: > >> I found the wiki page: >> https://wiki.lazarus.freepascal.org/Lazarus_Packages >> >> it seems not to describe my use case, I believe. > >Actually it does, if you follow the heading "5.4 Creating a package for >your common units" right at the beginning of the page > >https://wiki.lazarus.freepascal.org/Lazarus_Packages#Creating_a_package_for_your_common_units > > >Bye Thanks Luca! This is what I was looking for. :) -- Bo Berglund Developer in Sweden -- ___ lazarus mailing list lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Using packages for often used units across projects?
El 12/2/23 a les 14:44, Bo Berglund via lazarus ha escrit: I found the wiki page: https://wiki.lazarus.freepascal.org/Lazarus_Packages it seems not to describe my use case, I believe. Actually it does, if you follow the heading "5.4 Creating a package for your common units" right at the beginning of the page https://wiki.lazarus.freepascal.org/Lazarus_Packages#Creating_a_package_for_your_common_units Bye -- Luca Olivetti Wetron Automation Technology http://www.wetron.es/ Tel. +34 93 5883004 (Ext.3010) Fax +34 93 5883007 -- ___ lazarus mailing list lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
Re: [Lazarus] Using packages for often used units across projects?
On 2/12/23 15:44, Bo Berglund via lazarus wrote: It seems not so good to copy the files into each project. In Delphi they were accessed from one location by several projects by using search path settings (not available in Lazarus). You can set per-project unit search paths. This is available from Project -> Project Options -> Compiler Options (in the tree at the left side) -> Paths (below Compiler Options -> the "Other unit files" entry (you can use the ... button to edit the paths individually). So now I wonder if one can put several really non-related units in a common package such that they will be available in every application from Lazarus? I.e. package lazcommon containing 5+ different units defining various classes and compiled by the package handler. Yes you can also use packages for this. Simply make a new package, click the "Add" button, click "Add Files from File System" and select the files you want to add to the package. Save, compile and the package is done. To use the package from a project, either a) open the package itself and click "Use" and then "Add to project" or b) open the project's inspector from Project -> Project Inspector, click "Add", click "New requirement" and find the package name in the dialog box. You don't need to have any components or GUI in the package (though if you want it is possible to have components, GUI and forms in them). Kostas -- ___ lazarus mailing list lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus
[Lazarus] Using packages for often used units across projects?
I am working on porting a set of applications (company internal tools and utilities mostly) from Delphi to FPC/Lazarus and now I have encountered use of a number of same units in several different applications. It seems not so good to copy the files into each project. In Delphi they were accessed from one location by several projects by using search path settings (not available in Lazarus). So now I wonder if one can put several really non-related units in a common package such that they will be available in every application from Lazarus? I.e. package lazcommon containing 5+ different units defining various classes and compiled by the package handler. So I am not talking about a package implementing a common typoe of actions like Internet communications or some graphics hanling or such, just a container that would simplify using commonly used units like for serial comm, application logging, special graphics etc These files would not have a GUI impact at all, never placed on a form and not configured in the GUI... So this package would not be installed, just compiled in the package manager. If this is how it can be done, is there some tutorial (for dummies) that handles the way it is done? I found the wiki page: https://wiki.lazarus.freepascal.org/Lazarus_Packages it seems not to describe my use case, I believe. But it is too dense for me to really understand it all... -- Bo Berglund Developer in Sweden -- ___ lazarus mailing list lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus