Packages as library path replacement? lazarus / 8-Other ---------------------------------------------------------------------- igel457 · 2008-03-02 17:58 Hello, I'm the developer of the platform  2D-Engine Andorra 2D. When adding Lazarus support to it, I noticed, that Lazarus does not have a global search path. Instead you have to setup the library paths for every project you create. The problem is that you have to add 3-4 path every time you create a new project. This wouldn't be so worse, if it were the same paths on all platforms. So I reported this as an feature request on the bug-tracker: http://bugs.freepascal.org/view.php?id=10762 There Vincent Snijders told me: Quote Low priority, because - global paths are discourage in favor of using packages. - global paths can be set in the fpc.cfg file. In other words, it is almost a won't fix, but submitting a patch which implements this might not get rejected right away. "Great!", I thought. "All I have to do is to add my 58 units which may be used by Andorra 2D to a package, distribute it and everything is fine." The problem is - it doesn't work this way. The IDE wants to compile all units in the package at once - but some units have dependencies on other libraries or platforms. Another point is, that a simple "Hello World"-Program will only need 5 of those 58 units. In short: How can I make it easy for me and the users of my library to use it with Lazarus? Thank you for your answers, Andreas ---------------------------------------------------------------------- Vincent Snijders · 2008-03-02 19:26 Quote from: "igel457" Another point is, that a simple "Hello World"-Program will only need 5 of those 58 units. What it the problem here? It may use only 10 of the +100 fpc units you have. ---------------------------------------------------------------------- Vincent Snijders · 2008-03-02 19:32 Quote from: "igel457" "Great!", I thought. "All I have to do is to add my 58 units which may be used by Andorra 2D to a package, distribute it and everything is fine." The problem is - it doesn't work this way. The IDE wants to compile all units in the package at once - but some units have dependencies on other libraries or platforms. You can split the package, so that all units in one package have the same compiler settings. You can omit the platform dependent units from the package, as long as they are used indirectly, so that the compile compiles them when one of the other units in the package are compiled. ---------------------------------------------------------------------- igel457 · 2008-03-02 19:39 Hi Vincent, thanks for your reply I'll try it that way. I just was confused, why it had to compile all files in the package when adding it to a project. Andreas PS: Anyway, thanks for Free Pascal and Lazarus! ;-) ---------------------------------------------------------------------- igel457 · 2008-03-03 12:34 Hm, still it doesn't work the way I want it to. Take this as an example: My 2D Engine supports different Window-Framework backends - for example the VCL/LCL for creating a DirectX/OpenGL Device-Context on it, the LCL using LazOpenGLContext, GLFW or native Win32. All the user has to do, to choose one of those Window-Frameworks is to add  the unit (e.g. "AdLCLOGLWindow", which uses LazOpenGLContext) to the uses clause somewhere in the project. To ensure that the unit is found by the compiler, it has to be in the library path or in a package. But if it is in the package, it will be (in this example) dependent to LazOpenGLContext, although Andorra 2D provides solutions which are not. Or worse, if the window-framework, a video loader, a model loader or a texture loader have dependencies to an external library (.dll or .so), it won't compile on linux until the external library is found for linking. Is splitting my project into multiple paths the only solution? I mean, I don't think that it is a good thing that the users have to add ten additional packages to their project if they want to use Andorra 2D. For them it much easier with Delphi: Just add 3 or 4 paths to the global library path and thats it. I may also be just too stupid ;-) Thanks for your reply, Andreas ---------------------------------------------------------------------- Vincent Snijders · 2008-03-03 19:07 If you want a windows only solution, yes then you can add them in one package. Look at the printers4lazarus package for an example of a package with platform dependencies. ---------------------------------------------------------------------- igel457 · 2008-03-03 19:19 Thanks for your reply. I think I'll forget about that package thing and ask my users to add the library path manually. Again thank you for your efforts, Andreas ---------------------------------------------------------------------- Vincent Snijders · 2008-03-04 19:32 I'll try to get the source from cvs and try to figure out where your problems are. ---------------------------------------------------------------------- igel457 · 2008-03-05 16:50 Thanks for your endeavour, this would be really great. If you have any questions just ask me.