mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 07:59:28 +02:00
Merged revision(s) 60539 #74f40164bd, 60541 #4f1d217a02, 60543 #33c555282c, 60551-60552 #70529aa22d-#70529aa22d from trunk:
IDE: compile package: quote src if needed ........ IDE: fixed compiler kind if project/package compiler is set ........ IDE: use project compiler for codetools even if disabled ........ IDE/codetools: unified compiler check, fixed testing compiler twice ........ IDE: fixed fpc version check for resources ........ git-svn-id: branches/fixes_2_0@60604 -
This commit is contained in:
parent
7c745991a7
commit
b72dacab07
@ -373,7 +373,8 @@ type
|
|||||||
UseCache: boolean = true): string;// value of macro #FPCUnitPath
|
UseCache: boolean = true): string;// value of macro #FPCUnitPath
|
||||||
procedure GetFPCVersionForDirectory(const Directory: string;
|
procedure GetFPCVersionForDirectory(const Directory: string;
|
||||||
out FPCVersion, FPCRelease, FPCPatch: integer);
|
out FPCVersion, FPCRelease, FPCPatch: integer);
|
||||||
function GetPCVersionForDirectory(const Directory: string): integer;
|
function GetPCVersionForDirectory(const Directory: string): integer; deprecated 'use below'; // 2.0.1
|
||||||
|
function GetPCVersionForDirectory(const Directory: string; out Kind: TPascalCompiler): integer;
|
||||||
function GetNamespacesForDirectory(const Directory: string;
|
function GetNamespacesForDirectory(const Directory: string;
|
||||||
UseCache: boolean = true): string;// value of macro #Namespaces
|
UseCache: boolean = true): string;// value of macro #Namespaces
|
||||||
|
|
||||||
@ -1706,19 +1707,32 @@ end;
|
|||||||
|
|
||||||
function TCodeToolManager.GetPCVersionForDirectory(const Directory: string
|
function TCodeToolManager.GetPCVersionForDirectory(const Directory: string
|
||||||
): integer;
|
): integer;
|
||||||
|
var
|
||||||
|
Kind: TPascalCompiler;
|
||||||
|
begin
|
||||||
|
Result:=GetPCVersionForDirectory(Directory,Kind);
|
||||||
|
if Kind=pcFPC then ;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TCodeToolManager.GetPCVersionForDirectory(const Directory: string; out
|
||||||
|
Kind: TPascalCompiler): integer;
|
||||||
var
|
var
|
||||||
Evaluator: TExpressionEvaluator;
|
Evaluator: TExpressionEvaluator;
|
||||||
s: String;
|
s: String;
|
||||||
begin
|
begin
|
||||||
Result:=0;
|
Result:=0;
|
||||||
|
Kind:=pcFPC;
|
||||||
Evaluator:=DefineTree.GetDefinesForDirectory(Directory,true);
|
Evaluator:=DefineTree.GetDefinesForDirectory(Directory,true);
|
||||||
if Evaluator=nil then exit;
|
if Evaluator=nil then
|
||||||
|
exit;
|
||||||
s:=Evaluator['FPC_FULLVERSION'];
|
s:=Evaluator['FPC_FULLVERSION'];
|
||||||
if s<>'' then
|
if s<>'' then
|
||||||
exit(StrToIntDef(s,0));
|
exit(StrToIntDef(s,0));
|
||||||
s:=Evaluator['PAS2JS_FULLVERSION'];
|
s:=Evaluator['PAS2JS_FULLVERSION'];
|
||||||
if s<>'' then
|
if s<>'' then begin
|
||||||
|
Kind:=pcPas2js;
|
||||||
exit(StrToIntDef(s,0));
|
exit(StrToIntDef(s,0));
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCodeToolManager.GetNamespacesForDirectory(const Directory: string;
|
function TCodeToolManager.GetNamespacesForDirectory(const Directory: string;
|
||||||
|
@ -1016,7 +1016,10 @@ type
|
|||||||
property TestFilename: string read GetTestFilename write SetTestFilename; // an empty file to test the compiler, will be auto created
|
property TestFilename: string read GetTestFilename write SetTestFilename; // an empty file to test the compiler, will be auto created
|
||||||
property ExtraOptions: string read GetExtraOptions write SetExtraOptions; // additional compiler options not used as key, e.g. -Fr<language file>
|
property ExtraOptions: string read GetExtraOptions write SetExtraOptions; // additional compiler options not used as key, e.g. -Fr<language file>
|
||||||
function GetFPCVersion(const CompilerFilename, TargetOS, TargetCPU: string;
|
function GetFPCVersion(const CompilerFilename, TargetOS, TargetCPU: string;
|
||||||
UseCompiledVersionAsDefault: boolean): string;
|
UseCompiledVersionAsDefault: boolean): string; deprecated 'use GetPCVersion'; // 2.0.1
|
||||||
|
function GetPCVersion(const CompilerFilename, TargetOS, TargetCPU: string;
|
||||||
|
UseCompiledVersionAsDefault: boolean;
|
||||||
|
out Kind: TPascalCompiler): string;
|
||||||
function FindUnitSet(const CompilerFilename, TargetOS, TargetCPU,
|
function FindUnitSet(const CompilerFilename, TargetOS, TargetCPU,
|
||||||
Options, FPCSrcDir: string;
|
Options, FPCSrcDir: string;
|
||||||
CreateIfNotExists: boolean): TFPCUnitSetCache;
|
CreateIfNotExists: boolean): TFPCUnitSetCache;
|
||||||
@ -1048,11 +1051,11 @@ function GetFPCTargetCPU(TargetCPU: string): string; // normalize
|
|||||||
|
|
||||||
function IsCTExecutable(AFilename: string; out ErrorMsg: string): boolean; // not thread-safe
|
function IsCTExecutable(AFilename: string; out ErrorMsg: string): boolean; // not thread-safe
|
||||||
|
|
||||||
function GuessPascalCompilerFromExeName(Filename: string): TPascalCompiler;
|
function GuessPascalCompilerFromExeName(Filename: string): TPascalCompiler; // thread-safe
|
||||||
function IsCompilerExecutable(AFilename: string; out ErrorMsg: string;
|
function IsCompilerExecutable(AFilename: string; out ErrorMsg: string;
|
||||||
out Kind: TPascalCompiler; Run: boolean): boolean; // not thread-safe
|
out Kind: TPascalCompiler; Run: boolean): boolean; // not thread-safe
|
||||||
function IsFPCExecutable(AFilename: string; out ErrorMsg: string; Run: boolean): boolean; // not thread-safe
|
function IsFPCExecutable(AFilename: string; out ErrorMsg: string; Run: boolean): boolean; deprecated; // 2.1, not thread-safe
|
||||||
function IsPas2JSExecutable(AFilename: string; out ErrorMsg: string; Run: boolean): boolean; // not thread-safe
|
function IsPas2JSExecutable(AFilename: string; out ErrorMsg: string; Run: boolean): boolean; deprecated; // 2.1, not thread-safe
|
||||||
|
|
||||||
// functions to quickly setup some defines
|
// functions to quickly setup some defines
|
||||||
function CreateDefinesInDirectories(const SourcePaths, FlagName: string
|
function CreateDefinesInDirectories(const SourcePaths, FlagName: string
|
||||||
@ -3756,14 +3759,14 @@ function GuessPascalCompilerFromExeName(Filename: string): TPascalCompiler;
|
|||||||
var
|
var
|
||||||
ShortFilename: String;
|
ShortFilename: String;
|
||||||
begin
|
begin
|
||||||
ShortFilename:=ExtractFileNameOnly(Filename);
|
ShortFilename:=LowerCase(ExtractFileNameOnly(Filename));
|
||||||
|
|
||||||
// pas2js*
|
// *pas2js*
|
||||||
if CompareText(LeftStr(ShortFilename,6),'pas2js')=0 then
|
if Pos('pas2js',ShortFilename)>0 then
|
||||||
exit(pcPas2js);
|
exit(pcPas2js);
|
||||||
|
|
||||||
// dcc*.exe
|
// dcc*.exe
|
||||||
if (CompareFilenames(LeftStr(ShortFilename,3),'dcc')=0)
|
if (LeftStr(ShortFilename,3)='dcc')
|
||||||
and ((ExeExt='') or (CompareFileExt(Filename,ExeExt)=0))
|
and ((ExeExt='') or (CompareFileExt(Filename,ExeExt)=0))
|
||||||
then
|
then
|
||||||
exit(pcDelphi);
|
exit(pcDelphi);
|
||||||
@ -3788,8 +3791,7 @@ begin
|
|||||||
//debugln(['IsFPCompiler Short=',ShortFilename]);
|
//debugln(['IsFPCompiler Short=',ShortFilename]);
|
||||||
|
|
||||||
// check ppc*.exe
|
// check ppc*.exe
|
||||||
if (CompareFilenames(LeftStr(ShortFilename,3),'ppc')=0)
|
if CompareText(LeftStr(ShortFilename,3),'ppc')=0 then
|
||||||
then
|
|
||||||
exit(true);
|
exit(true);
|
||||||
|
|
||||||
// check pas2js*
|
// check pas2js*
|
||||||
@ -3842,6 +3844,7 @@ begin
|
|||||||
exit(true);
|
exit(true);
|
||||||
|
|
||||||
ErrorMsg:='fpc executable should start with fpc or ppc';
|
ErrorMsg:='fpc executable should start with fpc or ppc';
|
||||||
|
Result:=false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function IsFPCExecutable(AFilename: string; out ErrorMsg: string; Run: boolean
|
function IsFPCExecutable(AFilename: string; out ErrorMsg: string; Run: boolean
|
||||||
@ -3858,14 +3861,14 @@ begin
|
|||||||
Result:=IsCTExecutable(AFilename,ErrorMsg);
|
Result:=IsCTExecutable(AFilename,ErrorMsg);
|
||||||
if not Result then exit;
|
if not Result then exit;
|
||||||
|
|
||||||
// allow scripts like fpc.sh and fpc.bat
|
// allow scripts like fpc*.sh and fpc*.bat
|
||||||
ShortFilename:=ExtractFileNameOnly(AFilename);
|
ShortFilename:=LowerCase(ExtractFileNameOnly(AFilename));
|
||||||
//debugln(['IsFPCompiler Short=',ShortFilename]);
|
//debugln(['IsFPCompiler Short=',ShortFilename]);
|
||||||
if CompareFilenames(ShortFilename,'fpc')=0 then
|
if (LeftStr(ShortFilename,3)='fpc') then
|
||||||
exit(true);
|
exit(true);
|
||||||
|
|
||||||
// allow ppcxxx.exe
|
// allow ppcxxx.exe
|
||||||
if (CompareFilenames(LeftStr(ShortFilename,3),'ppc')=0)
|
if (LeftStr(ShortFilename,3)='ppc')
|
||||||
and ((ExeExt='') or (CompareFileExt(AFilename,ExeExt)=0))
|
and ((ExeExt='') or (CompareFileExt(AFilename,ExeExt)=0))
|
||||||
then
|
then
|
||||||
exit(true);
|
exit(true);
|
||||||
@ -3887,9 +3890,9 @@ begin
|
|||||||
Result:=IsCTExecutable(AFilename,ErrorMsg);
|
Result:=IsCTExecutable(AFilename,ErrorMsg);
|
||||||
if not Result then exit;
|
if not Result then exit;
|
||||||
|
|
||||||
// allow scripts like pas2js*
|
// allow scripts like *pas2js*
|
||||||
ShortFilename:=ExtractFileNameOnly(AFilename);
|
ShortFilename:=LowerCase(ExtractFileNameOnly(AFilename));
|
||||||
if CompareText(LeftStr(ShortFilename,6),'pas2js')=0 then
|
if Pos('pas2js',ShortFilename)>0 then
|
||||||
exit(true);
|
exit(true);
|
||||||
|
|
||||||
ErrorMsg:='pas2js executable should start with pas2js';
|
ErrorMsg:='pas2js executable should start with pas2js';
|
||||||
@ -9537,10 +9540,21 @@ end;
|
|||||||
|
|
||||||
function TCompilerDefinesCache.GetFPCVersion(const CompilerFilename, TargetOS,
|
function TCompilerDefinesCache.GetFPCVersion(const CompilerFilename, TargetOS,
|
||||||
TargetCPU: string; UseCompiledVersionAsDefault: boolean): string;
|
TargetCPU: string; UseCompiledVersionAsDefault: boolean): string;
|
||||||
|
var
|
||||||
|
Kind: TPascalCompiler;
|
||||||
|
begin
|
||||||
|
Result:=GetPCVersion(CompilerFilename,TargetOS,TargetCPU,UseCompiledVersionAsDefault,Kind);
|
||||||
|
if Kind=pcFPC then ;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TCompilerDefinesCache.GetPCVersion(const CompilerFilename, TargetOS,
|
||||||
|
TargetCPU: string; UseCompiledVersionAsDefault: boolean; out
|
||||||
|
Kind: TPascalCompiler): string;
|
||||||
var
|
var
|
||||||
CfgCache: TPCTargetConfigCache;
|
CfgCache: TPCTargetConfigCache;
|
||||||
ErrorMsg: string;
|
ErrorMsg: string;
|
||||||
begin
|
begin
|
||||||
|
Kind:=pcFPC;
|
||||||
if UseCompiledVersionAsDefault then
|
if UseCompiledVersionAsDefault then
|
||||||
Result:={$I %FPCVersion%}
|
Result:={$I %FPCVersion%}
|
||||||
else
|
else
|
||||||
@ -9551,6 +9565,7 @@ begin
|
|||||||
if CfgCache.NeedsUpdate
|
if CfgCache.NeedsUpdate
|
||||||
and not CfgCache.Update(TestFilename,ExtraOptions) then
|
and not CfgCache.Update(TestFilename,ExtraOptions) then
|
||||||
exit;
|
exit;
|
||||||
|
Kind:=CfgCache.Kind;
|
||||||
if CfgCache.FullVersion='' then exit;
|
if CfgCache.FullVersion='' then exit;
|
||||||
Result:=CfgCache.FullVersion;
|
Result:=CfgCache.FullVersion;
|
||||||
end;
|
end;
|
||||||
|
@ -647,8 +647,8 @@ begin
|
|||||||
begin
|
begin
|
||||||
Opts:=FBuildTarget.CompilerOptions;
|
Opts:=FBuildTarget.CompilerOptions;
|
||||||
//debugln(['TBuildManager.GetCompilerFilename FBuildTarget=',DbgSName(FBuildTarget),' Path=',Opts.CompilerPath,' Build=',[crCompile,crBuild]*Opts.CompileReasons<>[],' Parsing=',Opts.ParsedOpts.Values[pcosCompilerPath].Parsing]);
|
//debugln(['TBuildManager.GetCompilerFilename FBuildTarget=',DbgSName(FBuildTarget),' Path=',Opts.CompilerPath,' Build=',[crCompile,crBuild]*Opts.CompileReasons<>[],' Parsing=',Opts.ParsedOpts.Values[pcosCompilerPath].Parsing]);
|
||||||
if ([crCompile,crBuild]*Opts.CompileReasons<>[])
|
// Note: even if Opts.CompileReasons are disabled, the project compiler path is used by codetools
|
||||||
and (Opts.CompilerPath<>'')
|
if (Opts.CompilerPath<>'')
|
||||||
and (not Opts.ParsedOpts.Values[pcosCompilerPath].Parsing) then
|
and (not Opts.ParsedOpts.Values[pcosCompilerPath].Parsing) then
|
||||||
begin
|
begin
|
||||||
Result:=Opts.CompilerPath;
|
Result:=Opts.CompilerPath;
|
||||||
@ -888,7 +888,7 @@ begin
|
|||||||
debugln(['TBuildManager.RescanCompilerDefines GetParsedFPCSourceDirectory needs FPCVer...']);
|
debugln(['TBuildManager.RescanCompilerDefines GetParsedFPCSourceDirectory needs FPCVer...']);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
CompilerFilename:=GetCompilerFilename;
|
CompilerFilename:=GetCompilerFilename;
|
||||||
IsCompilerExecutable(CompilerFilename,CompilerErrorMsg,CompilerKind,true);
|
IsCompilerExecutable(CompilerFilename,CompilerErrorMsg,CompilerKind,{$IFDEF VerboseFPCSrcScan}true{$ELSE}false{$ENDIF});
|
||||||
FPCSrcDir:=EnvironmentOptions.GetParsedFPCSourceDirectory; // needs FPCVer macro
|
FPCSrcDir:=EnvironmentOptions.GetParsedFPCSourceDirectory; // needs FPCVer macro
|
||||||
FPCOptions:=GetFPCFrontEndOptions;
|
FPCOptions:=GetFPCFrontEndOptions;
|
||||||
|
|
||||||
@ -908,16 +908,20 @@ begin
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
// first check the default targetos, targetcpu of the default compiler
|
// first check the default targetos, targetcpu of the default compiler
|
||||||
if FileExistsCached(EnvironmentOptions.GetParsedCompilerFilename) then
|
DefCompilerFilename:=EnvironmentOptions.GetParsedCompilerFilename;
|
||||||
|
if FileExistsCached(DefCompilerFilename) then
|
||||||
begin
|
begin
|
||||||
{$IFDEF VerboseFPCSrcScan}
|
{$IFDEF VerboseFPCSrcScan}
|
||||||
debugln(['TBuildManager.RescanCompilerDefines reading default compiler settings']);
|
debugln(['TBuildManager.RescanCompilerDefines reading default compiler settings']);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
UnitSetCache:=CodeToolBoss.CompilerDefinesCache.FindUnitSet(
|
UnitSetCache:=CodeToolBoss.CompilerDefinesCache.FindUnitSet(
|
||||||
EnvironmentOptions.GetParsedCompilerFilename,'','','',FPCSrcDir,true);
|
DefCompilerFilename,'','','',FPCSrcDir,true);
|
||||||
UnitSetCache.GetConfigCache(true);
|
UnitSetCache.GetConfigCache(true);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
if CompilerFilename<>DefCompilerFilename then
|
||||||
|
IsCompilerExecutable(CompilerFilename,CompilerErrorMsg,CompilerKind,true);
|
||||||
|
|
||||||
// then check the project's compiler
|
// then check the project's compiler
|
||||||
if (CompilerErrorMsg<>'') then begin
|
if (CompilerErrorMsg<>'') then begin
|
||||||
Msg:='';
|
Msg:='';
|
||||||
@ -932,7 +936,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
DefCompilerFilename:=EnvironmentOptions.GetParsedCompilerFilename;
|
|
||||||
if not IsCompilerExecutable(DefCompilerFilename,DefCompilerErrorMsg,DefCompilerKind,true)
|
if not IsCompilerExecutable(DefCompilerFilename,DefCompilerErrorMsg,DefCompilerKind,true)
|
||||||
then begin
|
then begin
|
||||||
Msg+='Environment compiler: "'+DefCompilerFilename+'": '+DefCompilerErrorMsg+#13;
|
Msg+='Environment compiler: "'+DefCompilerFilename+'": '+DefCompilerErrorMsg+#13;
|
||||||
|
@ -2866,8 +2866,10 @@ begin
|
|||||||
Quiet:=ConsoleVerbosity<=-3; // lazbuild -q -q, lazarus -q -q -q
|
Quiet:=ConsoleVerbosity<=-3; // lazbuild -q -q, lazarus -q -q -q
|
||||||
|
|
||||||
CompilerFilename:=ParsedOpts.GetParsedValue(pcosCompilerPath);
|
CompilerFilename:=ParsedOpts.GetParsedValue(pcosCompilerPath);
|
||||||
if CompilerFilename<>'' then
|
if CompilerFilename<>'' then begin
|
||||||
RealCompilerFilename:=CompilerFilename
|
RealCompilerFilename:=CompilerFilename;
|
||||||
|
Kind:=CodeToolBoss.GetPascalCompilerForDirectory(BaseDirectory);
|
||||||
|
end
|
||||||
else begin
|
else begin
|
||||||
// use default compiler
|
// use default compiler
|
||||||
RealCompilerFilename:=EnvironmentOptions.GetParsedCompilerFilename;
|
RealCompilerFilename:=EnvironmentOptions.GetParsedCompilerFilename;
|
||||||
|
@ -35,8 +35,8 @@ uses
|
|||||||
// RTL
|
// RTL
|
||||||
Classes, SysUtils, strutils, math,
|
Classes, SysUtils, strutils, math,
|
||||||
// CodeTools
|
// CodeTools
|
||||||
KeywordFuncLists, CodeToolsFPCMsgs, CodeCache, FileProcs,
|
KeywordFuncLists, CodeToolsFPCMsgs, CodeCache, FileProcs, CodeToolManager,
|
||||||
CodeToolManager, DirectoryCacher, BasicCodeTools, DefineTemplates, SourceLog,
|
DirectoryCacher, BasicCodeTools, DefineTemplates, SourceLog, LinkScanner,
|
||||||
// LazUtils
|
// LazUtils
|
||||||
LConvEncoding, LazUTF8, FileUtil, LazFileUtils, LazFileCache, LazUtilities,
|
LConvEncoding, LazUTF8, FileUtil, LazFileUtils, LazFileCache, LazUtilities,
|
||||||
AvgLvlTree,
|
AvgLvlTree,
|
||||||
@ -1006,6 +1006,7 @@ var
|
|||||||
FPCVer: String;
|
FPCVer: String;
|
||||||
FPCSrcDir: String;
|
FPCSrcDir: String;
|
||||||
aFilename: String;
|
aFilename: String;
|
||||||
|
CompilerKind: TPascalCompiler;
|
||||||
begin
|
begin
|
||||||
if fMsgFileStamp<>CompilerParseStamp then begin
|
if fMsgFileStamp<>CompilerParseStamp then begin
|
||||||
fCurrentEnglishFile:=DefaultEnglishFile;
|
fCurrentEnglishFile:=DefaultEnglishFile;
|
||||||
@ -1013,7 +1014,10 @@ begin
|
|||||||
// English msg file
|
// English msg file
|
||||||
// => use fpcsrcdir/compiler/msg/errore.msg
|
// => use fpcsrcdir/compiler/msg/errore.msg
|
||||||
// the fpcsrcdir might depend on the FPC version
|
// the fpcsrcdir might depend on the FPC version
|
||||||
FPCVer:=CodeToolBoss.CompilerDefinesCache.GetFPCVersion(CompilerFilename,TargetOS,TargetCPU,false);
|
FPCVer:=CodeToolBoss.CompilerDefinesCache.GetPCVersion(
|
||||||
|
CompilerFilename,TargetOS,TargetCPU,false,CompilerKind);
|
||||||
|
if CompilerKind<>pcFPC then
|
||||||
|
;// ToDo
|
||||||
FPCSrcDir:=EnvironmentOptions.GetParsedFPCSourceDirectory(FPCVer);
|
FPCSrcDir:=EnvironmentOptions.GetParsedFPCSourceDirectory(FPCVer);
|
||||||
if FilenameIsAbsolute(FPCSrcDir) then begin
|
if FilenameIsAbsolute(FPCSrcDir) then begin
|
||||||
// FPCSrcDir exists => use the errore.msg
|
// FPCSrcDir exists => use the errore.msg
|
||||||
@ -3078,9 +3082,12 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TIDEFPCParser.GetDefaultPCFullVersion: LongWord;
|
function TIDEFPCParser.GetDefaultPCFullVersion: LongWord;
|
||||||
|
var
|
||||||
|
Kind: TPascalCompiler;
|
||||||
begin
|
begin
|
||||||
// get FPC version
|
// get compiler version
|
||||||
Result:=LongWord(CodeToolBoss.GetPCVersionForDirectory(Tool.WorkerDirectory));
|
Result:=LongWord(CodeToolBoss.GetPCVersionForDirectory(Tool.WorkerDirectory,Kind));
|
||||||
|
if Kind=pcFPC then ;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TIDEFPCParser.ToUTF8(const Line: string): string;
|
function TIDEFPCParser.ToUTF8(const Line: string): string;
|
||||||
|
33
ide/main.pp
33
ide/main.pp
@ -6644,11 +6644,12 @@ var
|
|||||||
UnitOutputDirectory: String;
|
UnitOutputDirectory: String;
|
||||||
TargetExeName: String;
|
TargetExeName: String;
|
||||||
TargetExeDirectory: String;
|
TargetExeDirectory: String;
|
||||||
FPCVersion, FPCRelease, FPCPatch: integer;
|
CompilerVersion: integer;
|
||||||
aCompileHint, ShortFilename: String;
|
aCompileHint, ShortFilename: String;
|
||||||
OldToolStatus: TIDEToolStatus;
|
OldToolStatus: TIDEToolStatus;
|
||||||
IsComplete: Boolean;
|
IsComplete: Boolean;
|
||||||
StartTime: TDateTime;
|
StartTime: TDateTime;
|
||||||
|
CompilerKind: TPascalCompiler;
|
||||||
begin
|
begin
|
||||||
if DoAbortBuild(true)<>mrOK then begin
|
if DoAbortBuild(true)<>mrOK then begin
|
||||||
debugln(['Error: (lazarus) [TMainIDE.DoBuildProject] DoAbortBuild failed']);
|
debugln(['Error: (lazarus) [TMainIDE.DoBuildProject] DoAbortBuild failed']);
|
||||||
@ -6692,9 +6693,14 @@ begin
|
|||||||
|
|
||||||
if (Project1.ProjResources.ResourceType=rtRes) then begin
|
if (Project1.ProjResources.ResourceType=rtRes) then begin
|
||||||
// FPC resources are only supported with FPC 2.4+
|
// FPC resources are only supported with FPC 2.4+
|
||||||
CodeToolBoss.GetFPCVersionForDirectory(
|
CompilerVersion:=CodeToolBoss.GetPCVersionForDirectory(
|
||||||
ExtractFilePath(Project1.MainFilename),FPCVersion,FPCRelease,FPCPatch);
|
ExtractFilePath(Project1.MainFilename),CompilerKind);
|
||||||
if (FPCVersion=2) and (FPCRelease<4) then begin
|
{debugln(['TMainIDE.DoBuildProject ',PascalCompilerNames[CompilerKind],' Version=',CompilerVersion]);
|
||||||
|
if CompilerVersion=0 then begin
|
||||||
|
CodeToolBoss.DefineTree.GetDefinesForDirectory(ExtractFilePath(Project1.MainFilename),true).WriteDebugReport;
|
||||||
|
end;}
|
||||||
|
if (CompilerKind=pcFPC) and (CompilerVersion>0) and (CompilerVersion<20400)
|
||||||
|
then begin
|
||||||
IDEMessageDialog(lisFPCTooOld,
|
IDEMessageDialog(lisFPCTooOld,
|
||||||
lisTheProjectUsesFPCResourcesWhichRequireAtLeast,
|
lisTheProjectUsesFPCResourcesWhichRequireAtLeast,
|
||||||
mtError,[mbCancel]);
|
mtError,[mbCancel]);
|
||||||
@ -7485,18 +7491,18 @@ end;
|
|||||||
function TMainIDE.DoSaveBuildIDEConfigs(Flags: TBuildLazarusFlags): TModalResult;
|
function TMainIDE.DoSaveBuildIDEConfigs(Flags: TBuildLazarusFlags): TModalResult;
|
||||||
var
|
var
|
||||||
InheritedOptionStrings: TInheritedCompOptsStrings;
|
InheritedOptionStrings: TInheritedCompOptsStrings;
|
||||||
FPCVersion, FPCRelease, FPCPatch: integer;
|
|
||||||
Builder: TLazarusBuilder;
|
Builder: TLazarusBuilder;
|
||||||
|
CompilerKind: TPascalCompiler;
|
||||||
begin
|
begin
|
||||||
// create uses section addition for lazarus.pp
|
// create uses section addition for lazarus.pp
|
||||||
Result:=PkgBoss.DoSaveAutoInstallConfig;
|
Result:=PkgBoss.DoSaveAutoInstallConfig;
|
||||||
if Result<>mrOk then exit;
|
if Result<>mrOk then exit;
|
||||||
|
|
||||||
// check ambiguous units
|
// check ambiguous units
|
||||||
CodeToolBoss.GetFPCVersionForDirectory(
|
CodeToolBoss.GetPCVersionForDirectory(
|
||||||
EnvironmentOptions.GetParsedLazarusDirectory,
|
EnvironmentOptions.GetParsedLazarusDirectory,
|
||||||
FPCVersion,FPCRelease,FPCPatch);
|
CompilerKind);
|
||||||
if (FPCVersion=0) or (FPCRelease=0) or (FPCPatch=0) then ;
|
if CompilerKind=pcFPC then ;
|
||||||
|
|
||||||
// save extra options
|
// save extra options
|
||||||
Builder:=TLazarusBuilder.Create;
|
Builder:=TLazarusBuilder.Create;
|
||||||
@ -7522,9 +7528,10 @@ var
|
|||||||
IDEBuildFlags: TBuildLazarusFlags;
|
IDEBuildFlags: TBuildLazarusFlags;
|
||||||
InheritedOptionStrings: TInheritedCompOptsStrings;
|
InheritedOptionStrings: TInheritedCompOptsStrings;
|
||||||
CompiledUnitExt: String;
|
CompiledUnitExt: String;
|
||||||
FPCVersion, FPCRelease, FPCPatch: integer;
|
CompilerVersion: integer;
|
||||||
PkgCompileFlags: TPkgCompileFlags;
|
PkgCompileFlags: TPkgCompileFlags;
|
||||||
OldToolStatus: TIDEToolStatus;
|
OldToolStatus: TIDEToolStatus;
|
||||||
|
CompilerKind: TPascalCompiler;
|
||||||
begin
|
begin
|
||||||
if ToolStatus<>itNone then begin
|
if ToolStatus<>itNone then begin
|
||||||
IDEMessageDialog(lisNotNow,lisYouCanNotBuildLazarusWhileDebuggingOrCompiling,
|
IDEMessageDialog(lisNotNow,lisYouCanNotBuildLazarusWhileDebuggingOrCompiling,
|
||||||
@ -7604,10 +7611,10 @@ begin
|
|||||||
fBuilder.PackageOptions:=PackageGraph.GetIDEInstallPackageOptions(InheritedOptionStrings{%H-});
|
fBuilder.PackageOptions:=PackageGraph.GetIDEInstallPackageOptions(InheritedOptionStrings{%H-});
|
||||||
|
|
||||||
// check ambiguous units
|
// check ambiguous units
|
||||||
CodeToolBoss.GetFPCVersionForDirectory(EnvironmentOptions.GetParsedLazarusDirectory,
|
CompilerVersion:=CodeToolBoss.GetPCVersionForDirectory(
|
||||||
FPCVersion,FPCRelease,FPCPatch);
|
EnvironmentOptions.GetParsedLazarusDirectory,CompilerKind);
|
||||||
if FPCPatch=0 then ;
|
if CompilerKind=pcFPC then ;
|
||||||
CompiledUnitExt:=GetDefaultCompiledUnitExt(FPCVersion,FPCRelease);
|
CompiledUnitExt:=GetDefaultCompiledUnitExt(CompilerVersion div 10000,CompilerVersion div 100);
|
||||||
Result:=MainBuildBoss.CheckUnitPathForAmbiguousPascalFiles(
|
Result:=MainBuildBoss.CheckUnitPathForAmbiguousPascalFiles(
|
||||||
EnvironmentOptions.GetParsedLazarusDirectory+PathDelim+'ide',
|
EnvironmentOptions.GetParsedLazarusDirectory+PathDelim+'ide',
|
||||||
InheritedOptionStrings[icoUnitPath],
|
InheritedOptionStrings[icoUnitPath],
|
||||||
|
@ -1053,7 +1053,7 @@ function TLazPackageGraph.GetPackageCompilerParams(APackage: TLazPackage
|
|||||||
begin
|
begin
|
||||||
Result:=APackage.CompilerOptions.MakeOptionsString(
|
Result:=APackage.CompilerOptions.MakeOptionsString(
|
||||||
APackage.CompilerOptions.DefaultMakeOptionsFlags+[ccloAbsolutePaths])
|
APackage.CompilerOptions.DefaultMakeOptionsFlags+[ccloAbsolutePaths])
|
||||||
+' '+CreateRelativePath(APackage.GetSrcFilename,APackage.Directory);
|
+' '+PrepareCmdLineOption(CreateRelativePath(APackage.GetSrcFilename,APackage.Directory));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
constructor TLazPackageGraph.Create;
|
constructor TLazPackageGraph.Create;
|
||||||
|
Loading…
Reference in New Issue
Block a user