mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-18 01:19:16 +02:00
IDE: added project option Write compiler config file
This commit is contained in:
parent
4179f1b4b1
commit
071135a4c9
@ -153,7 +153,6 @@ type
|
|||||||
private
|
private
|
||||||
FOnModified: TNotifyEvent;
|
FOnModified: TNotifyEvent;
|
||||||
fOwner: TObject;
|
fOwner: TObject;
|
||||||
FSubtarget: string;
|
|
||||||
SetEmulatedFloatOpcodes: boolean;
|
SetEmulatedFloatOpcodes: boolean;
|
||||||
function GetDebugInfoTypeStr: String;
|
function GetDebugInfoTypeStr: String;
|
||||||
procedure SetAllowLabel(const AValue: Boolean);
|
procedure SetAllowLabel(const AValue: Boolean);
|
||||||
@ -213,6 +212,7 @@ type
|
|||||||
procedure SetVarsInReg(const AValue: Boolean);
|
procedure SetVarsInReg(const AValue: Boolean);
|
||||||
procedure SetVerifyObjMethodCall(const AValue: boolean);
|
procedure SetVerifyObjMethodCall(const AValue: boolean);
|
||||||
procedure SetWin32GraphicApp(const AValue: boolean);
|
procedure SetWin32GraphicApp(const AValue: boolean);
|
||||||
|
procedure SetWriteConfigFile(AValue: Boolean);
|
||||||
procedure SetWriteFPCLogo(const AValue: Boolean);
|
procedure SetWriteFPCLogo(const AValue: Boolean);
|
||||||
protected
|
protected
|
||||||
FChangeStamp: int64;
|
FChangeStamp: int64;
|
||||||
@ -249,6 +249,7 @@ type
|
|||||||
fTargetOS: String;
|
fTargetOS: String;
|
||||||
fTargetCPU: string;
|
fTargetCPU: string;
|
||||||
fTargetProc: string;
|
fTargetProc: string;
|
||||||
|
FSubtarget: string;
|
||||||
fOptLevel: Integer;
|
fOptLevel: Integer;
|
||||||
fVarsInReg: Boolean;
|
fVarsInReg: Boolean;
|
||||||
fUncertainOpt: Boolean;
|
fUncertainOpt: Boolean;
|
||||||
@ -294,6 +295,8 @@ type
|
|||||||
fExecuteAfter: TLazCompilationToolOptions;
|
fExecuteAfter: TLazCompilationToolOptions;
|
||||||
// Other:
|
// Other:
|
||||||
fDontUseConfigFile: Boolean;
|
fDontUseConfigFile: Boolean;
|
||||||
|
FWriteConfigFile: Boolean;
|
||||||
|
FWriteConfigFilePath: String;
|
||||||
fCustomConfigFile: Boolean;
|
fCustomConfigFile: Boolean;
|
||||||
fConfigFilePath: String;
|
fConfigFilePath: String;
|
||||||
fUseCommentsInCustomOptions: Boolean;
|
fUseCommentsInCustomOptions: Boolean;
|
||||||
@ -310,6 +313,7 @@ type
|
|||||||
function GetSrcPath: string; virtual; abstract;
|
function GetSrcPath: string; virtual; abstract;
|
||||||
function GetUnitOutputDir: string; virtual; abstract;
|
function GetUnitOutputDir: string; virtual; abstract;
|
||||||
function GetUnitPaths: String; virtual; abstract;
|
function GetUnitPaths: String; virtual; abstract;
|
||||||
|
function GetWriteConfigFilePath: String; virtual; abstract;
|
||||||
procedure SetCompilerPath(const AValue: String); virtual; abstract;
|
procedure SetCompilerPath(const AValue: String); virtual; abstract;
|
||||||
procedure SetConditionals(AValue: string); virtual; abstract;
|
procedure SetConditionals(AValue: string); virtual; abstract;
|
||||||
procedure SetCustomOptions(const AValue: string); virtual; abstract;
|
procedure SetCustomOptions(const AValue: string); virtual; abstract;
|
||||||
@ -328,6 +332,7 @@ type
|
|||||||
procedure SetTargetProc(const AValue: string); virtual; abstract;
|
procedure SetTargetProc(const AValue: string); virtual; abstract;
|
||||||
procedure SetUnitOutputDir(const AValue: string); virtual; abstract;
|
procedure SetUnitOutputDir(const AValue: string); virtual; abstract;
|
||||||
procedure SetUnitPaths(const AValue: String); virtual; abstract;
|
procedure SetUnitPaths(const AValue: String); virtual; abstract;
|
||||||
|
procedure SetWriteConfigFilePath(AValue: String); virtual; abstract;
|
||||||
public
|
public
|
||||||
constructor Create(const TheOwner: TObject); virtual;
|
constructor Create(const TheOwner: TObject); virtual;
|
||||||
destructor Destroy; override;
|
destructor Destroy; override;
|
||||||
@ -467,6 +472,8 @@ type
|
|||||||
property ExecuteAfter: TLazCompilationToolOptions read fExecuteAfter;
|
property ExecuteAfter: TLazCompilationToolOptions read fExecuteAfter;
|
||||||
// other
|
// other
|
||||||
property DontUseConfigFile: Boolean read fDontUseConfigFile write SetDontUseConfigFile;
|
property DontUseConfigFile: Boolean read fDontUseConfigFile write SetDontUseConfigFile;
|
||||||
|
property WriteConfigFile: Boolean read FWriteConfigFile write SetWriteConfigFile;
|
||||||
|
property WriteConfigFilePath: String read GetWriteConfigFilePath write SetWriteConfigFilePath;
|
||||||
property CustomConfigFile: Boolean read fCustomConfigFile write SetCustomConfigFile;
|
property CustomConfigFile: Boolean read fCustomConfigFile write SetCustomConfigFile;
|
||||||
property ConfigFilePath: String read fConfigFilePath write SetConfigFilePath;
|
property ConfigFilePath: String read fConfigFilePath write SetConfigFilePath;
|
||||||
property CustomOptions: string read GetCustomOptions write SetCustomOptions;
|
property CustomOptions: string read GetCustomOptions write SetCustomOptions;
|
||||||
@ -968,6 +975,13 @@ begin
|
|||||||
IncreaseChangeStamp;
|
IncreaseChangeStamp;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TLazCompilerOptions.SetWriteConfigFile(AValue: Boolean);
|
||||||
|
begin
|
||||||
|
if FWriteConfigFile=AValue then Exit;
|
||||||
|
FWriteConfigFile:=AValue;
|
||||||
|
IncreaseChangeStamp;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TLazCompilerOptions.SetWriteFPCLogo(const AValue: Boolean);
|
procedure TLazCompilerOptions.SetWriteFPCLogo(const AValue: Boolean);
|
||||||
begin
|
begin
|
||||||
if fWriteFPCLogo=AValue then exit;
|
if fWriteFPCLogo=AValue then exit;
|
||||||
|
@ -1388,7 +1388,7 @@ begin
|
|||||||
//DebugLn([DbgCap,'CompilerFilename="',CompilerFilename,'" CompilerPath="',AProject.CompilerOptions.CompilerPath,'"']);
|
//DebugLn([DbgCap,'CompilerFilename="',CompilerFilename,'" CompilerPath="',AProject.CompilerOptions.CompilerPath,'"']);
|
||||||
// Note: use absolute paths, because some external tools resolve symlinked directories
|
// Note: use absolute paths, because some external tools resolve symlinked directories
|
||||||
CompilerParams :=
|
CompilerParams :=
|
||||||
AProject.CompilerOptions.MakeOptionsString([ccloAbsolutePaths]);
|
AProject.CompilerOptions.MakeCompilerParams([ccloAbsolutePaths]);
|
||||||
try
|
try
|
||||||
CompilerParams.Add(SrcFilename);
|
CompilerParams.Add(SrcFilename);
|
||||||
|
|
||||||
|
@ -332,7 +332,7 @@ begin
|
|||||||
CmdLineParams:=nil;
|
CmdLineParams:=nil;
|
||||||
try
|
try
|
||||||
// create compiler command line options
|
// create compiler command line options
|
||||||
CmdLineParams:=Options.MakeOptionsString(
|
CmdLineParams:=Options.MakeCompilerParams(
|
||||||
[ccloAddVerboseAll,ccloDoNotAppendOutFileOption,ccloAbsolutePaths]);
|
[ccloAddVerboseAll,ccloDoNotAppendOutFileOption,ccloAbsolutePaths]);
|
||||||
CmdLineParams.Add(BogusFilename);
|
CmdLineParams.Add(BogusFilename);
|
||||||
CompileTool:=ExternalToolList.Add(dlgCCOTestToolCompilingEmptyFile);
|
CompileTool:=ExternalToolList.Add(dlgCCOTestToolCompilingEmptyFile);
|
||||||
|
@ -275,7 +275,6 @@ function TCompiler.Compile(AProject: TProject; const WorkingDir,
|
|||||||
SkipAssembler, CurrentDirectoryIsTestDir: boolean; const aCompileHint: string
|
SkipAssembler, CurrentDirectoryIsTestDir: boolean; const aCompileHint: string
|
||||||
): TModalResult;
|
): TModalResult;
|
||||||
var
|
var
|
||||||
Abort : Boolean;
|
|
||||||
Tool: TAbstractExternalTool;
|
Tool: TAbstractExternalTool;
|
||||||
FPCParser: TFPCParser;
|
FPCParser: TFPCParser;
|
||||||
Title: String;
|
Title: String;
|
||||||
|
@ -190,7 +190,8 @@ type
|
|||||||
pcosOutputDir, // the output directory
|
pcosOutputDir, // the output directory
|
||||||
pcosCompilerPath, // the filename of the compiler
|
pcosCompilerPath, // the filename of the compiler
|
||||||
pcosDebugPath, // additional debug search path
|
pcosDebugPath, // additional debug search path
|
||||||
pcosMsgFile // fpc message file (errore.msg)
|
pcosMsgFile, // fpc message file (errore.msg)
|
||||||
|
pcosWriteConfigFilePath // auto generated cfg file
|
||||||
);
|
);
|
||||||
TParsedCompilerOptStrings = set of TParsedCompilerOptString;
|
TParsedCompilerOptStrings = set of TParsedCompilerOptString;
|
||||||
|
|
||||||
@ -198,15 +199,16 @@ type
|
|||||||
const
|
const
|
||||||
ParsedCompilerSearchPaths = [pcosUnitPath,pcosIncludePath,pcosObjectPath,
|
ParsedCompilerSearchPaths = [pcosUnitPath,pcosIncludePath,pcosObjectPath,
|
||||||
pcosLibraryPath,pcosSrcPath,pcosDebugPath];
|
pcosLibraryPath,pcosSrcPath,pcosDebugPath];
|
||||||
ParsedCompilerFilenames = [pcosCompilerPath,pcosMsgFile];
|
ParsedCompilerExecutables = [pcosCompilerPath];
|
||||||
|
ParsedCompilerFilenames = ParsedCompilerExecutables+[pcosMsgFile,pcosWriteConfigFilePath];
|
||||||
ParsedCompilerDirectories = [pcosOutputDir];
|
ParsedCompilerDirectories = [pcosOutputDir];
|
||||||
ParsedCompilerOutDirectories = [pcosOutputDir];
|
ParsedCompilerOutDirectories = [pcosOutputDir];
|
||||||
ParsedCompilerFiles =
|
ParsedCompilerFiles =
|
||||||
ParsedCompilerSearchPaths+ParsedCompilerFilenames+ParsedCompilerDirectories;
|
ParsedCompilerSearchPaths+ParsedCompilerFilenames+ParsedCompilerDirectories;
|
||||||
|
|
||||||
ParsedCompilerOptsVars: array[TParsedCompilerOptString] of string = (
|
ParsedCompilerOptsVars: array[TParsedCompilerOptString] of string = (
|
||||||
'',
|
'', // pcosNone
|
||||||
'',
|
'', // pcosBaseDir
|
||||||
'UnitPath',
|
'UnitPath',
|
||||||
'Namespaces',
|
'Namespaces',
|
||||||
'IncPath',
|
'IncPath',
|
||||||
@ -218,11 +220,12 @@ const
|
|||||||
'OutputDir',
|
'OutputDir',
|
||||||
'CompilerPath',
|
'CompilerPath',
|
||||||
'DebugPath',
|
'DebugPath',
|
||||||
'MsgFile'
|
'MsgFile',
|
||||||
|
'WriteCfgFile'
|
||||||
);
|
);
|
||||||
ParsedCompilerOptsUsageVars: array[TParsedCompilerOptString] of string = (
|
ParsedCompilerOptsUsageVars: array[TParsedCompilerOptString] of string = (
|
||||||
'',
|
'', // pcosNone
|
||||||
'',
|
'', // pcosBaseDir
|
||||||
'UsageUnitPath',
|
'UsageUnitPath',
|
||||||
'UsageNamespaces',
|
'UsageNamespaces',
|
||||||
'UsageIncPath',
|
'UsageIncPath',
|
||||||
@ -231,10 +234,11 @@ const
|
|||||||
'UsageSrcPath',
|
'UsageSrcPath',
|
||||||
'UsageLinkerOptions',
|
'UsageLinkerOptions',
|
||||||
'UsageCustomOptions',
|
'UsageCustomOptions',
|
||||||
'',
|
'', // pcosOutputDir
|
||||||
'',
|
'', // pcosCompilerPath
|
||||||
'UsageDebugPath',
|
'UsageDebugPath', // pcosDebugPath
|
||||||
''
|
'', // pcosMsgFile
|
||||||
|
'' // pcosWriteConfigFilePath
|
||||||
);
|
);
|
||||||
InheritedToParsedCompilerOption: array[TInheritedCompilerOption] of
|
InheritedToParsedCompilerOption: array[TInheritedCompilerOption] of
|
||||||
TParsedCompilerOptString = (
|
TParsedCompilerOptString = (
|
||||||
@ -432,6 +436,7 @@ type
|
|||||||
function GetSrcPath: string; override;
|
function GetSrcPath: string; override;
|
||||||
function GetUnitOutputDir: string; override;
|
function GetUnitOutputDir: string; override;
|
||||||
function GetUnitPaths: String; override;
|
function GetUnitPaths: String; override;
|
||||||
|
function GetWriteConfigFilePath: String; override;
|
||||||
procedure SetBaseDirectory(AValue: string);
|
procedure SetBaseDirectory(AValue: string);
|
||||||
procedure SetCompilerPath(const AValue: String); override;
|
procedure SetCompilerPath(const AValue: String); override;
|
||||||
procedure SetConditionals(AValue: string); override;
|
procedure SetConditionals(AValue: string); override;
|
||||||
@ -450,6 +455,7 @@ type
|
|||||||
procedure SetTargetOS(const AValue: string); override;
|
procedure SetTargetOS(const AValue: string); override;
|
||||||
procedure SetTargetFileExt(const AValue: String); override;
|
procedure SetTargetFileExt(const AValue: String); override;
|
||||||
procedure SetTargetFilename(const AValue: String); override;
|
procedure SetTargetFilename(const AValue: String); override;
|
||||||
|
procedure SetWriteConfigFilePath(AValue: String); override;
|
||||||
protected
|
protected
|
||||||
function GetModified: boolean; override;
|
function GetModified: boolean; override;
|
||||||
procedure SetModified(const AValue: boolean); override;
|
procedure SetModified(const AValue: boolean); override;
|
||||||
@ -476,7 +482,7 @@ type
|
|||||||
|
|
||||||
procedure SetAlternativeCompile(const Command: string; ScanFPCMsgs: boolean); override;
|
procedure SetAlternativeCompile(const Command: string; ScanFPCMsgs: boolean); override;
|
||||||
|
|
||||||
function MakeOptionsString(Flags: TCompilerCmdLineOptions): TStringListUTF8Fast;
|
function MakeCompilerParams(Flags: TCompilerCmdLineOptions): TStringListUTF8Fast;
|
||||||
procedure GetSyntaxOptions(Kind: TPascalCompiler; Params: TStrings); virtual;
|
procedure GetSyntaxOptions(Kind: TPascalCompiler; Params: TStrings); virtual;
|
||||||
function CreatePPUFilename(const SourceFileName: string): string; override;
|
function CreatePPUFilename(const SourceFileName: string): string; override;
|
||||||
function CreateTargetFilename: string; override;
|
function CreateTargetFilename: string; override;
|
||||||
@ -490,6 +496,7 @@ type
|
|||||||
Parsed: TCompilerOptionsParseType = coptParsed
|
Parsed: TCompilerOptionsParseType = coptParsed
|
||||||
): string; virtual;
|
): string; virtual;
|
||||||
function GetDefaultMainSourceFileName: string; virtual;
|
function GetDefaultMainSourceFileName: string; virtual;
|
||||||
|
function GetDefaultWriteConfigFilePath: string; virtual; abstract;
|
||||||
function CanBeDefaulForProject: boolean; virtual;
|
function CanBeDefaulForProject: boolean; virtual;
|
||||||
function NeedsLinkerOpts: boolean;
|
function NeedsLinkerOpts: boolean;
|
||||||
function HasCommands: boolean; // true if there is at least one commad to execute
|
function HasCommands: boolean; // true if there is at least one commad to execute
|
||||||
@ -1309,6 +1316,16 @@ begin
|
|||||||
IncreaseChangeStamp;
|
IncreaseChangeStamp;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TBaseCompilerOptions.SetWriteConfigFilePath(AValue: String);
|
||||||
|
begin
|
||||||
|
if WriteConfigFilePath=AValue then exit;
|
||||||
|
ParsedOpts.SetUnparsedValue(pcosWriteConfigFilePath,AValue);
|
||||||
|
{$IFDEF VerboseIDEModified}
|
||||||
|
debugln(['TBaseCompilerOptions.SetWriteConfigFilePath ',AValue]);
|
||||||
|
{$ENDIF}
|
||||||
|
IncreaseChangeStamp;
|
||||||
|
end;
|
||||||
|
|
||||||
function TBaseCompilerOptions.GetModified: boolean;
|
function TBaseCompilerOptions.GetModified: boolean;
|
||||||
begin
|
begin
|
||||||
Result:=(inherited GetModified) or MessageFlags.Modified;
|
Result:=(inherited GetModified) or MessageFlags.Modified;
|
||||||
@ -1379,6 +1396,11 @@ begin
|
|||||||
Result:=ParsedOpts.Values[pcosUnitPath].UnparsedValue;
|
Result:=ParsedOpts.Values[pcosUnitPath].UnparsedValue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TBaseCompilerOptions.GetWriteConfigFilePath: String;
|
||||||
|
begin
|
||||||
|
Result:=ParsedOpts.Values[pcosWriteConfigFilePath].UnparsedValue;
|
||||||
|
end;
|
||||||
|
|
||||||
function TBaseCompilerOptions.GetExecuteAfter: TCompilationToolOptions;
|
function TBaseCompilerOptions.GetExecuteAfter: TCompilationToolOptions;
|
||||||
begin
|
begin
|
||||||
Result:=TCompilationToolOptions(fExecuteAfter);
|
Result:=TCompilationToolOptions(fExecuteAfter);
|
||||||
@ -1716,6 +1738,8 @@ begin
|
|||||||
{ Other }
|
{ Other }
|
||||||
p:=Path+'Other/';
|
p:=Path+'Other/';
|
||||||
DontUseConfigFile := aXMLConfig.GetValue(p+'ConfigFile/DontUseConfigFile/Value', false);
|
DontUseConfigFile := aXMLConfig.GetValue(p+'ConfigFile/DontUseConfigFile/Value', false);
|
||||||
|
WriteConfigFile := aXMLConfig.GetValue(p+'ConfigFile/WriteConfigFile/Value', false);
|
||||||
|
WriteConfigFilePath := f(aXMLConfig.GetValue(p+'ConfigFile/WriteConfigFilePath/Value', GetDefaultWriteConfigFilePath));
|
||||||
if FileVersion<=3 then
|
if FileVersion<=3 then
|
||||||
CustomConfigFile := aXMLConfig.GetValue(p+'ConfigFile/AdditionalConfigFile/Value', false)
|
CustomConfigFile := aXMLConfig.GetValue(p+'ConfigFile/AdditionalConfigFile/Value', false)
|
||||||
else
|
else
|
||||||
@ -1909,6 +1933,8 @@ begin
|
|||||||
{ Other }
|
{ Other }
|
||||||
p:=Path+'Other/';
|
p:=Path+'Other/';
|
||||||
aXMLConfig.SetDeleteValue(p+'ConfigFile/DontUseConfigFile/Value', DontUseConfigFile,false);
|
aXMLConfig.SetDeleteValue(p+'ConfigFile/DontUseConfigFile/Value', DontUseConfigFile,false);
|
||||||
|
aXMLConfig.SetDeleteValue(p+'ConfigFile/WriteConfigFile/Value', WriteConfigFile,false);
|
||||||
|
aXMLConfig.SetDeleteValue(p+'ConfigFile/WriteConfigFilePath/Value', f(WriteConfigFilePath),GetDefaultWriteConfigFilePath);
|
||||||
aXMLConfig.SetDeleteValue(p+'ConfigFile/CustomConfigFile/Value', CustomConfigFile,false);
|
aXMLConfig.SetDeleteValue(p+'ConfigFile/CustomConfigFile/Value', CustomConfigFile,false);
|
||||||
aXMLConfig.SetDeleteValue(p+'ConfigFile/ConfigFilePath/Value', f(ConfigFilePath),'extrafpc.cfg');
|
aXMLConfig.SetDeleteValue(p+'ConfigFile/ConfigFilePath/Value', f(ConfigFilePath),'extrafpc.cfg');
|
||||||
aXMLConfig.SetDeleteValue(p+'CustomOptions/Value',
|
aXMLConfig.SetDeleteValue(p+'CustomOptions/Value',
|
||||||
@ -2480,7 +2506,7 @@ var
|
|||||||
Params: TStringListUTF8Fast;
|
Params: TStringListUTF8Fast;
|
||||||
h: String;
|
h: String;
|
||||||
begin
|
begin
|
||||||
Params:=MakeOptionsString([ccloNoMacroParams]);
|
Params:=MakeCompilerParams([ccloNoMacroParams]);
|
||||||
try
|
try
|
||||||
Result:=MergeCmdLineParams(Params);
|
Result:=MergeCmdLineParams(Params);
|
||||||
h:=GetCustomOptions(coptParsed);
|
h:=GetCustomOptions(coptParsed);
|
||||||
@ -2560,13 +2586,13 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
function TBaseCompilerOptions.MakeOptionsString(
|
function TBaseCompilerOptions.MakeCompilerParams(
|
||||||
const MainSourceFilename: string;
|
const MainSourceFilename: string;
|
||||||
Flags: TCompilerCmdLineOptions): String;
|
Flags: TCompilerCmdLineOptions): String;
|
||||||
|
|
||||||
Get all the options and create a string that can be passed to the compiler
|
Get all the options and create a string that can be passed to the compiler
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function TBaseCompilerOptions.MakeOptionsString(Flags: TCompilerCmdLineOptions
|
function TBaseCompilerOptions.MakeCompilerParams(Flags: TCompilerCmdLineOptions
|
||||||
): TStringListUTF8Fast;
|
): TStringListUTF8Fast;
|
||||||
var
|
var
|
||||||
tempsw, quietsw, t: String;
|
tempsw, quietsw, t: String;
|
||||||
@ -3363,6 +3389,7 @@ begin
|
|||||||
if Done(Tool.AddDiff('TargetOS',fTargetOS,CompOpts.fTargetOS)) then exit;
|
if Done(Tool.AddDiff('TargetOS',fTargetOS,CompOpts.fTargetOS)) then exit;
|
||||||
if Done(Tool.AddDiff('TargetCPU',fTargetCPU,CompOpts.fTargetCPU)) then exit;
|
if Done(Tool.AddDiff('TargetCPU',fTargetCPU,CompOpts.fTargetCPU)) then exit;
|
||||||
if Done(Tool.AddDiff('TargetProc',fTargetProc,CompOpts.fTargetProc)) then exit;
|
if Done(Tool.AddDiff('TargetProc',fTargetProc,CompOpts.fTargetProc)) then exit;
|
||||||
|
if Done(Tool.AddDiff('Subtarget',FSubtarget,CompOpts.FSubtarget)) then exit;
|
||||||
if Done(Tool.AddDiff('OptLevel',fOptLevel,CompOpts.fOptLevel)) then exit;
|
if Done(Tool.AddDiff('OptLevel',fOptLevel,CompOpts.fOptLevel)) then exit;
|
||||||
if Done(Tool.AddDiff('VarsInReg',fVarsInReg,CompOpts.fVarsInReg)) then exit;
|
if Done(Tool.AddDiff('VarsInReg',fVarsInReg,CompOpts.fVarsInReg)) then exit;
|
||||||
if Done(Tool.AddDiff('UncertainOpt',fUncertainOpt,CompOpts.fUncertainOpt)) then exit;
|
if Done(Tool.AddDiff('UncertainOpt',fUncertainOpt,CompOpts.fUncertainOpt)) then exit;
|
||||||
@ -3408,6 +3435,8 @@ begin
|
|||||||
// other
|
// other
|
||||||
if Tool<>nil then Tool.Path:='Other';
|
if Tool<>nil then Tool.Path:='Other';
|
||||||
if Done(Tool.AddDiff('DontUseConfigFile',fDontUseConfigFile,CompOpts.fDontUseConfigFile)) then exit;
|
if Done(Tool.AddDiff('DontUseConfigFile',fDontUseConfigFile,CompOpts.fDontUseConfigFile)) then exit;
|
||||||
|
if Done(Tool.AddDiff('WriteConfigFile',FWriteConfigFile,CompOpts.FWriteConfigFile)) then exit;
|
||||||
|
if Done(Tool.AddDiff('WriteConfigFilePath',FWriteConfigFilePath,CompOpts.FWriteConfigFilePath)) then exit;
|
||||||
if Done(Tool.AddDiff('CustomConfigFile',fCustomConfigFile,CompOpts.fCustomConfigFile)) then exit;
|
if Done(Tool.AddDiff('CustomConfigFile',fCustomConfigFile,CompOpts.fCustomConfigFile)) then exit;
|
||||||
if Done(Tool.AddDiff('ConfigFilePath',fConfigFilePath,CompOpts.fConfigFilePath)) then exit;
|
if Done(Tool.AddDiff('ConfigFilePath',fConfigFilePath,CompOpts.fConfigFilePath)) then exit;
|
||||||
if Done(Tool.AddDiff('StopAfterErrCount',fStopAfterErrCount,CompOpts.fStopAfterErrCount)) then exit;
|
if Done(Tool.AddDiff('StopAfterErrCount',fStopAfterErrCount,CompOpts.fStopAfterErrCount)) then exit;
|
||||||
@ -3731,7 +3760,7 @@ begin
|
|||||||
Result:=MergeCustomOptions(Result,MoreOptions);
|
Result:=MergeCustomOptions(Result,MoreOptions);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
pcosOutputDir,pcosCompilerPath:
|
pcosOutputDir,pcosCompilerPath,pcosWriteConfigFilePath:
|
||||||
if Vars.IsDefined(PChar(VarName)) then
|
if Vars.IsDefined(PChar(VarName)) then
|
||||||
Result:=GetForcedPathDelims(Vars[VarName]);
|
Result:=GetForcedPathDelims(Vars[VarName]);
|
||||||
end
|
end
|
||||||
@ -3862,7 +3891,8 @@ begin
|
|||||||
begin
|
begin
|
||||||
// make filename absolute
|
// make filename absolute
|
||||||
//debugln(['TParsedCompilerOptions.DoParseOption ',ParsedCompilerOptsVars[Option],' s="',s,'"']);
|
//debugln(['TParsedCompilerOptions.DoParseOption ',ParsedCompilerOptsVars[Option],' s="',s,'"']);
|
||||||
if ExtractFilePath(s)='' then begin
|
if (Option in ParsedCompilerExecutables) and (ExtractFilePath(s)='') then
|
||||||
|
begin
|
||||||
h:=FileUtil.FindDefaultExecutablePath(s,GetBaseDir);
|
h:=FileUtil.FindDefaultExecutablePath(s,GetBaseDir);
|
||||||
if h<>'' then s:=h;
|
if h<>'' then s:=h;
|
||||||
end;
|
end;
|
||||||
|
@ -6,67 +6,100 @@ object CompilerConfigTargetFrame: TCompilerConfigTargetFrame
|
|||||||
ClientHeight = 446
|
ClientHeight = 446
|
||||||
ClientWidth = 594
|
ClientWidth = 594
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
DesignLeft = 338
|
DesignLeft = 436
|
||||||
DesignTop = 284
|
DesignTop = 273
|
||||||
object grbConfigFile: TGroupBox
|
object grbConfigFile: TGroupBox
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 101
|
Height = 139
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 594
|
Width = 594
|
||||||
Align = alTop
|
Align = alTop
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
Caption = 'grbConfigFile'
|
Caption = 'grbConfigFile'
|
||||||
ClientHeight = 74
|
ClientHeight = 112
|
||||||
ClientWidth = 584
|
ClientWidth = 584
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
object chkConfigFile: TCheckBox
|
object chkConfigFile: TCheckBox
|
||||||
|
AnchorSideLeft.Control = grbConfigFile
|
||||||
|
AnchorSideTop.Control = grbConfigFile
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 18
|
Height = 18
|
||||||
Top = 6
|
Top = 3
|
||||||
Width = 572
|
Width = 104
|
||||||
Align = alTop
|
|
||||||
BorderSpacing.Left = 6
|
BorderSpacing.Left = 6
|
||||||
BorderSpacing.Top = 6
|
BorderSpacing.Top = 3
|
||||||
BorderSpacing.Right = 6
|
|
||||||
Caption = 'chkConfigFile'
|
Caption = 'chkConfigFile'
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
end
|
end
|
||||||
object chkCustomConfigFile: TCheckBox
|
object chkWriteConfigFile: TCheckBox
|
||||||
|
AnchorSideLeft.Control = chkConfigFile
|
||||||
|
AnchorSideTop.Control = chkConfigFile
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 6
|
Left = 6
|
||||||
Height = 18
|
Height = 18
|
||||||
Top = 27
|
Top = 24
|
||||||
Width = 572
|
Width = 134
|
||||||
Align = alTop
|
|
||||||
BorderSpacing.Left = 6
|
|
||||||
BorderSpacing.Top = 3
|
BorderSpacing.Top = 3
|
||||||
BorderSpacing.Right = 6
|
Caption = 'chkWriteConfigFile'
|
||||||
Caption = 'chkCustomConfigFile'
|
OnClick = chkWriteConfigFileClick
|
||||||
OnClick = chkCustomConfigFileClick
|
TabOrder = 3
|
||||||
TabOrder = 1
|
|
||||||
end
|
end
|
||||||
object edtConfigPath: TEdit
|
object edtWriteConfigFilePath: TEdit
|
||||||
AnchorSideLeft.Control = chkCustomConfigFile
|
AnchorSideLeft.Control = chkWriteConfigFile
|
||||||
AnchorSideTop.Control = chkCustomConfigFile
|
AnchorSideTop.Control = chkWriteConfigFile
|
||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
AnchorSideRight.Control = chkCustomConfigFile
|
AnchorSideRight.Control = grbConfigFile
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 25
|
Left = 25
|
||||||
Height = 22
|
Height = 22
|
||||||
Top = 46
|
Top = 43
|
||||||
Width = 553
|
Width = 553
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
BorderSpacing.Left = 19
|
BorderSpacing.Left = 19
|
||||||
BorderSpacing.Top = 1
|
BorderSpacing.Top = 1
|
||||||
BorderSpacing.Bottom = 6
|
BorderSpacing.Right = 6
|
||||||
|
BorderSpacing.Bottom = 3
|
||||||
|
TabOrder = 4
|
||||||
|
Text = 'edtWriteConfigFilePath'
|
||||||
|
end
|
||||||
|
object chkCustomConfigFile: TCheckBox
|
||||||
|
AnchorSideLeft.Control = chkConfigFile
|
||||||
|
AnchorSideTop.Control = edtWriteConfigFilePath
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
Left = 6
|
||||||
|
Height = 18
|
||||||
|
Top = 68
|
||||||
|
Width = 147
|
||||||
|
BorderSpacing.Top = 3
|
||||||
|
Caption = 'chkCustomConfigFile'
|
||||||
|
OnClick = chkCustomConfigFileClick
|
||||||
|
TabOrder = 1
|
||||||
|
end
|
||||||
|
object edtCustomConfigPath: TEdit
|
||||||
|
AnchorSideLeft.Control = chkCustomConfigFile
|
||||||
|
AnchorSideTop.Control = chkCustomConfigFile
|
||||||
|
AnchorSideTop.Side = asrBottom
|
||||||
|
AnchorSideRight.Control = grbConfigFile
|
||||||
|
AnchorSideRight.Side = asrBottom
|
||||||
|
Left = 25
|
||||||
|
Height = 22
|
||||||
|
Top = 87
|
||||||
|
Width = 553
|
||||||
|
Anchors = [akTop, akLeft, akRight]
|
||||||
|
BorderSpacing.Left = 19
|
||||||
|
BorderSpacing.Top = 1
|
||||||
|
BorderSpacing.Right = 6
|
||||||
|
BorderSpacing.Bottom = 3
|
||||||
TabOrder = 2
|
TabOrder = 2
|
||||||
Text = 'edtConfigPath'
|
Text = 'edtCustomConfigPath'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
object grbTargetPlatform: TGroupBox
|
object grbTargetPlatform: TGroupBox
|
||||||
AnchorSideBottom.Side = asrBottom
|
AnchorSideBottom.Side = asrBottom
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 125
|
Height = 125
|
||||||
Top = 109
|
Top = 147
|
||||||
Width = 594
|
Width = 594
|
||||||
Align = alTop
|
Align = alTop
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
@ -116,7 +149,7 @@ object CompilerConfigTargetFrame: TCompilerConfigTargetFrame
|
|||||||
Left = 6
|
Left = 6
|
||||||
Height = 16
|
Height = 16
|
||||||
Top = 74
|
Top = 74
|
||||||
Width = 75
|
Width = 74
|
||||||
Caption = 'lblSubtarget'
|
Caption = 'lblSubtarget'
|
||||||
ParentColor = False
|
ParentColor = False
|
||||||
end
|
end
|
||||||
@ -189,10 +222,10 @@ object CompilerConfigTargetFrame: TCompilerConfigTargetFrame
|
|||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
AnchorSideRight.Control = grbTargetPlatform
|
AnchorSideRight.Control = grbTargetPlatform
|
||||||
AnchorSideRight.Side = asrBottom
|
AnchorSideRight.Side = asrBottom
|
||||||
Left = 87
|
Left = 86
|
||||||
Height = 20
|
Height = 20
|
||||||
Top = 72
|
Top = 72
|
||||||
Width = 491
|
Width = 492
|
||||||
Anchors = [akTop, akLeft, akRight]
|
Anchors = [akTop, akLeft, akRight]
|
||||||
BorderSpacing.Left = 6
|
BorderSpacing.Left = 6
|
||||||
BorderSpacing.Top = 3
|
BorderSpacing.Top = 3
|
||||||
@ -206,7 +239,7 @@ object CompilerConfigTargetFrame: TCompilerConfigTargetFrame
|
|||||||
object grbTargetOptions: TGroupBox
|
object grbTargetOptions: TGroupBox
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 57
|
Height = 57
|
||||||
Top = 242
|
Top = 280
|
||||||
Width = 594
|
Width = 594
|
||||||
Align = alTop
|
Align = alTop
|
||||||
AutoSize = True
|
AutoSize = True
|
||||||
@ -231,7 +264,7 @@ object CompilerConfigTargetFrame: TCompilerConfigTargetFrame
|
|||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 16
|
Left = 16
|
||||||
Height = 16
|
Height = 16
|
||||||
Top = 327
|
Top = 365
|
||||||
Width = 128
|
Width = 128
|
||||||
BorderSpacing.Top = 3
|
BorderSpacing.Top = 3
|
||||||
Caption = 'LCLWidgetTypeLabel'
|
Caption = 'LCLWidgetTypeLabel'
|
||||||
@ -247,7 +280,7 @@ object CompilerConfigTargetFrame: TCompilerConfigTargetFrame
|
|||||||
AnchorSideTop.Side = asrBottom
|
AnchorSideTop.Side = asrBottom
|
||||||
Left = 3
|
Left = 3
|
||||||
Height = 16
|
Height = 16
|
||||||
Top = 308
|
Top = 346
|
||||||
Width = 151
|
Width = 151
|
||||||
BorderSpacing.Top = 9
|
BorderSpacing.Top = 9
|
||||||
Caption = 'CurrentWidgetTypeLabel'
|
Caption = 'CurrentWidgetTypeLabel'
|
||||||
|
@ -48,8 +48,10 @@ type
|
|||||||
TCompilerConfigTargetFrame = class(TAbstractIDEOptionsEditor)
|
TCompilerConfigTargetFrame = class(TAbstractIDEOptionsEditor)
|
||||||
chkConfigFile: TCheckBox;
|
chkConfigFile: TCheckBox;
|
||||||
chkCustomConfigFile: TCheckBox;
|
chkCustomConfigFile: TCheckBox;
|
||||||
|
chkWriteConfigFile: TCheckBox;
|
||||||
chkWin32GraphicApp: TCheckBox;
|
chkWin32GraphicApp: TCheckBox;
|
||||||
edtConfigPath: TEdit;
|
edtCustomConfigPath: TEdit;
|
||||||
|
edtWriteConfigFilePath: TEdit;
|
||||||
grbTargetOptions: TGroupBox;
|
grbTargetOptions: TGroupBox;
|
||||||
grbConfigFile: TGroupBox;
|
grbConfigFile: TGroupBox;
|
||||||
grbTargetPlatform: TGroupBox;
|
grbTargetPlatform: TGroupBox;
|
||||||
@ -64,6 +66,7 @@ type
|
|||||||
TargetProcComboBox: TComboBox;
|
TargetProcComboBox: TComboBox;
|
||||||
SubtargetComboBox: TComboBox;
|
SubtargetComboBox: TComboBox;
|
||||||
procedure chkCustomConfigFileClick(Sender: TObject);
|
procedure chkCustomConfigFileClick(Sender: TObject);
|
||||||
|
procedure chkWriteConfigFileClick(Sender: TObject);
|
||||||
procedure TargetOSComboBoxSelect(Sender: TObject);
|
procedure TargetOSComboBoxSelect(Sender: TObject);
|
||||||
procedure TargetCPUComboBoxSelect(Sender: TObject);
|
procedure TargetCPUComboBoxSelect(Sender: TObject);
|
||||||
procedure LCLWidgetTypeLabelClick(Sender: TObject);
|
procedure LCLWidgetTypeLabelClick(Sender: TObject);
|
||||||
@ -158,16 +161,14 @@ end;
|
|||||||
|
|
||||||
function TCompilerConfigTargetFrame.Check: Boolean;
|
function TCompilerConfigTargetFrame.Check: Boolean;
|
||||||
var
|
var
|
||||||
NewDontUseConfigFile: Boolean;
|
NewDontUseConfigFile, NewCustomConfigFile: Boolean;
|
||||||
NewCustomConfigFile: Boolean;
|
NewConfigFilePath, AdditionalConfig: String;
|
||||||
NewConfigFilePath: String;
|
|
||||||
AdditionalConfig: String;
|
|
||||||
begin
|
begin
|
||||||
//debugln(['TCompilerConfigTargetFrame.ReadSettings ',dbgs(Pointer(FCompOptions)),' ',FCompOptions=Project1.CompilerOptions]);
|
//debugln(['TCompilerConfigTargetFrame.ReadSettings ',dbgs(Pointer(FCompOptions)),' ',FCompOptions=Project1.CompilerOptions]);
|
||||||
|
|
||||||
NewDontUseConfigFile := not chkConfigFile.Checked;
|
NewDontUseConfigFile := not chkConfigFile.Checked;
|
||||||
NewCustomConfigFile := chkCustomConfigFile.Checked;
|
NewCustomConfigFile := chkCustomConfigFile.Checked;
|
||||||
NewConfigFilePath := edtConfigPath.Text;
|
NewConfigFilePath := edtCustomConfigPath.Text;
|
||||||
|
|
||||||
if ((NewDontUseConfigFile <> FCompOptions.DontUseConfigFile) or
|
if ((NewDontUseConfigFile <> FCompOptions.DontUseConfigFile) or
|
||||||
(NewCustomConfigFile <> FCompOptions.CustomConfigFile) or
|
(NewCustomConfigFile <> FCompOptions.CustomConfigFile) or
|
||||||
@ -176,9 +177,8 @@ begin
|
|||||||
begin
|
begin
|
||||||
// config file options changed
|
// config file options changed
|
||||||
// and both additional and standard config files are used
|
// and both additional and standard config files are used
|
||||||
AdditionalConfig := ExtractFilename(edtConfigPath.Text);
|
AdditionalConfig := ExtractFilename(edtCustomConfigPath.Text);
|
||||||
if (CompareFileNames(AdditionalConfig, 'fpc.cfg') = 0) or
|
if (CompareFileNames(AdditionalConfig, 'fpc.cfg') = 0) then
|
||||||
(CompareFileNames(AdditionalConfig, 'ppc386.cfg') = 0) then
|
|
||||||
begin
|
begin
|
||||||
if IDEMessageDialog(lisCOAmbiguousAdditionalCompilerConfigFile,
|
if IDEMessageDialog(lisCOAmbiguousAdditionalCompilerConfigFile,
|
||||||
Format(lisCOClickOKIfAreSureToDoThat,
|
Format(lisCOClickOKIfAreSureToDoThat,
|
||||||
@ -270,8 +270,10 @@ begin
|
|||||||
// Config
|
// Config
|
||||||
grbConfigFile.Caption := dlgConfigFiles;
|
grbConfigFile.Caption := dlgConfigFiles;
|
||||||
chkConfigFile.Caption := dlgUseFpcCfg + ' ('+lisIfNotChecked+' -n)';
|
chkConfigFile.Caption := dlgUseFpcCfg + ' ('+lisIfNotChecked+' -n)';
|
||||||
|
chkWriteConfigFile.Caption := lisWriteConfigInsteadOfCommandLineParameters+' (@)';
|
||||||
|
edtWriteConfigFilePath.Text := '';
|
||||||
chkCustomConfigFile.Caption := dlgUseCustomConfig + ' (@)';
|
chkCustomConfigFile.Caption := dlgUseCustomConfig + ' (@)';
|
||||||
edtConfigPath.Text := '';
|
edtCustomConfigPath.Text := '';
|
||||||
|
|
||||||
// Target platform
|
// Target platform
|
||||||
grbTargetPlatform.Caption := dlgTargetPlatform;
|
grbTargetPlatform.Caption := dlgTargetPlatform;
|
||||||
@ -329,9 +331,12 @@ begin
|
|||||||
with FCompOptions do
|
with FCompOptions do
|
||||||
begin
|
begin
|
||||||
chkConfigFile.Checked := not DontUseConfigFile;
|
chkConfigFile.Checked := not DontUseConfigFile;
|
||||||
|
chkWriteConfigFile.Checked := WriteConfigFile;
|
||||||
|
edtWriteConfigFilePath.Enabled:= WriteConfigFile;
|
||||||
|
edtWriteConfigFilePath.Text := WriteConfigFilePath;
|
||||||
chkCustomConfigFile.Checked := CustomConfigFile;
|
chkCustomConfigFile.Checked := CustomConfigFile;
|
||||||
edtConfigPath.Enabled := chkCustomConfigFile.Checked;
|
edtCustomConfigPath.Enabled := chkCustomConfigFile.Checked;
|
||||||
edtConfigPath.Text := ConfigFilePath;
|
edtCustomConfigPath.Text := ConfigFilePath;
|
||||||
if fIsPackage then begin
|
if fIsPackage then begin
|
||||||
grbTargetPlatform.Visible:=false;
|
grbTargetPlatform.Visible:=false;
|
||||||
TargetOSComboBox.ItemIndex := 0;
|
TargetOSComboBox.ItemIndex := 0;
|
||||||
@ -386,8 +391,10 @@ begin
|
|||||||
with CurOptions do
|
with CurOptions do
|
||||||
begin
|
begin
|
||||||
DontUseConfigFile := not chkConfigFile.Checked;
|
DontUseConfigFile := not chkConfigFile.Checked;
|
||||||
|
WriteConfigFile := chkWriteConfigFile.Checked;
|
||||||
|
WriteConfigFilePath := edtWriteConfigFilePath.Text;
|
||||||
CustomConfigFile := chkCustomConfigFile.Checked;
|
CustomConfigFile := chkCustomConfigFile.Checked;
|
||||||
ConfigFilePath := edtConfigPath.Text;
|
ConfigFilePath := edtCustomConfigPath.Text;
|
||||||
if not fIsPackage then
|
if not fIsPackage then
|
||||||
begin
|
begin
|
||||||
NewTargetOS := TargetOSComboBox.Text;
|
NewTargetOS := TargetOSComboBox.Text;
|
||||||
@ -407,7 +414,12 @@ end;
|
|||||||
|
|
||||||
procedure TCompilerConfigTargetFrame.chkCustomConfigFileClick(Sender: TObject);
|
procedure TCompilerConfigTargetFrame.chkCustomConfigFileClick(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
edtConfigPath.Enabled := chkCustomConfigFile.Checked;
|
edtCustomConfigPath.Enabled := chkCustomConfigFile.Checked;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCompilerConfigTargetFrame.chkWriteConfigFileClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
edtWriteConfigFilePath.Enabled := chkWriteConfigFile.Checked;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TCompilerConfigTargetFrame.TargetOSComboBoxSelect(Sender: TObject);
|
procedure TCompilerConfigTargetFrame.TargetOSComboBoxSelect(Sender: TObject);
|
||||||
|
@ -2425,6 +2425,8 @@ resourcestring
|
|||||||
dlgConfigFiles = 'Config files';
|
dlgConfigFiles = 'Config files';
|
||||||
dlgUseFpcCfg = 'Use standard compiler config file (fpc.cfg)';
|
dlgUseFpcCfg = 'Use standard compiler config file (fpc.cfg)';
|
||||||
lisIfNotChecked = 'If not checked:';
|
lisIfNotChecked = 'If not checked:';
|
||||||
|
lisWriteConfigInsteadOfCommandLineParameters = 'Write config instead of '
|
||||||
|
+'command line parameters';
|
||||||
dlgUseCustomConfig = 'Use additional compiler config file';
|
dlgUseCustomConfig = 'Use additional compiler config file';
|
||||||
lisAllOptions = 'All Options';
|
lisAllOptions = 'All Options';
|
||||||
lisFilterTheAvailableOptionsList = 'Filter the available options list';
|
lisFilterTheAvailableOptionsList = 'Filter the available options list';
|
||||||
|
@ -769,7 +769,7 @@ var
|
|||||||
CompilerFilename: String;
|
CompilerFilename: String;
|
||||||
WorkingDir: String;
|
WorkingDir: String;
|
||||||
SrcFilename: String;
|
SrcFilename: String;
|
||||||
CompilerParams: TStrings;
|
CompilerParams, CmdLineParams: TStrings;
|
||||||
ToolBefore: TProjectCompilationToolOptions;
|
ToolBefore: TProjectCompilationToolOptions;
|
||||||
ToolAfter: TProjectCompilationToolOptions;
|
ToolAfter: TProjectCompilationToolOptions;
|
||||||
UnitOutputDirectory: String;
|
UnitOutputDirectory: String;
|
||||||
@ -785,6 +785,8 @@ var
|
|||||||
CurResult: Boolean;
|
CurResult: Boolean;
|
||||||
|
|
||||||
function StartBuilding : boolean;
|
function StartBuilding : boolean;
|
||||||
|
var
|
||||||
|
CfgCode: TCodeBuffer;
|
||||||
begin
|
begin
|
||||||
Result := false;
|
Result := false;
|
||||||
|
|
||||||
@ -805,6 +807,7 @@ var
|
|||||||
MainBuildBoss.SetBuildTargetProject1(true,smsfsSkip);
|
MainBuildBoss.SetBuildTargetProject1(true,smsfsSkip);
|
||||||
|
|
||||||
CompilerParams:=nil;
|
CompilerParams:=nil;
|
||||||
|
CmdLineParams:=nil;
|
||||||
try
|
try
|
||||||
if not SkipDependencies then
|
if not SkipDependencies then
|
||||||
begin
|
begin
|
||||||
@ -883,16 +886,25 @@ var
|
|||||||
|
|
||||||
//DebugLn(['TLazBuildApplication.BuildProject CompilerFilename="',CompilerFilename,'" CompilerPath="',Project1.CompilerOptions.CompilerPath,'"']);
|
//DebugLn(['TLazBuildApplication.BuildProject CompilerFilename="',CompilerFilename,'" CompilerPath="',Project1.CompilerOptions.CompilerPath,'"']);
|
||||||
// CompileHint: use absolute paths, same as TBuildManager.DoCheckIfProjectNeedsCompilation
|
// CompileHint: use absolute paths, same as TBuildManager.DoCheckIfProjectNeedsCompilation
|
||||||
CompilerParams:=Project1.CompilerOptions.MakeOptionsString([ccloAbsolutePaths]);
|
CompilerParams:=Project1.CompilerOptions.MakeCompilerParams([ccloAbsolutePaths]);
|
||||||
CompilerParams.Add(SrcFilename);
|
CompilerParams.Add(SrcFilename);
|
||||||
|
|
||||||
if (CompReason in Project1.CompilerOptions.CompileReasons) then begin
|
if (CompReason in Project1.CompilerOptions.CompileReasons) then begin
|
||||||
// compile
|
// compile
|
||||||
|
|
||||||
|
if Project1.CompilerOptions.WriteConfigFile then
|
||||||
|
begin
|
||||||
|
CfgCode:=Project1.WriteCompilerCfgFile(Project1,CompilerParams,CmdLineParams);
|
||||||
|
if CfgCode=nil then
|
||||||
|
Error(ErrorBuildFailed,'unable to read "'+Project1.GetWriteConfigFilePath+'"');
|
||||||
|
if CfgCode.FileOnDiskNeedsUpdate and (not CfgCode.Save) then
|
||||||
|
Error(ErrorBuildFailed,'unable to write "'+Project1.GetWriteConfigFilePath+'"');
|
||||||
|
end;
|
||||||
|
|
||||||
// write state file to avoid building clean every time
|
// write state file to avoid building clean every time
|
||||||
if Project1.SaveStateFile(CompilerFilename,CompilerParams,false)<>mrOk then
|
if Project1.SaveStateFile(CompilerFilename,CompilerParams,false)<>mrOk then
|
||||||
Error(ErrorBuildFailed,'failed saving statefile of project '+AFilename);
|
Error(ErrorBuildFailed,'failed saving statefile of project '+AFilename);
|
||||||
if TheCompiler.Compile(Project1,WorkingDir,CompilerFilename,CompilerParams,
|
if TheCompiler.Compile(Project1,WorkingDir,CompilerFilename,CmdLineParams,
|
||||||
BuildAll or NeedBuildAllFlag,false,false,false,
|
BuildAll or NeedBuildAllFlag,false,false,false,
|
||||||
CompileHint)<>mrOk
|
CompileHint)<>mrOk
|
||||||
then
|
then
|
||||||
@ -914,6 +926,8 @@ var
|
|||||||
// no need to check for mrOk, we are exit if it wasn't
|
// no need to check for mrOk, we are exit if it wasn't
|
||||||
Result:=true;
|
Result:=true;
|
||||||
finally
|
finally
|
||||||
|
if CmdLineParams<>CompilerParams then
|
||||||
|
CmdLineParams.Free;
|
||||||
CompilerParams.Free;
|
CompilerParams.Free;
|
||||||
if not SkipDependencies then
|
if not SkipDependencies then
|
||||||
PackageGraph.EndUpdate;
|
PackageGraph.EndUpdate;
|
||||||
|
26
ide/main.pp
26
ide/main.pp
@ -6834,7 +6834,8 @@ var
|
|||||||
PkgFlags: TPkgCompileFlags;
|
PkgFlags: TPkgCompileFlags;
|
||||||
CompilerFilename: String;
|
CompilerFilename: String;
|
||||||
WorkingDir: String;
|
WorkingDir: String;
|
||||||
CompilerParams: TStringListUTF8Fast;
|
CompilerParams: TStrings;
|
||||||
|
CmdLineParams: TStrings;
|
||||||
NeedBuildAllFlag: Boolean;
|
NeedBuildAllFlag: Boolean;
|
||||||
NoBuildNeeded: Boolean;
|
NoBuildNeeded: Boolean;
|
||||||
UnitOutputDirectory: String;
|
UnitOutputDirectory: String;
|
||||||
@ -6846,6 +6847,7 @@ var
|
|||||||
IsComplete: Boolean;
|
IsComplete: Boolean;
|
||||||
StartTime: TDateTime;
|
StartTime: TDateTime;
|
||||||
CompilerKind: TPascalCompiler;
|
CompilerKind: TPascalCompiler;
|
||||||
|
CfgCode: TCodeBuffer;
|
||||||
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']);
|
||||||
@ -6881,6 +6883,7 @@ begin
|
|||||||
if Result<>mrOk then exit;
|
if Result<>mrOk then exit;
|
||||||
|
|
||||||
CompilerParams:=nil;
|
CompilerParams:=nil;
|
||||||
|
CmdLineParams:=nil;
|
||||||
try
|
try
|
||||||
Result:=DoSaveForBuild(AReason);
|
Result:=DoSaveForBuild(AReason);
|
||||||
if Result<>mrOk then begin
|
if Result<>mrOk then begin
|
||||||
@ -7098,9 +7101,22 @@ begin
|
|||||||
// compile
|
// compile
|
||||||
CompilerFilename:=Project1.GetCompilerFilename;
|
CompilerFilename:=Project1.GetCompilerFilename;
|
||||||
// Hint: use absolute paths, because some external tools resolve symlinked directories
|
// Hint: use absolute paths, because some external tools resolve symlinked directories
|
||||||
CompilerParams :=
|
CompilerParams := Project1.CompilerOptions.MakeCompilerParams([ccloAbsolutePaths]);
|
||||||
Project1.CompilerOptions.MakeOptionsString([ccloAbsolutePaths]);
|
|
||||||
CompilerParams.Add(SrcFilename);
|
CompilerParams.Add(SrcFilename);
|
||||||
|
CmdLineParams := CompilerParams;
|
||||||
|
|
||||||
|
if Project1.CompilerOptions.WriteConfigFile then
|
||||||
|
begin
|
||||||
|
CfgCode:=Project1.WriteCompilerCfgFile(Project1,CompilerParams,CmdLineParams);
|
||||||
|
if CfgCode=nil then begin
|
||||||
|
IDEMessageDialog(lisReadError,Format(lisUnableToReadFile2,
|
||||||
|
[Project1.GetWriteConfigFilePath]),mtError,[mbOk]);
|
||||||
|
exit(mrCancel);
|
||||||
|
end;
|
||||||
|
if CfgCode.FileOnDiskNeedsUpdate and (SaveCodeBuffer(CfgCode)<>mrOk) then
|
||||||
|
exit(mrCancel);
|
||||||
|
end;
|
||||||
|
|
||||||
// write state file, to avoid building clean every time
|
// write state file, to avoid building clean every time
|
||||||
Result:=Project1.SaveStateFile(CompilerFilename,
|
Result:=Project1.SaveStateFile(CompilerFilename,
|
||||||
CompilerParams,false);
|
CompilerParams,false);
|
||||||
@ -7113,7 +7129,7 @@ begin
|
|||||||
|
|
||||||
StartTime:=Now;
|
StartTime:=Now;
|
||||||
Result:=TheCompiler.Compile(Project1,
|
Result:=TheCompiler.Compile(Project1,
|
||||||
WorkingDir,CompilerFilename,CompilerParams,
|
WorkingDir,CompilerFilename,CmdLineParams,
|
||||||
(AReason = crBuild) or NeedBuildAllFlag,
|
(AReason = crBuild) or NeedBuildAllFlag,
|
||||||
pbfSkipLinking in Flags,
|
pbfSkipLinking in Flags,
|
||||||
pbfSkipAssembler in Flags,Project1.IsVirtual,
|
pbfSkipAssembler in Flags,Project1.IsVirtual,
|
||||||
@ -7171,6 +7187,8 @@ begin
|
|||||||
DoCallBuildingFinishedHandler(lihtProjectBuildingFinished, Self, Result=mrOk);
|
DoCallBuildingFinishedHandler(lihtProjectBuildingFinished, Self, Result=mrOk);
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
|
if CmdLineParams<>CompilerParams then
|
||||||
|
CmdLineParams.Free;
|
||||||
CompilerParams.Free;
|
CompilerParams.Free;
|
||||||
// check sources
|
// check sources
|
||||||
DoCheckFilesOnDisk;
|
DoCheckFilesOnDisk;
|
||||||
|
@ -553,6 +553,7 @@ type
|
|||||||
function CanBeDefaulForProject: boolean; override;
|
function CanBeDefaulForProject: boolean; override;
|
||||||
function GetOwnerName: string; override;
|
function GetOwnerName: string; override;
|
||||||
function GetDefaultMainSourceFileName: string; override;
|
function GetDefaultMainSourceFileName: string; override;
|
||||||
|
function GetDefaultWriteConfigFilePath: string; override;
|
||||||
procedure GetInheritedCompilerOptions(var OptionsList: TFPList); override;
|
procedure GetInheritedCompilerOptions(var OptionsList: TFPList); override;
|
||||||
procedure Assign(Source: TPersistent); override;
|
procedure Assign(Source: TPersistent); override;
|
||||||
function CreateDiff(CompOpts: TBaseCompilerOptions;
|
function CreateDiff(CompOpts: TBaseCompilerOptions;
|
||||||
@ -1068,6 +1069,7 @@ type
|
|||||||
function GetCompilerFilename: string;
|
function GetCompilerFilename: string;
|
||||||
function GetStateFilename: string;
|
function GetStateFilename: string;
|
||||||
function GetCompileSourceFilename: string;
|
function GetCompileSourceFilename: string;
|
||||||
|
function GetWriteConfigFilePath: string;
|
||||||
procedure AutoAddOutputDirToIncPath;
|
procedure AutoAddOutputDirToIncPath;
|
||||||
function ExtendUnitSearchPath(NewUnitPaths: string): boolean;
|
function ExtendUnitSearchPath(NewUnitPaths: string): boolean;
|
||||||
function ExtendIncSearchPath(NewIncPaths: string): boolean;
|
function ExtendIncSearchPath(NewIncPaths: string): boolean;
|
||||||
@ -1076,6 +1078,8 @@ type
|
|||||||
function LoadStateFile(IgnoreErrors: boolean): TModalResult;
|
function LoadStateFile(IgnoreErrors: boolean): TModalResult;
|
||||||
function SaveStateFile(const CompilerFilename: string; CompilerParams: TStrings;
|
function SaveStateFile(const CompilerFilename: string; CompilerParams: TStrings;
|
||||||
Complete: boolean): TModalResult;
|
Complete: boolean): TModalResult;
|
||||||
|
function WriteCompilerCfgFile(aProject: TProject; CompilerParams: TStrings;
|
||||||
|
out CmdLineParams: TStrings): TCodeBuffer;
|
||||||
|
|
||||||
// source editor
|
// source editor
|
||||||
procedure UpdateAllCustomHighlighter;
|
procedure UpdateAllCustomHighlighter;
|
||||||
@ -5166,6 +5170,11 @@ begin
|
|||||||
Result:=ExtractFilename(MainUnitInfo.Filename);
|
Result:=ExtractFilename(MainUnitInfo.Filename);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TProject.GetWriteConfigFilePath: string;
|
||||||
|
begin
|
||||||
|
Result:=CompilerOptions.ParsedOpts.GetParsedValue(pcosWriteConfigFilePath);
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TProject.AutoAddOutputDirToIncPath;
|
procedure TProject.AutoAddOutputDirToIncPath;
|
||||||
begin
|
begin
|
||||||
if pfLRSFilesInOutputDirectory in Flags then begin
|
if pfLRSFilesInOutputDirectory in Flags then begin
|
||||||
@ -5312,6 +5321,40 @@ begin
|
|||||||
Result:=mrOk;
|
Result:=mrOk;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TProject.WriteCompilerCfgFile(aProject: TProject;
|
||||||
|
CompilerParams: TStrings; out CmdLineParams: TStrings): TCodeBuffer;
|
||||||
|
var
|
||||||
|
CfgFile, Src, Param: String;
|
||||||
|
i: Integer;
|
||||||
|
begin
|
||||||
|
Result:=nil;
|
||||||
|
CmdLineParams:=TStringListUTF8Fast.Create;
|
||||||
|
CmdLineParams.Add('@'+aProject.GetWriteConfigFilePath);
|
||||||
|
CfgFile:=AProject.GetWriteConfigFilePath;
|
||||||
|
Src:='# Auto generated by Lazarus. Do not edit.'+LineEnding;
|
||||||
|
for i:=CompilerParams.Count-1 downto 0 do
|
||||||
|
begin
|
||||||
|
Param:=CompilerParams[i];
|
||||||
|
if (Param[1]='@')
|
||||||
|
or (Param='n')
|
||||||
|
or (Param[1]<>'-') then
|
||||||
|
CmdLineParams.Insert(1,Param)
|
||||||
|
else begin
|
||||||
|
Src+=Param+LineEnding;
|
||||||
|
CompilerParams.Delete(i);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
|
Result:=CodeToolBoss.LoadFile(CfgFile,true,true);
|
||||||
|
if (Result=nil) and FileExistsCached(CfgFile) then
|
||||||
|
exit; // failed loading old cfg
|
||||||
|
if (Result<>nil) and (Result.Source=Src) then
|
||||||
|
exit; // nothing changed -> skip
|
||||||
|
if Result=nil then
|
||||||
|
Result:=CodeToolBoss.CreateFile(CfgFile);
|
||||||
|
Result.Source:=Src;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TProject.UpdateAllCustomHighlighter;
|
procedure TProject.UpdateAllCustomHighlighter;
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
@ -6507,6 +6550,11 @@ begin
|
|||||||
Result:=inherited GetDefaultMainSourceFileName;
|
Result:=inherited GetDefaultMainSourceFileName;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TProjectCompilerOptions.GetDefaultWriteConfigFilePath: string;
|
||||||
|
begin
|
||||||
|
Result:='$(ProjOutDir)'+PathDelim+'fpclaz.cfg';
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TProjectCompilerOptions.GetInheritedCompilerOptions(
|
procedure TProjectCompilerOptions.GetInheritedCompilerOptions(
|
||||||
var OptionsList: TFPList);
|
var OptionsList: TFPList);
|
||||||
var
|
var
|
||||||
|
@ -302,7 +302,7 @@ begin
|
|||||||
Flags:=CompilerOpts.DefaultMakeOptionsFlags;
|
Flags:=CompilerOpts.DefaultMakeOptionsFlags;
|
||||||
if not RelativePathsCheckBox.Checked then
|
if not RelativePathsCheckBox.Checked then
|
||||||
Include(Flags,ccloAbsolutePaths);
|
Include(Flags,ccloAbsolutePaths);
|
||||||
CompOptions := CompilerOpts.MakeOptionsString(Flags);
|
CompOptions := CompilerOpts.MakeCompilerParams(Flags);
|
||||||
try
|
try
|
||||||
CompPath:=CompilerOpts.ParsedOpts.GetParsedValue(pcosCompilerPath);
|
CompPath:=CompilerOpts.ParsedOpts.GetParsedValue(pcosCompilerPath);
|
||||||
if Pos(' ',CompPath)>0 then
|
if Pos(' ',CompPath)>0 then
|
||||||
|
@ -353,6 +353,7 @@ type
|
|||||||
procedure GetInheritedCompilerOptions(var OptionsList: TFPList); override;
|
procedure GetInheritedCompilerOptions(var OptionsList: TFPList); override;
|
||||||
function GetOwnerName: string; override;
|
function GetOwnerName: string; override;
|
||||||
function GetDefaultMainSourceFileName: string; override;
|
function GetDefaultMainSourceFileName: string; override;
|
||||||
|
function GetDefaultWriteConfigFilePath: string; override;
|
||||||
function CreateTargetFilename: string; override;
|
function CreateTargetFilename: string; override;
|
||||||
function HasCompilerCommand: boolean; override;
|
function HasCompilerCommand: boolean; override;
|
||||||
|
|
||||||
@ -4254,6 +4255,11 @@ begin
|
|||||||
Result:=inherited GetDefaultMainSourceFileName;
|
Result:=inherited GetDefaultMainSourceFileName;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TPkgCompilerOptions.GetDefaultWriteConfigFilePath: string;
|
||||||
|
begin
|
||||||
|
Result:='$(PkgOutDir)'+PathDelim+'fpclaz.cfg';
|
||||||
|
end;
|
||||||
|
|
||||||
function TPkgCompilerOptions.CreateTargetFilename: string;
|
function TPkgCompilerOptions.CreateTargetFilename: string;
|
||||||
begin
|
begin
|
||||||
Result:='';
|
Result:='';
|
||||||
|
@ -1131,7 +1131,7 @@ end;
|
|||||||
function TLazPackageGraph.GetPackageCompilerParams(APackage: TLazPackage
|
function TLazPackageGraph.GetPackageCompilerParams(APackage: TLazPackage
|
||||||
): TStrings;
|
): TStrings;
|
||||||
begin
|
begin
|
||||||
Result:=APackage.CompilerOptions.MakeOptionsString(
|
Result:=APackage.CompilerOptions.MakeCompilerParams(
|
||||||
APackage.CompilerOptions.DefaultMakeOptionsFlags+[ccloAbsolutePaths]);
|
APackage.CompilerOptions.DefaultMakeOptionsFlags+[ccloAbsolutePaths]);
|
||||||
Result.Add(CreateRelativePath(APackage.GetSrcFilename,APackage.Directory));
|
Result.Add(CreateRelativePath(APackage.GetSrcFilename,APackage.Directory));
|
||||||
end;
|
end;
|
||||||
@ -4703,7 +4703,7 @@ begin
|
|||||||
coptParsedPlatformIndependent);
|
coptParsedPlatformIndependent);
|
||||||
CustomOptions:=APackage.CompilerOptions.GetCustomOptions(
|
CustomOptions:=APackage.CompilerOptions.GetCustomOptions(
|
||||||
coptParsedPlatformIndependent);
|
coptParsedPlatformIndependent);
|
||||||
List:=APackage.CompilerOptions.MakeOptionsString(
|
List:=APackage.CompilerOptions.MakeCompilerParams(
|
||||||
[ccloDoNotAppendOutFileOption,ccloNoMacroParams]);
|
[ccloDoNotAppendOutFileOption,ccloNoMacroParams]);
|
||||||
OtherOptions:=MergeCmdLineParams(List);
|
OtherOptions:=MergeCmdLineParams(List);
|
||||||
List.Free;
|
List.Free;
|
||||||
@ -5025,7 +5025,7 @@ begin
|
|||||||
coptParsedPlatformIndependent);
|
coptParsedPlatformIndependent);
|
||||||
if ConsoleVerbosity>0 then
|
if ConsoleVerbosity>0 then
|
||||||
debugln('Hint: (lazarus) Writing fpmake.pp: CustomOptions (orig): ',CustomOptions);
|
debugln('Hint: (lazarus) Writing fpmake.pp: CustomOptions (orig): ',CustomOptions);
|
||||||
List:=APackage.CompilerOptions.MakeOptionsString(
|
List:=APackage.CompilerOptions.MakeCompilerParams(
|
||||||
[ccloDoNotAppendOutFileOption,ccloNoMacroParams]);
|
[ccloDoNotAppendOutFileOption,ccloNoMacroParams]);
|
||||||
if ConsoleVerbosity>0 then
|
if ConsoleVerbosity>0 then
|
||||||
debugln('Hint: (lazarus) Writing fpmake.pp: OtherOptions (orig): ',MergeCmdLineParams(List,TLazCompilerOptions.ConsoleParamsMax));
|
debugln('Hint: (lazarus) Writing fpmake.pp: OtherOptions (orig): ',MergeCmdLineParams(List,TLazCompilerOptions.ConsoleParamsMax));
|
||||||
|
Loading…
Reference in New Issue
Block a user