Required packages depending on the OS lazarus / 23-Operating Systems ---------------------------------------------------------------------- MaxM74 · 2024-11-04 11:36 I am developing a cross platform Windows/Linux desktop application. When the application is compiled for Windows it will use some specific packages, when it is compiled for Linux it will use others. The question is...is there a way to  {$ifdef} required packages depending on the OS ?. ---------------------------------------------------------------------- cdbc · 2024-11-04 12:24 Hi Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i {$ifdef unix}   unix-dependencies {$else}  windows-dependencies {$endif}Should roughly do it, as Mac belongs under unix... Regards Benny ---------------------------------------------------------------------- PascalDragon · 2024-11-04 20:13 Quote from: cdbc on November 04, 2024, 01:24:17 pmShould roughly do it, as Mac belongs under unix... Please note that MaxM74 is talking about packages, not units. ---------------------------------------------------------------------- cdbc · 2024-11-04 21:02 Hi Ooopsss, sorry - my bad, that escaped me...  Thanks Sven Regards Benny ---------------------------------------------------------------------- dbannon · 2024-11-04 22:15 Quote from: MaxM74 on November 04, 2024, 12:36:17 pmThe question is...is there a way to  {$ifdef} required packages depending on the OS ?. If you are cross compiling from one machine, then you will need to have all the required packages installed. Each compile run will (given sensible uses of Benny's instructions) will not even know about the ones it does not need. If you are compiling on different platforms, obviously you only install packages needed for that install. Again, Benny's answer may well be that answer you are looking for. Davo ---------------------------------------------------------------------- MaxM74 · 2024-11-05 09:36 for example...my application use image acquisition from scanners. So if you are under Windows in the project file (lpi) there is: Code: XML  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i                                                                                                                                         As you can see the first 2 items are strictly platform dependent because they use Windows DLLs and ActiveX. If in the near future i want to port the application to Linux what should i do? I should make another lpi project file where there would be something like: Code: XML  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i                           ..commons Items      My opinion is that it would be useful to add something to filter the required packages by platform and include only those of the platform being compiled. example : Code: XML  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i                                                              ---------------------------------------------------------------------- korba812 · 2024-11-05 11:00 I also encountered this problem. I solved it by using two lpi files (one for windows the other for unix) and a shared lpr and units/forms files between them. This is not a perfect solution (you have to remember to make changes to both project files, e.g. resources or new units) however it works. ---------------------------------------------------------------------- MaxM74 · 2024-11-05 12:45 Quote from: korba812 on November 05, 2024, 12:00:42 pmI also encountered this problem. I solved it by using two lpi files (one for windows the other for unix) and a shared lpr and units/forms files between them. This is not a perfect solution (you have to remember to make changes to both project files, e.g. resources or new units) however it works. my idea could be a good feature to add to the IDE ---------------------------------------------------------------------- korba812 · 2024-11-05 14:17 Well, sure. But before you start implementing it, consider whether it's better to make use of a particular package dependent on the build mode instead of the platform.