You've already forked lazarus-ccr
instantfpc: environment variable INSTANTFPCOPTIONS
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@1910 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -25,7 +25,7 @@ uses
|
|||||||
Classes, SysUtils, InstantFPTools;
|
Classes, SysUtils, InstantFPTools;
|
||||||
|
|
||||||
const
|
const
|
||||||
Version = '1.0';
|
Version = '1.1';
|
||||||
|
|
||||||
|
|
||||||
Procedure Usage;
|
Procedure Usage;
|
||||||
@ -49,12 +49,15 @@ begin
|
|||||||
writeln(' If compilation was successful the program is executed.');
|
writeln(' If compilation was successful the program is executed.');
|
||||||
writeln(' If the compiler options contains -B the program is always');
|
writeln(' If the compiler options contains -B the program is always');
|
||||||
writeln(' compiled.');
|
writeln(' compiled.');
|
||||||
|
writeln(' If the environment option INSTANTFPCOPTIONS is set it is');
|
||||||
|
writeln(' passed to the compiler as first parameters.');
|
||||||
writeln;
|
writeln;
|
||||||
writeln('instantfpc --get-cache');
|
writeln('instantfpc --get-cache');
|
||||||
writeln(' Prints cache directory to stdout.');
|
writeln(' Prints cache directory to stdout.');
|
||||||
writeln;
|
writeln;
|
||||||
writeln('instantfpc --set-cache=<path to cache>');
|
writeln('instantfpc --set-cache=<path to cache>');
|
||||||
writeln(' Set the cache to be used.');
|
writeln(' Set the cache to be used. Otherwise using environment variable');
|
||||||
|
writeln(' INSTANTFPCCACHE.');
|
||||||
writeln;
|
writeln;
|
||||||
writeln('instantfpc --compiler=<path to compiler>');
|
writeln('instantfpc --compiler=<path to compiler>');
|
||||||
writeln(' Normally fpc is searched in PATH and used as compiler.');
|
writeln(' Normally fpc is searched in PATH and used as compiler.');
|
||||||
|
@ -13,6 +13,10 @@ unit InstantFPTools;
|
|||||||
{$define HASEXEEXT}
|
{$define HASEXEEXT}
|
||||||
{$endif go32v2}
|
{$endif go32v2}
|
||||||
|
|
||||||
|
{$IFNDEF VER2_4}
|
||||||
|
{$DEFINE UseExeSearch}
|
||||||
|
{$ENDIF}
|
||||||
|
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
@ -138,14 +142,14 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function GetCompiler: string;
|
function GetCompiler: string;
|
||||||
|
|
||||||
var
|
var
|
||||||
|
CompFile: String;
|
||||||
|
{$IFNDEF UseExeSearch}
|
||||||
Path: String;
|
Path: String;
|
||||||
p: Integer;
|
p: Integer;
|
||||||
StartPos: LongInt;
|
StartPos: LongInt;
|
||||||
Dir: String;
|
Dir: String;
|
||||||
CompFile: String;
|
{$ENDIF}
|
||||||
|
|
||||||
begin
|
begin
|
||||||
Result:=CmdCompiler;
|
Result:=CmdCompiler;
|
||||||
if (Result<>'') then
|
if (Result<>'') then
|
||||||
@ -164,9 +168,11 @@ begin
|
|||||||
{$ELSE}
|
{$ELSE}
|
||||||
CompFile:='fpc';
|
CompFile:='fpc';
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
{$IFDEF UseExeSearch}
|
||||||
|
Result:=ExeSearch(CompFile);
|
||||||
|
{$ELSE}
|
||||||
Path:=GetEnvironmentVariable('PATH');
|
Path:=GetEnvironmentVariable('PATH');
|
||||||
{$IFDEF VER2_4}
|
if Path<>'' then begin
|
||||||
if PATH<>'' then begin
|
|
||||||
p:=1;
|
p:=1;
|
||||||
while p<=length(Path) do begin
|
while p<=length(Path) do begin
|
||||||
StartPos:=p;
|
StartPos:=p;
|
||||||
@ -179,8 +185,6 @@ begin
|
|||||||
inc(p);
|
inc(p);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
{$ELSE}
|
|
||||||
Result:=ExeSearch(CompFile);
|
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
if (Result='') then
|
if (Result='') then
|
||||||
@ -213,7 +217,7 @@ begin
|
|||||||
Proc.Execute;
|
Proc.Execute;
|
||||||
ss:=TStringStream.Create('');
|
ss:=TStringStream.Create('');
|
||||||
repeat
|
repeat
|
||||||
Count:=Proc.Output.Read(Buf,4096);
|
Count:=Proc.Output.Read(Buf{%H-},4096);
|
||||||
if Count>0 then
|
if Count>0 then
|
||||||
ss.write(buf,count);
|
ss.write(buf,count);
|
||||||
until Count=0;
|
until Count=0;
|
||||||
@ -234,7 +238,7 @@ var
|
|||||||
p: String;
|
p: String;
|
||||||
i : integer;
|
i : integer;
|
||||||
begin
|
begin
|
||||||
Result:='';
|
Result:=GetEnvironmentVariable('INSTANTFPCOPTIONS');
|
||||||
I:=1;
|
I:=1;
|
||||||
While (I<=ParamCount) and (Copy(ParamStr(i),1,1)='-') do
|
While (I<=ParamCount) and (Copy(ParamStr(i),1,1)='-') do
|
||||||
begin
|
begin
|
||||||
|
Reference in New Issue
Block a user