Graeme Geldenhuys wrote 8 lines
On 10/08/07, Michael Van Canneyt wrote:
> T:=Targets.AddUnit('myunit');
> T.ResourceStrings:=True;
> T:=Targets.AddUnit('myprogram');
> T.AddDependency('myunit');
Does this take directories as well?
Not like this.
You'll have to do this with the unit path:
Case OS of
Windows : begin
T.UnitPath:='corelib/gdi';
T.AddDependency('gfx_gdi');
end;
linux : begin
T.UnitPath:='corelib/x11';
T.AddDependency('gfx_x11');
end;
// etc.
end;
Obviously, the fpmake program is a normal pascal program, so you can do complicated stuff like this:
-----------------------------------------------------------------------
program fpmake;
Type
TWidgetSet = (wsGDI,wsX,wCarbon);
Var
WidgetSet : TWidgetSet;
procedure DetermineWidgetSet;
Var
I : Integer;
begin
Case Installer.OS of
Windows : WidgetSet:=wsGDI;
Linux : Widgetset:=wsX;
macos : WidgetSet:=wsCarbon
end;
// Check paramstr() to see if the widgetset was overridedn on the commandline;
For I:=1 to ParamCount do
If ParamStr(i)='--widgetset=X' then
WidgetSet:=wsX;
end;
begin
DetermineWidgetSet;
With Installer do
/// ....
Case WidgetSet of
wsGDI : T.UnitPath:='corelib/gdi';
wsX : T.UnitPath:='corelib/x11';
// etc.
end;
...
Run;
end;
-----------------------------------------------------------------------
Show quoted text 28 lines
Here is a fpGUI layout example:
Windows:
src/corelib/gdi/gfx_gdi.pas
Linux:
src/corelib/x11/gfx_x11.pas
Carbon:
src/corelib/carbon/gfx_carbon.pas
Common to all platforms:
src/corelib/fpgui.pas
src/corelib/gfxbase.pas
src/gui/gui_*.pas
> The idea is that everyone who programs pascal, knows pascal,
> and so the 'make' tool should also be in pascal...
That's a fair assumption. :)
> ./fpmake --install
>
> will install it.
Install to where?
Default for the FPC installation, or to installdir You can do a
fpmake --baseinstalldir='c:\program files\my package';
or set the default directory in the fpmake source code.
It's super configurable.
A
./fpmake --help
will give you all options, in good unix tradition :-)
Michael.