[Lazarus] Shared project configuration

hinstance hinstance at yandex.ru
Tue Mar 25 16:05:14 CET 2014


25.03.2014 11:53, Xiangrong Fang ?????:
> Hi All,
>
> Is it possible for lazarus to use "shared project configurations"? The 
> scenario is:
>
> 1. I have a project layout as below:
>
> <root>
>   <src>
>     <units>
>     <demos>
>   <bin>
>   <doc>
>
> The core units I am writing will be put into <root>/<src>/<units>, 
> while <demos> sub-dir will contain demo project I use to test/debug 
> the units.
>
> At present, I will have to configure any new project to let it look 
> for units under <root>/<src>/<units>.
>
> It will be useful to have a "project group configuration", such as 
> "projects.prg", which can be opened by lazarus to create a shared 
> configuration, and from that lazrus session, all new project I create 
> will by default "inherit" environment settings in the "project group" 
> file (which can be customized individually, of course).
>
> Another important reason to have such file is that I want to add it to 
> version control system.
>
> Is that possible?
>
> Xiangrong
>
>
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

To get something like shared project configuration one could utilize 
FreePascal config files. 
http://www.freepascal.org/docs-html/user/usersu10.html
Then specify same fpc config file for every project. FPC config files 
have include directive, so they are flexible to some degree
This way one could have multiple projects refer to a single FPC config 
file, then change search path for all projects altogether.
Assume one has two versions of library, then creates two FPC config files:

lib_v1.fpc:
#Define lib_v1
-FU../lib_v1/src
-FU../lib_v1/src/additional

lib_v2.fpc
#Define lib_v2
-FU../lib_v2/src
-FU../lib_v2/src/additional

Then specify fpc config file for multiple projects with content of the 
config file looking something like:
#Include ../lib_v1.fpc

Then one would be able to change compiler settings for both projects by 
changing settings in fpc config file. For example switch from library v1 
to library v2:
#Include ../lib_v2.fpc

lawl. I hope you got the idea.
I think this is currently the best approach for multiple Lazarus 
projects sharing common configuration.
Alternatively one could possibly use Lazarus packages for this task.
The only question which bothers me concerning fpc-config-file approach 
is the following: whether Lazarus editor code completion will work in 
this case or not? Will Lazarus search for sources specified in FPC 
config files? Something tells me that yes, it will, since it should be 
dealing with standard fpc config file somehow (the one which is in the 
same directory where compiler executable is)
Hope this helps

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20140325/317a415c/attachment-0003.html>


More information about the Lazarus mailing list