Le 28/12/2020 à 18:13, Bo Berglund via lazarus a écrit :
Could you please direct me to where in Lazarus this can be done?
Usually when I add a unit uA.pas to a project (by opening the unit in the code and then hitting Shift+F11 or Project/Add editor file to project), Lazarus asks me if I want to add this path to the search path for units.
There can be a problem if you further create a visual component in a unit uB.pas that uses uA.pas.
You will need to create a package for uB.pas or add it to an existing package. Let's call this package pB.lpk .
In this case you can no longer add the directory of uA.pas to the search path, because you'll end up with duplicate ppu files. (I'm not sure of the error, but Lazarus and the compiler complain and advise you to use the package).
To address this problem, I have a specific package pA.lpk where I put uA.pas, and I add pA to the dependencies of pB . (eventually, you can put all you common code in a single package too)
In my real code pA is the package**OD_DelphiReportEngine_Units.lpk where I put all my units which can run headless in console with no GUI ( https://github.com/jsuzineau/pascal_o_r_mapping/blob/master/pascal_o_r_mapping/2_Units/OD_DelphiReportEngine_Units.lpk ).
And pB is OD_DelphiReportEngine_Controls.lpk where I put all my custom controls (visual components) (https://github.com/jsuzineau/pascal_o_r_mapping/blob/master/pascal_o_r_mapping/5_Controls/OD_DelphiReportEngine_Controls.lpk)
I even had a third intermediary package OD_DelphiReportEngine_Components.lpk for non visual components which can be used for example in datamodules in console apps working with databases ( https://github.com/jsuzineau/pascal_o_r_mapping/blob/master/pascal_o_r_mapping/4_Components/OD_DelphiReportEngine_Components.lpk*)
* * *
-- _______________________________________________ lazarus mailing list lazarus@lists.lazarus-ide.org https://lists.lazarus-ide.org/listinfo/lazarus