mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-20 19:19:31 +01:00
build lazarus now uses custom compiler path
git-svn-id: trunk@4812 -
This commit is contained in:
parent
3f3d0e3574
commit
d70ded3c70
@ -214,6 +214,8 @@ type
|
||||
function GetCompiledSrcExtForDirectory(const Directory: string): string;
|
||||
function FindUnitInUnitLinks(const Directory, UnitName: string): string;
|
||||
function GetUnitLinksForDirectory(const Directory: string): string;
|
||||
procedure GetFPCVersionForDirectory(const Directory: string;
|
||||
var FPCVersion, FPCRelease, FPCPatch: integer);
|
||||
|
||||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
|
||||
@ -777,6 +779,55 @@ begin
|
||||
Result:=Evaluator[ExternalMacroStart+'UnitLinks'];
|
||||
end;
|
||||
|
||||
procedure TCodeToolManager.GetFPCVersionForDirectory(const Directory: string;
|
||||
var FPCVersion, FPCRelease, FPCPatch: integer);
|
||||
var
|
||||
Evaluator: TExpressionEvaluator;
|
||||
i: Integer;
|
||||
VarName: String;
|
||||
p: Integer;
|
||||
|
||||
function ReadInt(var AnInteger: integer): boolean;
|
||||
var
|
||||
StartPos: Integer;
|
||||
begin
|
||||
StartPos:=p;
|
||||
AnInteger:=0;
|
||||
while (p<=length(VarName)) and (VarName[p] in ['0'..'9']) do begin
|
||||
AnInteger:=AnInteger*10+(ord(VarName[p])-ord('0'));
|
||||
if AnInteger>=100 then begin
|
||||
Result:=false;
|
||||
exit;
|
||||
end;
|
||||
inc(p);
|
||||
end;
|
||||
Result:=StartPos<p;
|
||||
end;
|
||||
|
||||
begin
|
||||
FPCVersion:=0;
|
||||
FPCRelease:=0;
|
||||
FPCPatch:=0;
|
||||
Evaluator:=DefineTree.GetDefinesForDirectory(Directory,true);
|
||||
if Evaluator=nil then exit;
|
||||
for i:=0 to Evaluator.Count-1 do begin
|
||||
VarName:=Evaluator.Names(i);
|
||||
if (length(VarName)>3) and (VarName[1] in ['V','v'])
|
||||
and (VarName[2] in ['E','e']) and (VarName[3] in ['R','r'])
|
||||
and (VarName[4] in ['0'..'9']) then begin
|
||||
p:=4;
|
||||
if not ReadInt(FPCVersion) then continue;
|
||||
if (p>=length(VarName)) or (VarName[p]<>'_') then continue;
|
||||
inc(p);
|
||||
if not ReadInt(FPCRelease) then continue;
|
||||
if (p>=length(VarName)) or (VarName[p]<>'_') then continue;
|
||||
inc(p);
|
||||
if not ReadInt(FPCPatch) then continue;
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
function TCodeToolManager.Explore(Code: TCodeBuffer;
|
||||
var ACodeTool: TCodeTool; WithStatements: boolean): boolean;
|
||||
begin
|
||||
|
||||
@ -61,15 +61,15 @@ type
|
||||
function IndexOfName(const VarName: string): integer;
|
||||
procedure Expand;
|
||||
public
|
||||
property Variables[const Name:string]: string
|
||||
property Variables[const Name: string]: string
|
||||
read GetVariables write SetVariables; default;
|
||||
property Count: integer read FCount;
|
||||
procedure Undefine(const Name:string);
|
||||
function IsDefined(const Name:string): boolean;
|
||||
procedure Undefine(const Name: string);
|
||||
function IsDefined(const Name: string): boolean;
|
||||
function Equals(AnExpressionEvaluator: TExpressionEvaluator): boolean;
|
||||
procedure Assign(SourceExpressionEvaluator: TExpressionEvaluator);
|
||||
procedure AssignTo(SL: TStringList);
|
||||
function Eval(const Expression:string):string;
|
||||
function Eval(const Expression: string):string;
|
||||
property ErrorPosition:integer read ErrorPos;
|
||||
property OnChange: TOnValuesChanged read FOnChange write FOnChange;
|
||||
function Items(Index: integer): string;
|
||||
|
||||
@ -133,7 +133,7 @@ type
|
||||
procedure Assign(Source: TBuildLazarusOptions);
|
||||
procedure SetBuildAll;
|
||||
function FindName(const Name: string): TBuildLazarusItem;
|
||||
function CompiledUnitExt: string;
|
||||
function CompiledUnitExt(FPCVersion, FPCRelease: integer): string;
|
||||
public
|
||||
property Count: integer read GetCount;
|
||||
property Items[Index: integer]: TBuildLazarusItem read GetItems;
|
||||
@ -207,7 +207,8 @@ function ShowConfigureBuildLazarusDlg(
|
||||
|
||||
function BuildLazarus(Options: TBuildLazarusOptions;
|
||||
ExternalTools: TExternalToolList; Macros: TTransferMacroList;
|
||||
const PackageOptions: string; Flags: TBuildLazarusFlags): TModalResult;
|
||||
const PackageOptions, CompilerPath: string;
|
||||
Flags: TBuildLazarusFlags): TModalResult;
|
||||
function CreateBuildLazarusOptions(Options: TBuildLazarusOptions;
|
||||
ItemIndex: integer; Macros: TTransferMacroList;
|
||||
const PackageOptions: string; Flags: TBuildLazarusFlags;
|
||||
@ -280,7 +281,8 @@ end;
|
||||
|
||||
function BuildLazarus(Options: TBuildLazarusOptions;
|
||||
ExternalTools: TExternalToolList; Macros: TTransferMacroList;
|
||||
const PackageOptions: string; Flags: TBuildLazarusFlags): TModalResult;
|
||||
const PackageOptions, CompilerPath: string;
|
||||
Flags: TBuildLazarusFlags): TModalResult;
|
||||
var
|
||||
Tool: TExternalToolOptions;
|
||||
i: Integer;
|
||||
@ -295,6 +297,8 @@ begin
|
||||
Tool.Filename:=Options.MakeFilename;
|
||||
Tool.EnvironmentOverrides.Values['LCL_PLATFORM']:=
|
||||
LCLPlatformNames[Options.LCLPlatform];
|
||||
if CompilerPath<>'' then
|
||||
Tool.EnvironmentOverrides.Values['PP']:=CompilerPath;
|
||||
if not FileExists(Tool.Filename) then begin
|
||||
Tool.Filename:=FindDefaultMakePath;
|
||||
if not FileExists(Tool.Filename) then exit;
|
||||
@ -1004,16 +1008,14 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
function TBuildLazarusOptions.CompiledUnitExt: string;
|
||||
function TBuildLazarusOptions.CompiledUnitExt(FPCVersion, FPCRelease: integer
|
||||
): string;
|
||||
begin
|
||||
Result:=GetDefaultCompiledUnitExt;
|
||||
if AnsiCompareText(TargetOS,'win32')=0 then
|
||||
Result:=GetDefaultCompiledUnitExt(FPCVersion,FPCRelease);
|
||||
if (AnsiCompareText(TargetOS,'win32')=0)
|
||||
and (FPCVersion=1) and (FPCRelease=0) then
|
||||
Result:='.ppw'
|
||||
else if (AnsiCompareText(TargetOS,'linux')=0)
|
||||
or (AnsiCompareText(TargetOS,'freebsd')=0)
|
||||
or (AnsiCompareText(TargetOS,'netbsd')=0)
|
||||
or (AnsiCompareText(TargetOS,'openbsd')=0)
|
||||
then
|
||||
else
|
||||
Result:='.ppu';
|
||||
end;
|
||||
|
||||
|
||||
@ -154,7 +154,7 @@ begin
|
||||
Result:='';
|
||||
end;
|
||||
|
||||
function GetDefaultCompiledUnitExt: string;
|
||||
function GetDefaultCompiledUnitExt(FPCVersion, FPCRelease: integer): string;
|
||||
begin
|
||||
Result:='.ppu';
|
||||
end;
|
||||
|
||||
@ -136,9 +136,12 @@ begin
|
||||
Result:='.exe';
|
||||
end;
|
||||
|
||||
function GetDefaultCompiledUnitExt: string;
|
||||
function GetDefaultCompiledUnitExt(FPCVersion, FPCRelease: integer): string;
|
||||
begin
|
||||
Result:='.ppw';
|
||||
if (FPCVersion=1) and (FPCRelease=0) then
|
||||
Result:='.ppw'
|
||||
else
|
||||
Result:='.ppu';
|
||||
end;
|
||||
|
||||
function GetDefaultTestBuildDirectory: string;
|
||||
@ -179,6 +182,9 @@ end;
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.18 2003/11/16 19:28:33 mattias
|
||||
build lazarus now uses custom compiler path
|
||||
|
||||
Revision 1.17 2003/11/15 13:07:09 mattias
|
||||
added ambigious unit check for IDE
|
||||
|
||||
|
||||
@ -80,7 +80,7 @@ uses
|
||||
function GetDefaultExecutableExt: string;
|
||||
|
||||
// returns the standard file extension for compiled units (e.g '.ppu')
|
||||
function GetDefaultCompiledUnitExt: string;
|
||||
function GetDefaultCompiledUnitExt(FPCVersion, FPCRelease: integer): string;
|
||||
|
||||
procedure GetDefaultCompilerFilenames(List: TStrings);
|
||||
procedure GetDefaultTestBuildDirs(List: TStrings);
|
||||
@ -143,6 +143,9 @@ end.
|
||||
|
||||
{
|
||||
$Log$
|
||||
Revision 1.21 2003/11/16 19:28:33 mattias
|
||||
build lazarus now uses custom compiler path
|
||||
|
||||
Revision 1.20 2003/11/15 13:07:09 mattias
|
||||
added ambigious unit check for IDE
|
||||
|
||||
|
||||
18
ide/main.pp
18
ide/main.pp
@ -5899,6 +5899,8 @@ var
|
||||
PkgOptions: string;
|
||||
IDEBuildFlags: TBuildLazarusFlags;
|
||||
InheritedOptionStrings: TInheritedCompOptsStrings;
|
||||
CompiledUnitExt: String;
|
||||
FPCVersion, FPCRelease, FPCPatch: integer;
|
||||
begin
|
||||
if ToolStatus<>itNone then begin
|
||||
MessageDlg(lisNotNow,
|
||||
@ -5913,7 +5915,8 @@ begin
|
||||
SourceNotebook.ClearErrorLines;
|
||||
Result:=BuildLazarus(MiscellaneousOptions.BuildLazOpts,
|
||||
EnvironmentOptions.ExternalTools,MacroList,
|
||||
'',Flags+[blfWithoutLinkingIDE]);
|
||||
'',EnvironmentOptions.CompilerFilename,
|
||||
Flags+[blfWithoutLinkingIDE]);
|
||||
if Result<>mrOk then exit;
|
||||
|
||||
// then compile the IDE
|
||||
@ -5936,10 +5939,15 @@ begin
|
||||
PkgOptions:=PkgBoss.DoGetIDEInstallPackageOptions(InheritedOptionStrings);
|
||||
|
||||
// check ambigious units
|
||||
CodeToolBoss.GetFPCVersionForDirectory(
|
||||
EnvironmentOptions.LazarusDirectory,
|
||||
FPCVersion,FPCRelease,FPCPatch);
|
||||
CompiledUnitExt:=MiscellaneousOptions.BuildLazOpts.CompiledUnitExt(
|
||||
FPCVersion,FPCRelease);
|
||||
Result:=DoCheckUnitPathForAmbigiousPascalFiles(
|
||||
EnvironmentOptions.LazarusDirectory,
|
||||
InheritedOptionStrings[icoUnitPath],
|
||||
MiscellaneousOptions.BuildLazOpts.CompiledUnitExt,'IDE');
|
||||
CompiledUnitExt,'IDE');
|
||||
if Result<>mrOk then exit;
|
||||
end;
|
||||
|
||||
@ -5953,7 +5961,8 @@ begin
|
||||
SourceNotebook.ClearErrorLines;
|
||||
Result:=BuildLazarus(MiscellaneousOptions.BuildLazOpts,
|
||||
EnvironmentOptions.ExternalTools,MacroList,
|
||||
PkgOptions,IDEBuildFlags+[blfUseMakeIDECfg,blfDontClean]);
|
||||
PkgOptions,EnvironmentOptions.CompilerFilename,
|
||||
IDEBuildFlags+[blfUseMakeIDECfg,blfDontClean]);
|
||||
if Result<>mrOk then exit;
|
||||
finally
|
||||
DoCheckFilesOnDisk;
|
||||
@ -10091,6 +10100,9 @@ end.
|
||||
|
||||
{ =============================================================================
|
||||
$Log$
|
||||
Revision 1.670 2003/11/16 19:28:33 mattias
|
||||
build lazarus now uses custom compiler path
|
||||
|
||||
Revision 1.669 2003/11/16 01:56:15 mattias
|
||||
changed TMenuItem.Graphic to TMenuItem.Bitmap
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user