mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-13 08:09:22 +02:00
implemented updating IDE fpc values on changing TargetCPU, cross building IDE now switches global settings, so changing project settings no longer required
git-svn-id: trunk@8330 -
This commit is contained in:
parent
12344a9282
commit
b77cd7e3d2
@ -109,6 +109,7 @@ type
|
|||||||
FExtraOptions: string;
|
FExtraOptions: string;
|
||||||
FRestartAfterBuild: boolean;
|
FRestartAfterBuild: boolean;
|
||||||
FConfirmBuild: boolean;
|
FConfirmBuild: boolean;
|
||||||
|
FTargetCPU: string;
|
||||||
FTargetDirectory: string;
|
FTargetDirectory: string;
|
||||||
fTargetOS: string;
|
fTargetOS: string;
|
||||||
fLCLPlatform: TLCLPlatform;
|
fLCLPlatform: TLCLPlatform;
|
||||||
@ -119,6 +120,7 @@ type
|
|||||||
function GetItems(Index: integer): TBuildLazarusItem;
|
function GetItems(Index: integer): TBuildLazarusItem;
|
||||||
procedure SetRestartAfterBuild(const AValue: boolean);
|
procedure SetRestartAfterBuild(const AValue: boolean);
|
||||||
procedure SetConfirmBuild(const AValue: boolean);
|
procedure SetConfirmBuild(const AValue: boolean);
|
||||||
|
procedure SetTargetCPU(const AValue: string);
|
||||||
procedure SetTargetDirectory(const AValue: string);
|
procedure SetTargetDirectory(const AValue: string);
|
||||||
procedure SetTargetOS(const AValue: string);
|
procedure SetTargetOS(const AValue: string);
|
||||||
procedure SetWithStaticPackages(const AValue: boolean);
|
procedure SetWithStaticPackages(const AValue: boolean);
|
||||||
@ -149,6 +151,7 @@ type
|
|||||||
property CleanAll: boolean read FCleanAll write FCleanAll;
|
property CleanAll: boolean read FCleanAll write FCleanAll;
|
||||||
property ExtraOptions: string read FExtraOptions write FExtraOptions;
|
property ExtraOptions: string read FExtraOptions write FExtraOptions;
|
||||||
property TargetOS: string read fTargetOS write SetTargetOS;
|
property TargetOS: string read fTargetOS write SetTargetOS;
|
||||||
|
property TargetCPU: string read FTargetCPU write SetTargetCPU;
|
||||||
property LCLPlatform: TLCLPlatform read fLCLPlatform write fLCLPlatform;
|
property LCLPlatform: TLCLPlatform read fLCLPlatform write fLCLPlatform;
|
||||||
property StaticAutoInstallPackages: TStringList
|
property StaticAutoInstallPackages: TStringList
|
||||||
read fStaticAutoInstallPackages;
|
read fStaticAutoInstallPackages;
|
||||||
@ -325,6 +328,9 @@ begin
|
|||||||
// append target OS
|
// append target OS
|
||||||
if Options.TargetOS<>'' then
|
if Options.TargetOS<>'' then
|
||||||
Tool.CmdLineParams:=Tool.CmdLineParams+' OS_TARGET='+Options.TargetOS;
|
Tool.CmdLineParams:=Tool.CmdLineParams+' OS_TARGET='+Options.TargetOS;
|
||||||
|
// append target CPU
|
||||||
|
if Options.TargetCPU<>'' then
|
||||||
|
Tool.CmdLineParams:=Tool.CmdLineParams+' CPU_TARGET='+Options.TargetCPU;
|
||||||
Result:=ExternalTools.Run(Tool,Macros);
|
Result:=ExternalTools.Run(Tool,Macros);
|
||||||
if Result<>mrOk then exit;
|
if Result<>mrOk then exit;
|
||||||
end;
|
end;
|
||||||
@ -359,6 +365,9 @@ begin
|
|||||||
// append target OS
|
// append target OS
|
||||||
if Options.TargetOS<>'' then
|
if Options.TargetOS<>'' then
|
||||||
Tool.CmdLineParams:=Tool.CmdLineParams+' OS_TARGET='+Options.TargetOS;
|
Tool.CmdLineParams:=Tool.CmdLineParams+' OS_TARGET='+Options.TargetOS;
|
||||||
|
// append target CPU
|
||||||
|
if Options.TargetCPU<>'' then
|
||||||
|
Tool.CmdLineParams:=Tool.CmdLineParams+' CPU_TARGET='+Options.TargetCPU;
|
||||||
// don't run svn2revisioninc when building the IDE for the second time
|
// don't run svn2revisioninc when building the IDE for the second time
|
||||||
if not (blfWithoutLinkingIDE in Flags) then
|
if not (blfWithoutLinkingIDE in Flags) then
|
||||||
Tool.CmdLineParams:=Tool.CmdLineParams+' USESVN2REVISIONINC=0';
|
Tool.CmdLineParams:=Tool.CmdLineParams+' USESVN2REVISIONINC=0';
|
||||||
@ -416,6 +425,7 @@ var
|
|||||||
NewTargetFilename: String;
|
NewTargetFilename: String;
|
||||||
NewTargetDirectory: String;
|
NewTargetDirectory: String;
|
||||||
DefaultTargetOS: string;
|
DefaultTargetOS: string;
|
||||||
|
DefaultTargetCPU: string;
|
||||||
begin
|
begin
|
||||||
Result:=mrOk;
|
Result:=mrOk;
|
||||||
CurItem:=Options.Items[ItemIndex];
|
CurItem:=Options.Items[ItemIndex];
|
||||||
@ -477,14 +487,17 @@ begin
|
|||||||
// => find it automatically
|
// => find it automatically
|
||||||
|
|
||||||
DefaultTargetOS:={$I %FPCTARGETOS%};
|
DefaultTargetOS:={$I %FPCTARGETOS%};
|
||||||
if (Options.TargetOS<>'')
|
DefaultTargetCPU:={$I %FPCTARGETCPU%};
|
||||||
and (CompareText(Options.TargetOS,DefaultTargetOS)<>0) then
|
if ((Options.TargetOS<>'')
|
||||||
|
and (CompareText(Options.TargetOS,DefaultTargetOS)<>0))
|
||||||
|
or ((Options.TargetCPU<>'')
|
||||||
|
and (CompareText(Options.TargetCPU,DefaultTargetCPU)<>0)) then
|
||||||
begin
|
begin
|
||||||
// Case 2. crosscompiling the IDE
|
// Case 2. crosscompiling the IDE
|
||||||
// create directory <primary config dir>/bin/<TargetOS>
|
// create directory <primary config dir>/bin/<TargetCPU>-<TargetOS>
|
||||||
NewTargetDirectory:=AppendPathDelim(GetPrimaryConfigPath)+'bin'
|
NewTargetDirectory:=AppendPathDelim(GetPrimaryConfigPath)+'bin'
|
||||||
+PathDelim+Options.TargetOS;
|
+PathDelim+Options.TargetCPU+'-'+Options.TargetOS;
|
||||||
debugln('CreateBuildLazarusOptions Options.TargetOS=',Options.TargetOS,' DefaultOS=',DefaultTargetOS);
|
debugln('CreateBuildLazarusOptions Options.TargetOS=',Options.TargetOS,' Options.TargetCPU=',Options.TargetCPU,' DefaultOS=',DefaultTargetOS,' DefaultCPU=',DefaultTargetCPU);
|
||||||
Result:=ForceDirectoryInteractive(NewTargetDirectory,[]);
|
Result:=ForceDirectoryInteractive(NewTargetDirectory,[]);
|
||||||
if Result<>mrOk then exit;
|
if Result<>mrOk then exit;
|
||||||
end else begin
|
end else begin
|
||||||
@ -1147,6 +1160,7 @@ begin
|
|||||||
XMLConfig.SetDeleteValue(Path+'CleanAll/Value',FCleanAll,true);
|
XMLConfig.SetDeleteValue(Path+'CleanAll/Value',FCleanAll,true);
|
||||||
XMLConfig.SetDeleteValue(Path+'ExtraOptions/Value',FExtraOptions,'');
|
XMLConfig.SetDeleteValue(Path+'ExtraOptions/Value',FExtraOptions,'');
|
||||||
XMLConfig.SetDeleteValue(Path+'TargetOS/Value',TargetOS,'');
|
XMLConfig.SetDeleteValue(Path+'TargetOS/Value',TargetOS,'');
|
||||||
|
XMLConfig.SetDeleteValue(Path+'TargetCPU/Value',TargetCPU,'');
|
||||||
XMLConfig.SetDeleteValue(Path+'LCLPlatform/Value',
|
XMLConfig.SetDeleteValue(Path+'LCLPlatform/Value',
|
||||||
LCLPlatformNames[fLCLPlatform],
|
LCLPlatformNames[fLCLPlatform],
|
||||||
GetDefaultLCLWidgetType);
|
GetDefaultLCLWidgetType);
|
||||||
@ -1175,6 +1189,7 @@ begin
|
|||||||
CleanAll:=Source.CleanAll;
|
CleanAll:=Source.CleanAll;
|
||||||
ExtraOptions:=Source.ExtraOptions;
|
ExtraOptions:=Source.ExtraOptions;
|
||||||
TargetOS:=Source.TargetOS;
|
TargetOS:=Source.TargetOS;
|
||||||
|
TargetCPU:=Source.TargetCPU;
|
||||||
LCLPlatform:=Source.LCLPlatform;
|
LCLPlatform:=Source.LCLPlatform;
|
||||||
TargetDirectory:=Source.TargetDirectory;
|
TargetDirectory:=Source.TargetDirectory;
|
||||||
WithStaticPackages:=Source.WithStaticPackages;
|
WithStaticPackages:=Source.WithStaticPackages;
|
||||||
@ -1242,6 +1257,7 @@ begin
|
|||||||
FCleanAll:=XMLConfig.GetValue(Path+'CleanAll/Value',true);
|
FCleanAll:=XMLConfig.GetValue(Path+'CleanAll/Value',true);
|
||||||
FExtraOptions:=XMLConfig.GetValue(Path+'ExtraOptions/Value','');
|
FExtraOptions:=XMLConfig.GetValue(Path+'ExtraOptions/Value','');
|
||||||
TargetOS:=XMLConfig.GetValue(Path+'TargetOS/Value','');
|
TargetOS:=XMLConfig.GetValue(Path+'TargetOS/Value','');
|
||||||
|
TargetCPU:=XMLConfig.GetValue(Path+'TargetCPU/Value','');
|
||||||
fLCLPlatform:=StrToLCLPlatform(XMLConfig.GetValue(Path+'LCLPlatform/Value',
|
fLCLPlatform:=StrToLCLPlatform(XMLConfig.GetValue(Path+'LCLPlatform/Value',
|
||||||
GetDefaultLCLWidgetType));
|
GetDefaultLCLWidgetType));
|
||||||
FTargetDirectory:=AppendPathDelim(SetDirSeparators(
|
FTargetDirectory:=AppendPathDelim(SetDirSeparators(
|
||||||
@ -1291,6 +1307,13 @@ begin
|
|||||||
FConfirmBuild:=AValue;
|
FConfirmBuild:=AValue;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TBuildLazarusOptions.SetTargetCPU(const AValue: string);
|
||||||
|
begin
|
||||||
|
if FTargetCPU=AValue then exit;
|
||||||
|
FTargetCPU:=AValue;
|
||||||
|
FGlobals.TargetCPU:=TargetCPU;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TBuildLazarusOptions.SetWithStaticPackages(const AValue: boolean);
|
procedure TBuildLazarusOptions.SetWithStaticPackages(const AValue: boolean);
|
||||||
begin
|
begin
|
||||||
if FWithStaticPackages=AValue then exit;
|
if FWithStaticPackages=AValue then exit;
|
||||||
@ -1324,6 +1347,7 @@ begin
|
|||||||
FExtraOptions:='';
|
FExtraOptions:='';
|
||||||
FTargetDirectory:=DefaultTargetDirectory;
|
FTargetDirectory:=DefaultTargetDirectory;
|
||||||
TargetOS:='';
|
TargetOS:='';
|
||||||
|
TargetCPU:='';
|
||||||
fLCLPlatform:=StrToLCLPlatform(GetDefaultLCLWidgetType);
|
fLCLPlatform:=StrToLCLPlatform(GetDefaultLCLWidgetType);
|
||||||
|
|
||||||
// auto install packages
|
// auto install packages
|
||||||
|
@ -2450,6 +2450,9 @@ var
|
|||||||
begin
|
begin
|
||||||
if ParsedStamp[Option]<>CompilerParseStamp then begin
|
if ParsedStamp[Option]<>CompilerParseStamp then begin
|
||||||
s:=UnparsedValues[Option];
|
s:=UnparsedValues[Option];
|
||||||
|
//if Option=pcosCustomOptions then begin
|
||||||
|
// DebugLn('TParsedCompilerOptions.GetParsedValue START ',dbgs(ParsedStamp[Option]),' ',dbgs(CompilerParseStamp),' unparsed="',s,'" old="',ParsedValues[Option],'"');
|
||||||
|
//end;
|
||||||
// parse locally
|
// parse locally
|
||||||
if Assigned(OnLocalSubstitute) then s:=OnLocalSubstitute(s);
|
if Assigned(OnLocalSubstitute) then s:=OnLocalSubstitute(s);
|
||||||
// parse globally
|
// parse globally
|
||||||
@ -2486,6 +2489,9 @@ begin
|
|||||||
end;
|
end;
|
||||||
ParsedValues[Option]:=s;
|
ParsedValues[Option]:=s;
|
||||||
ParsedStamp[Option]:=CompilerParseStamp;
|
ParsedStamp[Option]:=CompilerParseStamp;
|
||||||
|
//if Option=pcosCustomOptions then begin
|
||||||
|
// DebugLn('TParsedCompilerOptions.GetParsedValue PARSED ',dbgs(ParsedStamp[Option]),' ',dbgs(CompilerParseStamp),' new="',ParsedValues[Option],'"');
|
||||||
|
//end;
|
||||||
end;
|
end;
|
||||||
Result:=ParsedValues[Option];
|
Result:=ParsedValues[Option];
|
||||||
end;
|
end;
|
||||||
|
@ -1075,7 +1075,7 @@ begin
|
|||||||
// check for change and save
|
// check for change and save
|
||||||
if not OldCompOpts.IsEqual(Options) then begin
|
if not OldCompOpts.IsEqual(Options) then begin
|
||||||
Options.Modified:=true;
|
Options.Modified:=true;
|
||||||
IncreaseCompilerGraphStamp;
|
IncreaseCompilerParseStamp;
|
||||||
end;
|
end;
|
||||||
OldCompOpts.Free;
|
OldCompOpts.Free;
|
||||||
end;
|
end;
|
||||||
@ -1151,16 +1151,20 @@ begin
|
|||||||
with AncestorOptions.ParsedOpts do begin
|
with AncestorOptions.ParsedOpts do begin
|
||||||
AddChildNode(lisunitPath,
|
AddChildNode(lisunitPath,
|
||||||
CreateRelativeSearchPath(GetParsedValue(pcosUnitPath),
|
CreateRelativeSearchPath(GetParsedValue(pcosUnitPath),
|
||||||
CompilerOpts.BaseDirectory),icoUnitPath);
|
CompilerOpts.BaseDirectory),
|
||||||
|
icoUnitPath);
|
||||||
AddChildNode(lisincludePath,
|
AddChildNode(lisincludePath,
|
||||||
CreateRelativeSearchPath(GetParsedValue(pcosIncludePath),
|
CreateRelativeSearchPath(GetParsedValue(pcosIncludePath),
|
||||||
CompilerOpts.BaseDirectory),icoIncludePath);
|
CompilerOpts.BaseDirectory),
|
||||||
|
icoIncludePath);
|
||||||
AddChildNode(lisobjectPath,
|
AddChildNode(lisobjectPath,
|
||||||
CreateRelativeSearchPath(GetParsedValue(pcosObjectPath),
|
CreateRelativeSearchPath(GetParsedValue(pcosObjectPath),
|
||||||
CompilerOpts.BaseDirectory),icoObjectPath);
|
CompilerOpts.BaseDirectory),
|
||||||
|
icoObjectPath);
|
||||||
AddChildNode(lislibraryPath,
|
AddChildNode(lislibraryPath,
|
||||||
CreateRelativeSearchPath(GetParsedValue(pcosLibraryPath),
|
CreateRelativeSearchPath(GetParsedValue(pcosLibraryPath),
|
||||||
CompilerOpts.BaseDirectory),icoLibraryPath);
|
CompilerOpts.BaseDirectory),
|
||||||
|
icoLibraryPath);
|
||||||
AddChildNode(lislinkerOptions, GetParsedValue(pcosLinkerOptions),
|
AddChildNode(lislinkerOptions, GetParsedValue(pcosLinkerOptions),
|
||||||
icoLinkerOptions);
|
icoLinkerOptions);
|
||||||
AddChildNode(liscustomOptions, GetParsedValue(pcosCustomOptions),
|
AddChildNode(liscustomOptions, GetParsedValue(pcosCustomOptions),
|
||||||
|
@ -106,6 +106,7 @@ function FileIsTextCached(const AFilename: string): boolean;
|
|||||||
procedure SplitCmdLine(const CmdLine: string;
|
procedure SplitCmdLine(const CmdLine: string;
|
||||||
var ProgramFilename, Params: string);
|
var ProgramFilename, Params: string);
|
||||||
function PrepareCmdLineOption(const Option: string): string;
|
function PrepareCmdLineOption(const Option: string): string;
|
||||||
|
function AddCmdLineParameter(const CmdLine, AddParameter: string): string;
|
||||||
|
|
||||||
// find file
|
// find file
|
||||||
function FindFilesCaseInsensitive(const Directory,
|
function FindFilesCaseInsensitive(const Directory,
|
||||||
@ -1714,6 +1715,14 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function AddCmdLineParameter(const CmdLine, AddParameter: string): string;
|
||||||
|
begin
|
||||||
|
Result:=CmdLine;
|
||||||
|
if (Result<>'') and (Result[length(Result)]<>' ') then
|
||||||
|
Result:=Result+' ';
|
||||||
|
Result:=Result+AddParameter;
|
||||||
|
end;
|
||||||
|
|
||||||
{-------------------------------------------------------------------------------
|
{-------------------------------------------------------------------------------
|
||||||
function CommentLines(const s: string): string;
|
function CommentLines(const s: string): string;
|
||||||
|
|
||||||
|
129
ide/main.pp
129
ide/main.pp
@ -572,9 +572,15 @@ type
|
|||||||
procedure OnCopyError(const ErrorData: TCopyErrorData;
|
procedure OnCopyError(const ErrorData: TCopyErrorData;
|
||||||
var Handled: boolean; Data: TObject);
|
var Handled: boolean; Data: TObject);
|
||||||
|
|
||||||
|
// methods fro building
|
||||||
|
procedure SetBuildTarget(const TargetOS, TargetCPU, LCLWidgetType: string);
|
||||||
public
|
public
|
||||||
CurDefinesCompilerFilename: String;
|
CurDefinesCompilerFilename: String;
|
||||||
CurDefinesCompilerOptions: String;
|
CurDefinesCompilerOptions: String;
|
||||||
|
OverrideTargetOS: string;
|
||||||
|
OverrideTargetCPU: string;
|
||||||
|
OverrideLCLWidgetType: string;
|
||||||
|
|
||||||
class procedure ParseCmdLineOptions;
|
class procedure ParseCmdLineOptions;
|
||||||
|
|
||||||
constructor Create(TheOwner: TComponent); override;
|
constructor Create(TheOwner: TComponent); override;
|
||||||
@ -792,6 +798,9 @@ type
|
|||||||
function IsTestUnitFilename(const AFilename: string): boolean; override;
|
function IsTestUnitFilename(const AFilename: string): boolean; override;
|
||||||
function GetRunCommandLine: string; override;
|
function GetRunCommandLine: string; override;
|
||||||
function GetProjPublishDir: string;
|
function GetProjPublishDir: string;
|
||||||
|
function GetLCLWidgetType(UseCache: boolean): string;
|
||||||
|
function GetTargetCPU(UseCache: boolean): string;
|
||||||
|
function GetTargetOS(UseCache: boolean): string;
|
||||||
procedure OnMacroSubstitution(TheMacro: TTransferMacro; var s: string;
|
procedure OnMacroSubstitution(TheMacro: TTransferMacro; var s: string;
|
||||||
var Handled, Abort: boolean);
|
var Handled, Abort: boolean);
|
||||||
function OnSubstituteCompilerOption(Options: TParsedCompilerOptions;
|
function OnSubstituteCompilerOption(Options: TParsedCompilerOptions;
|
||||||
@ -3010,6 +3019,7 @@ begin
|
|||||||
if frmCompilerOptions.ShowModal=mrOk then begin
|
if frmCompilerOptions.ShowModal=mrOk then begin
|
||||||
RescanCompilerDefines(true);
|
RescanCompilerDefines(true);
|
||||||
Project1.DefineTemplates.AllChanged;
|
Project1.DefineTemplates.AllChanged;
|
||||||
|
IncreaseCompilerParseStamp;
|
||||||
end;
|
end;
|
||||||
finally
|
finally
|
||||||
frmCompilerOptions.Free;
|
frmCompilerOptions.Free;
|
||||||
@ -5071,6 +5081,46 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TMainIDE.SetBuildTarget(const TargetOS, TargetCPU,
|
||||||
|
LCLWidgetType: string);
|
||||||
|
var
|
||||||
|
OldTargetOS: String;
|
||||||
|
OldTargetCPU: String;
|
||||||
|
OldLCLWidgetType: String;
|
||||||
|
NewTargetOS: String;
|
||||||
|
NewTargetCPU: String;
|
||||||
|
NewLCLWidgetType: String;
|
||||||
|
FPCTargetChanged: Boolean;
|
||||||
|
LCLTargetChanged: Boolean;
|
||||||
|
begin
|
||||||
|
OldTargetOS:=GetTargetOS(true);
|
||||||
|
OldTargetCPU:=GetTargetCPU(true);
|
||||||
|
OldLCLWidgetType:=GetLCLWidgetType(true);
|
||||||
|
OverrideTargetOS:=TargetOS;
|
||||||
|
OverrideTargetCPU:=TargetCPU;
|
||||||
|
OverrideLCLWidgetType:=LCLWidgetType;
|
||||||
|
NewTargetOS:=GetTargetOS(false);
|
||||||
|
NewTargetCPU:=GetTargetCPU(false);
|
||||||
|
NewLCLWidgetType:=GetLCLWidgetType(false);
|
||||||
|
|
||||||
|
FPCTargetChanged:=(OldTargetOS<>NewTargetOS)
|
||||||
|
or (OldTargetCPU<>NewTargetCPU);
|
||||||
|
LCLTargetChanged:=(OldLCLWidgetType<>NewLCLWidgetType);
|
||||||
|
|
||||||
|
//DebugLn('TMainIDE.SetBuildTarget Old=',OldTargetCPU,'-',OldTargetOS,'-',OldLCLWidgetType,
|
||||||
|
// ' New=',NewTargetCPU,'-',NewTargetOS,'-',NewLCLWidgetType,' FPC=',dbgs(FPCTargetChanged),' LCL=',dbgs(LCLTargetChanged));
|
||||||
|
|
||||||
|
if LCLTargetChanged then
|
||||||
|
CodeToolBoss.GlobalValues.Variables[ExternalMacroStart+'LCLWidgetType']:=
|
||||||
|
NewLCLWidgetType;
|
||||||
|
if FPCTargetChanged then
|
||||||
|
RescanCompilerDefines(true);
|
||||||
|
|
||||||
|
if FPCTargetChanged or LCLTargetChanged then begin
|
||||||
|
IncreaseCompilerParseStamp;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
function TMainIDE.DoOpenFileInSourceEditor(AnUnitInfo: TUnitInfo;
|
function TMainIDE.DoOpenFileInSourceEditor(AnUnitInfo: TUnitInfo;
|
||||||
PageIndex: integer; Flags: TOpenFlags): TModalResult;
|
PageIndex: integer; Flags: TOpenFlags): TModalResult;
|
||||||
var NewSrcEdit: TSourceEditor;
|
var NewSrcEdit: TSourceEditor;
|
||||||
@ -7470,8 +7520,11 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
MessagesView.BeginBlock;
|
MessagesView.BeginBlock;
|
||||||
|
|
||||||
try
|
try
|
||||||
|
SetBuildTarget(MiscellaneousOptions.BuildLazOpts.TargetOS,
|
||||||
|
MiscellaneousOptions.BuildLazOpts.TargetCPU,
|
||||||
|
LCLPlatformNames[MiscellaneousOptions.BuildLazOpts.LCLPlatform]);
|
||||||
|
|
||||||
// first compile all lazarus components (LCL, SynEdit, CodeTools, ...)
|
// first compile all lazarus components (LCL, SynEdit, CodeTools, ...)
|
||||||
SourceNotebook.ClearErrorLines;
|
SourceNotebook.ClearErrorLines;
|
||||||
Result:=BuildLazarus(MiscellaneousOptions.BuildLazOpts,
|
Result:=BuildLazarus(MiscellaneousOptions.BuildLazOpts,
|
||||||
@ -7529,6 +7582,8 @@ begin
|
|||||||
if Result<>mrOk then exit;
|
if Result<>mrOk then exit;
|
||||||
|
|
||||||
finally
|
finally
|
||||||
|
SetBuildTarget('','','');
|
||||||
|
|
||||||
DoCheckFilesOnDisk;
|
DoCheckFilesOnDisk;
|
||||||
MessagesView.EndBlock;
|
MessagesView.EndBlock;
|
||||||
end;
|
end;
|
||||||
@ -9004,23 +9059,11 @@ begin
|
|||||||
end else if MacroName='lazarusdir' then begin
|
end else if MacroName='lazarusdir' then begin
|
||||||
s:=EnvironmentOptions.LazarusDirectory;
|
s:=EnvironmentOptions.LazarusDirectory;
|
||||||
end else if MacroName='lclwidgettype' then begin
|
end else if MacroName='lclwidgettype' then begin
|
||||||
if Project1<>nil then
|
s:=GetLCLWidgetType(true);
|
||||||
s:=Project1.CompilerOptions.LCLWidgetType
|
|
||||||
else
|
|
||||||
s:='';
|
|
||||||
if (s='') or (s='default') then s:=GetDefaultLCLWidgetType;
|
|
||||||
end else if MacroName='targetcpu' then begin
|
end else if MacroName='targetcpu' then begin
|
||||||
if Project1<>nil then
|
s:=GetTargetCPU(true);
|
||||||
s:=lowercase(Project1.CompilerOptions.TargetCPU)
|
|
||||||
else
|
|
||||||
s:='';
|
|
||||||
if (s='') or (s='default') then s:=GetDefaultTargetCPU;
|
|
||||||
end else if MacroName='targetos' then begin
|
end else if MacroName='targetos' then begin
|
||||||
if Project1<>nil then
|
s:=GetTargetOS(true);
|
||||||
s:=lowercase(Project1.CompilerOptions.TargetOS)
|
|
||||||
else
|
|
||||||
s:='';
|
|
||||||
if (s='') or (s='default') then s:=GetDefaultTargetOS;
|
|
||||||
end else if MacroName='fpcsrcdir' then begin
|
end else if MacroName='fpcsrcdir' then begin
|
||||||
s:=EnvironmentOptions.FPCSourceDirectory;
|
s:=EnvironmentOptions.FPCSourceDirectory;
|
||||||
end else if MacroName='comppath' then begin
|
end else if MacroName='comppath' then begin
|
||||||
@ -9549,6 +9592,45 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TMainIDE.GetLCLWidgetType(UseCache: boolean): string;
|
||||||
|
begin
|
||||||
|
if UseCache and (CodeToolBoss<>nil) then begin
|
||||||
|
Result:=CodeToolBoss.GlobalValues.Variables[ExternalMacroStart+'LCLWidgetType'];
|
||||||
|
end else begin
|
||||||
|
if OverrideLCLWidgetType<>'' then
|
||||||
|
Result:=OverrideLCLWidgetType
|
||||||
|
else if Project1<>nil then
|
||||||
|
Result:=lowercase(Project1.CompilerOptions.LCLWidgetType)
|
||||||
|
else
|
||||||
|
Result:='';
|
||||||
|
end;
|
||||||
|
if (Result='') or (Result='default') then Result:=GetDefaultLCLWidgetType;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TMainIDE.GetTargetCPU(UseCache: boolean): string;
|
||||||
|
begin
|
||||||
|
if UseCache then ;
|
||||||
|
if OverrideTargetCPU<>'' then
|
||||||
|
Result:=OverrideTargetCPU
|
||||||
|
else if Project1<>nil then
|
||||||
|
Result:=lowercase(Project1.CompilerOptions.TargetCPU)
|
||||||
|
else
|
||||||
|
Result:='';
|
||||||
|
if (Result='') or (Result='default') then Result:=GetDefaultTargetCPU;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TMainIDE.GetTargetOS(UseCache: boolean): string;
|
||||||
|
begin
|
||||||
|
if UseCache then ;
|
||||||
|
if OverrideTargetOS<>'' then
|
||||||
|
Result:=OverrideTargetOS
|
||||||
|
else if Project1<>nil then
|
||||||
|
Result:=lowercase(Project1.CompilerOptions.TargetOS)
|
||||||
|
else
|
||||||
|
Result:='';
|
||||||
|
if (Result='') or (Result='default') then Result:=GetDefaultTargetOS;
|
||||||
|
end;
|
||||||
|
|
||||||
function TMainIDE.FindUnitFile(const AFilename: string): string;
|
function TMainIDE.FindUnitFile(const AFilename: string): string;
|
||||||
var
|
var
|
||||||
SearchPath, ProjectDir: string;
|
SearchPath, ProjectDir: string;
|
||||||
@ -10129,8 +10211,8 @@ begin
|
|||||||
EnvironmentOptions.LazarusDirectory;
|
EnvironmentOptions.LazarusDirectory;
|
||||||
Variables[ExternalMacroStart+'FPCSrcDir']:=
|
Variables[ExternalMacroStart+'FPCSrcDir']:=
|
||||||
EnvironmentOptions.FPCSourceDirectory;
|
EnvironmentOptions.FPCSourceDirectory;
|
||||||
Variables[ExternalMacroStart+'LCLWidgetType']:=GetDefaultLCLWidgetType;
|
|
||||||
Variables[ExternalMacroStart+'ProjPath']:=VirtualDirectory;
|
Variables[ExternalMacroStart+'ProjPath']:=VirtualDirectory;
|
||||||
|
Variables[ExternalMacroStart+'LCLWidgetType']:=GetDefaultLCLWidgetType;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// build DefinePool and Define Tree
|
// build DefinePool and Define Tree
|
||||||
@ -10219,11 +10301,16 @@ var
|
|||||||
TargetOS, TargetProcessor: string;
|
TargetOS, TargetProcessor: string;
|
||||||
UnitLinksValid: boolean;
|
UnitLinksValid: boolean;
|
||||||
i: Integer;
|
i: Integer;
|
||||||
|
CurTargetOS: String;
|
||||||
|
CurTargetCPU: String;
|
||||||
begin
|
begin
|
||||||
if Project1.CompilerOptions.TargetOS<>'' then
|
CurOptions:='';
|
||||||
CurOptions:='-T'+Project1.CompilerOptions.TargetOS
|
CurTargetOS:=GetTargetOS(false);
|
||||||
else
|
if CurTargetOS<>'' then
|
||||||
CurOptions:='';
|
CurOptions:=AddCmdLineParameter(CurOptions,'-T'+CurTargetOS);
|
||||||
|
CurTargetCPU:=GetTargetCPU(false);
|
||||||
|
if CurTargetCPU<>'' then
|
||||||
|
CurOptions:=AddCmdLineParameter(CurOptions,'-d'+CurTargetCPU);
|
||||||
{$IFDEF VerboseFPCSrcScan}
|
{$IFDEF VerboseFPCSrcScan}
|
||||||
writeln('TMainIDE.RescanCompilerDefines A ',CurOptions,
|
writeln('TMainIDE.RescanCompilerDefines A ',CurOptions,
|
||||||
' OnlyIfCompilerChanged=',OnlyIfCompilerChanged,
|
' OnlyIfCompilerChanged=',OnlyIfCompilerChanged,
|
||||||
|
@ -3776,15 +3776,20 @@ var
|
|||||||
Changed: Boolean;
|
Changed: Boolean;
|
||||||
begin
|
begin
|
||||||
Changed:=false;
|
Changed:=false;
|
||||||
Changed:=Changed or CodeToolBoss.SetGlobalValue(
|
if CodeToolBoss.SetGlobalValue(ExternalMacroStart+'LCLWidgetType',
|
||||||
ExternalMacroStart+'LCLWidgetType',
|
Owner.CompilerOptions.GetEffectiveLCLWidgetType)
|
||||||
Owner.CompilerOptions.GetEffectiveLCLWidgetType);
|
then begin
|
||||||
|
DebugLn('TProjectDefineTemplates.UpdateGlobalValues '
|
||||||
|
,' LCLWidgetType="',CodeToolBoss.GlobalValues.Variables[ExternalMacroStart+'LCLWidgetType'],'" Effective="',Owner.CompilerOptions.GetEffectiveLCLWidgetType,'" Options="',Owner.CompilerOptions.LCLWidgetType,'"');
|
||||||
|
Changed:=true;
|
||||||
|
end;
|
||||||
if Owner.IsVirtual then
|
if Owner.IsVirtual then
|
||||||
NewProjectDir:=VirtualDirectory
|
NewProjectDir:=VirtualDirectory
|
||||||
else
|
else
|
||||||
NewProjectDir:=Owner.ProjectDirectory;
|
NewProjectDir:=Owner.ProjectDirectory;
|
||||||
Changed:=Changed or CodeToolBoss.SetGlobalValue(
|
if CodeToolBoss.SetGlobalValue(ExternalMacroStart+'ProjPath',NewProjectDir)
|
||||||
ExternalMacroStart+'ProjPath',NewProjectDir);
|
then
|
||||||
|
Changed:=true;
|
||||||
if Changed then
|
if Changed then
|
||||||
IncreaseCompilerParseStamp;
|
IncreaseCompilerParseStamp;
|
||||||
end;
|
end;
|
||||||
|
@ -1137,6 +1137,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function GetUsageOptionsList(PackageList: TList): TList;
|
function GetUsageOptionsList(PackageList: TList): TList;
|
||||||
|
// returns a list of TPkgAdditionalCompilerOptions
|
||||||
|
// from the list of TLazPackage
|
||||||
var
|
var
|
||||||
Cnt: Integer;
|
Cnt: Integer;
|
||||||
i: Integer;
|
i: Integer;
|
||||||
@ -2151,7 +2153,6 @@ begin
|
|||||||
FDefineTemplates:=TLazPackageDefineTemplates.Create(Self);
|
FDefineTemplates:=TLazPackageDefineTemplates.Create(Self);
|
||||||
fPublishOptions:=TPublishPackageOptions.Create(Self);
|
fPublishOptions:=TPublishPackageOptions.Create(Self);
|
||||||
Clear;
|
Clear;
|
||||||
FCompilerOptions.ParsedOpts.InvalidateGraphOnChange:=true;
|
|
||||||
FUsageOptions.ParsedOpts.InvalidateGraphOnChange:=true;
|
FUsageOptions.ParsedOpts.InvalidateGraphOnChange:=true;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user