IDE: auto fix case of TargetOS and TargetCPU

git-svn-id: trunk@27847 -
This commit is contained in:
mattias 2010-10-25 08:24:24 +00:00
parent e00ff67049
commit 2c5c4c2609
3 changed files with 39 additions and 9 deletions

View File

@ -889,6 +889,8 @@ procedure SplitLazarusCPUOSWidgetCombo(const Combination: string;
function GetCompiledTargetOS: string;
function GetCompiledTargetCPU: string;
function GetDefaultCompilerFilename(const TargetCPU: string = ''): string;
function GetFPCTargetOS(TargetOS: string): string;
function GetFPCTargetCPU(TargetCPU: string): string;
// functions to quickly setup some defines
function CreateDefinesInDirectories(const SourcePaths, FlagName: string
@ -2565,6 +2567,16 @@ begin
Result:=Result+ExeExt;
end;
function GetFPCTargetOS(TargetOS: string): string;
begin
Result:=lowercase(TargetOS);
end;
function GetFPCTargetCPU(TargetCPU: string): string;
begin
Result:=LowerCase(TargetCPU);
end;
function CreateDefinesInDirectories(const SourcePaths, FlagName: string
): TDefineTemplate;
var

View File

@ -1222,9 +1222,12 @@ begin
end;
procedure TBaseCompilerOptions.SetTargetCPU(const AValue: string);
var
NewValue: String;
begin
if fTargetCPU=AValue then exit;
fTargetCPU:=AValue;
NewValue:=GetFPCTargetCPU(AValue);
if fTargetCPU=NewValue then exit;
fTargetCPU:=NewValue;
if ParsedOpts.InvalidateParseOnChange then
IncreaseBuildMacroChangeStamp;
IncreaseChangeStamp;
@ -1240,9 +1243,12 @@ begin
end;
procedure TBaseCompilerOptions.SetTargetOS(const AValue: string);
var
NewValue: String;
begin
if fTargetOS=AValue then exit;
fTargetOS:=AValue;
NewValue:=GetFPCTargetOS(AValue);
if fTargetOS=NewValue then exit;
fTargetOS:=NewValue;
if ParsedOpts.InvalidateParseOnChange then
IncreaseBuildMacroChangeStamp;
IncreaseChangeStamp;
@ -1509,10 +1515,10 @@ begin
end else
TargetProcessor := aXMLConfig.GetValue(p+'TargetProcessor/Value', '');
TargetCPU := aXMLConfig.GetValue(p+'TargetCPU/Value', '');
TargetOS := aXMLConfig.GetValue(p+'TargetOS/Value', '');
VariablesInRegisters := aXMLConfig.GetValue(p+'Optimizations/VariablesInRegisters/Value', false);
UncertainOptimizations := aXMLConfig.GetValue(p+'Optimizations/UncertainOptimizations/Value', false);
OptimizationLevel := aXMLConfig.GetValue(p+'Optimizations/OptimizationLevel/Value', 1);
TargetOS := aXMLConfig.GetValue(p+'TargetOS/Value', '');
{ Linking }
p:=Path+'Linking/';

View File

@ -5,8 +5,10 @@ unit compiler_codegen_options;
interface
uses
Classes,SysUtils,FileUtil,Forms,Controls,Graphics,Dialogs,StdCtrls,ExtCtrls,
IDEOptionsIntf,Project,CompilerOptions,LazarusIDEStrConsts;
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
ExtCtrls,
DefineTemplates, IDEOptionsIntf, Project, CompilerOptions,
LazarusIDEStrConsts;
type
@ -51,6 +53,16 @@ implementation
{$R *.lfm}
function CaptionToOS(const OS: string): string;
begin
Result:=LowerCase(OS);
end;
function CaptionToCPU(const CPU: string): string;
begin
Result:=LowerCase(CPU);
end;
function ProcessorToCaption(const Processor: string): string;
begin
if SysUtils.CompareText(Processor, '386') = 0 then
@ -264,12 +276,12 @@ begin
NewTargetOS := TargetOSComboBox.Text;
if TargetOSComboBox.Items.IndexOf(NewTargetOS) <= 0 then
NewTargetOS := '';
TargetOS := NewTargetOS;
TargetOS := CaptionToOS(NewTargetOS);
NewTargetCPU := TargetCPUComboBox.Text;
if TargetCPUComboBox.Items.IndexOf(NewTargetCPU) <= 0 then
NewTargetCPU := '';
TargetCPU := NewTargetCPU;
TargetCPU := CaptionToCPU(NewTargetCPU);
TargetProcessor := CaptionToProcessor(TargetProcessorProcComboBox.Text);
VariablesInRegisters := chkOptVarsInReg.Checked;