mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-08 09:20:49 +02:00
project now notices, if compiler options changed
git-svn-id: trunk@3644 -
This commit is contained in:
parent
a24bd9505a
commit
61f6b4695c
@ -50,6 +50,8 @@ type
|
|||||||
|
|
||||||
TCompilerOptions = class(TObject)
|
TCompilerOptions = class(TObject)
|
||||||
private
|
private
|
||||||
|
FModified: boolean;
|
||||||
|
FOnModified: TNotifyEvent;
|
||||||
fOptionsString: String;
|
fOptionsString: String;
|
||||||
xmlconfig: TXMLConfig;
|
xmlconfig: TXMLConfig;
|
||||||
|
|
||||||
@ -134,6 +136,7 @@ type
|
|||||||
|
|
||||||
procedure LoadTheCompilerOptions;
|
procedure LoadTheCompilerOptions;
|
||||||
procedure SaveTheCompilerOptions;
|
procedure SaveTheCompilerOptions;
|
||||||
|
procedure SetModified(const AValue: boolean);
|
||||||
public
|
public
|
||||||
constructor Create;
|
constructor Create;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
@ -141,6 +144,8 @@ type
|
|||||||
procedure LoadCompilerOptions(UseExistingFile: Boolean);
|
procedure LoadCompilerOptions(UseExistingFile: Boolean);
|
||||||
procedure SaveCompilerOptions(UseExistingFile: Boolean);
|
procedure SaveCompilerOptions(UseExistingFile: Boolean);
|
||||||
procedure Assign(CompOpts: TCompilerOptions);
|
procedure Assign(CompOpts: TCompilerOptions);
|
||||||
|
function IsEqual(CompOpts: TCompilerOptions): boolean;
|
||||||
|
|
||||||
function MakeOptionsString: String;
|
function MakeOptionsString: String;
|
||||||
function MakeOptionsString(const MainSourceFileName: string): String;
|
function MakeOptionsString(const MainSourceFileName: string): String;
|
||||||
function ParseSearchPaths(const switch, paths: String): String;
|
function ParseSearchPaths(const switch, paths: String): String;
|
||||||
@ -149,6 +154,9 @@ type
|
|||||||
procedure Clear;
|
procedure Clear;
|
||||||
function CreateTargetFilename(const MainSourceFileName: string): string;
|
function CreateTargetFilename(const MainSourceFileName: string): string;
|
||||||
|
|
||||||
|
property Modified: boolean read FModified write SetModified;
|
||||||
|
property OnModified: TNotifyEvent read FOnModified write FOnModified;
|
||||||
|
|
||||||
property ProjectFile: String read fProjectFile write fProjectFile;
|
property ProjectFile: String read fProjectFile write fProjectFile;
|
||||||
property TargetFilename: String read fTargetFilename write fTargetFilename;
|
property TargetFilename: String read fTargetFilename write fTargetFilename;
|
||||||
property XMLConfigFile: TXMLConfig read xmlconfig write xmlconfig;
|
property XMLConfigFile: TXMLConfig read xmlconfig write xmlconfig;
|
||||||
@ -556,6 +564,7 @@ begin
|
|||||||
XMLConfigFile.Free;
|
XMLConfigFile.Free;
|
||||||
XMLConfigFile := nil;
|
XMLConfigFile := nil;
|
||||||
end;
|
end;
|
||||||
|
fModified:=false;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
@ -642,6 +651,14 @@ begin
|
|||||||
XMLConfigFile.Flush;
|
XMLConfigFile.Flush;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCompilerOptions.SetModified(const AValue: boolean);
|
||||||
|
begin
|
||||||
|
if FModified=AValue then exit;
|
||||||
|
FModified:=AValue;
|
||||||
|
if Assigned(OnModified) then
|
||||||
|
OnModified(Self);
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
{ TCompilerOptions CreateTargetFilename }
|
{ TCompilerOptions CreateTargetFilename }
|
||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
@ -1225,6 +1242,7 @@ procedure TCompilerOptions.Clear;
|
|||||||
begin
|
begin
|
||||||
fOptionsString := '';
|
fOptionsString := '';
|
||||||
fLoaded := false;
|
fLoaded := false;
|
||||||
|
FModified := false;
|
||||||
|
|
||||||
{ Set Defaults }
|
{ Set Defaults }
|
||||||
fStyle := 1;
|
fStyle := 1;
|
||||||
@ -1368,6 +1386,81 @@ begin
|
|||||||
fLCLWidgetType := CompOpts.fLCLWidgetType;
|
fLCLWidgetType := CompOpts.fLCLWidgetType;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCompilerOptions.IsEqual(CompOpts: TCompilerOptions): boolean;
|
||||||
|
begin
|
||||||
|
Result:=
|
||||||
|
(fOptionsString = CompOpts.fOptionsString)
|
||||||
|
and (fLoaded = CompOpts.fLoaded)
|
||||||
|
|
||||||
|
and (fStyle = CompOpts.fStyle)
|
||||||
|
and (fD2Ext = CompOpts.fD2Ext)
|
||||||
|
and (fCStyleOp = CompOpts.fCStyleOp)
|
||||||
|
and (fIncludeAssertionCode = CompOpts.fIncludeAssertionCode)
|
||||||
|
and (fAllowLabel = CompOpts.fAllowLabel)
|
||||||
|
and (fCPPInline = CompOpts.fCPPInline)
|
||||||
|
and (fCMacros = CompOpts.fCMacros)
|
||||||
|
and (fTPCompat = CompOpts.fTPCompat)
|
||||||
|
and (fInitConst = CompOpts.fInitConst)
|
||||||
|
and (fStaticKwd = CompOpts.fStaticKwd)
|
||||||
|
and (fDelphiCompat = CompOpts.fDelphiCompat)
|
||||||
|
and (fUseAnsiStr = CompOpts.fUseAnsiStr)
|
||||||
|
and (fGPCCompat = CompOpts.fGPCCompat)
|
||||||
|
|
||||||
|
and (fUnitStyle = CompOpts.fUnitStyle)
|
||||||
|
and (fIOChecks = CompOpts.fIOChecks)
|
||||||
|
and (fRangeChecks = CompOpts.fRangeChecks)
|
||||||
|
and (fOverflowChecks = CompOpts.fOverflowChecks)
|
||||||
|
and (fStackChecks = CompOpts.fStackChecks)
|
||||||
|
and (fHeapSize = CompOpts.fHeapSize)
|
||||||
|
and (fGenerate = CompOpts.fGenerate)
|
||||||
|
and (fTargetProc = CompOpts.fTargetProc)
|
||||||
|
and (fVarsInReg = CompOpts.fVarsInReg)
|
||||||
|
and (fUncertainOpt = CompOpts.fUncertainOpt)
|
||||||
|
and (fOptLevel = CompOpts.fOptLevel)
|
||||||
|
and (fTargetOS = CompOpts.fTargetOS)
|
||||||
|
|
||||||
|
and (fGenDebugInfo = CompOpts.fGenDebugInfo)
|
||||||
|
and (fGenDebugDBX = CompOpts.fGenDebugDBX)
|
||||||
|
and (fUseLineInfoUnit = CompOpts.fUseLineInfoUnit)
|
||||||
|
and (fUseHeaptrc = CompOpts.fUseHeaptrc)
|
||||||
|
and (fGenGProfCode = CompOpts.fGenGProfCode)
|
||||||
|
and (fStripSymbols = CompOpts.fStripSymbols)
|
||||||
|
and (fLinkStyle = CompOpts.fLinkStyle)
|
||||||
|
and (fPassLinkerOpt = CompOpts.fPassLinkerOpt)
|
||||||
|
and (fLinkerOptions = CompOpts.fLinkerOptions)
|
||||||
|
|
||||||
|
and (fShowErrors = CompOpts.fShowErrors)
|
||||||
|
and (fShowWarn = CompOpts.fShowWarn)
|
||||||
|
and (fShowNotes = CompOpts.fShowNotes)
|
||||||
|
and (fShowHints = CompOpts.fShowHints)
|
||||||
|
and (fShowGenInfo = CompOpts.fShowGenInfo)
|
||||||
|
and (fShowLineNum = CompOpts.fShowLineNum)
|
||||||
|
and (fShowAll = CompOpts.fShowAll)
|
||||||
|
and (fShowAllProcsOnError = CompOpts.fShowAllProcsOnError)
|
||||||
|
and (fShowDebugInfo = CompOpts.fShowDebugInfo)
|
||||||
|
and (fShowUsedFiles = CompOpts.fShowUsedFiles)
|
||||||
|
and (fShowTriedFiles = CompOpts.fShowTriedFiles)
|
||||||
|
and (fShowDefMacros = CompOpts.fShowDefMacros)
|
||||||
|
and (fShowCompProc = CompOpts.fShowCompProc)
|
||||||
|
and (fShowCond = CompOpts.fShowCond)
|
||||||
|
and (fShowNothing = CompOpts.fShowNothing)
|
||||||
|
and (fShowHintsForUnusedProjectUnits = CompOpts.fShowHintsForUnusedProjectUnits)
|
||||||
|
and (fWriteFPCLogo = CompOpts.fWriteFPCLogo)
|
||||||
|
and (fDontUseConfigFile = CompOpts.fDontUseConfigFile)
|
||||||
|
and (fAdditionalConfigFile = CompOpts.fAdditionalConfigFile)
|
||||||
|
and (fConfigFilePath = CompOpts.fConfigFilePath)
|
||||||
|
and (fStopAfterErrCount = CompOpts.fStopAfterErrCount)
|
||||||
|
|
||||||
|
and (fIncludeFiles = CompOpts.fIncludeFiles)
|
||||||
|
and (fLibraries = CompOpts.fLibraries)
|
||||||
|
and (fOtherUnitFiles = CompOpts.fOtherUnitFiles)
|
||||||
|
and (fCompilerPath = CompOpts.fCompilerPath)
|
||||||
|
and (fUnitOutputDir = CompOpts.fUnitOutputDir)
|
||||||
|
|
||||||
|
and (fLCLWidgetType = CompOpts.fLCLWidgetType)
|
||||||
|
;
|
||||||
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
{ TfrmCompilerOptions Constructor }
|
{ TfrmCompilerOptions Constructor }
|
||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
@ -1642,8 +1735,12 @@ var
|
|||||||
code: LongInt;
|
code: LongInt;
|
||||||
hs: LongInt;
|
hs: LongInt;
|
||||||
i: integer;
|
i: integer;
|
||||||
|
OldCompOpts: TCompilerOptions;
|
||||||
begin
|
begin
|
||||||
{ Put the compiler options into the TCompilerOptions class to be saved }
|
{ Put the compiler options into the TCompilerOptions class to be saved }
|
||||||
|
|
||||||
|
OldCompOpts:=TCompilerOptions.Create;
|
||||||
|
OldCompOpts.Assign(CompilerOpts);
|
||||||
|
|
||||||
if (radStyleIntel.Checked) then
|
if (radStyleIntel.Checked) then
|
||||||
CompilerOpts.Style := 1
|
CompilerOpts.Style := 1
|
||||||
@ -1766,6 +1863,10 @@ begin
|
|||||||
i:=TargetOSRadioGroup.Itemindex;
|
i:=TargetOSRadioGroup.Itemindex;
|
||||||
if i<0 then i:=0;
|
if i<0 then i:=0;
|
||||||
CompilerOpts.TargetOS:= TargetOSRadioGroup.Items[i];
|
CompilerOpts.TargetOS:= TargetOSRadioGroup.Items[i];
|
||||||
|
|
||||||
|
if not OldCompOpts.IsEqual(CompilerOpts) then
|
||||||
|
CompilerOpts.Modified:=true;
|
||||||
|
OldCompOpts.Free;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------}
|
{------------------------------------------------------------------------------}
|
||||||
|
@ -1906,6 +1906,7 @@ var i: integer;
|
|||||||
begin
|
begin
|
||||||
Result:=Modified;
|
Result:=Modified;
|
||||||
for i:=0 to UnitCount-1 do Result:=Result or Units[i].Modified;
|
for i:=0 to UnitCount-1 do Result:=Result or Units[i].Modified;
|
||||||
|
Result:=Result or CompilerOptions.Modified;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
Function TProject.UnitWithForm(AForm : TComponent) : TUnitInfo;
|
Function TProject.UnitWithForm(AForm : TComponent) : TUnitInfo;
|
||||||
@ -2100,6 +2101,9 @@ end.
|
|||||||
|
|
||||||
{
|
{
|
||||||
$Log$
|
$Log$
|
||||||
|
Revision 1.86 2002/11/16 13:56:20 mattias
|
||||||
|
project now notices, if compiler options changed
|
||||||
|
|
||||||
Revision 1.85 2002/10/30 22:28:49 lazarus
|
Revision 1.85 2002/10/30 22:28:49 lazarus
|
||||||
MG: fixed used virtual files and IsPartOfProject Bug
|
MG: fixed used virtual files and IsPartOfProject Bug
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user