From 586aaa6756ca833fbce5481d850640990d1140ab Mon Sep 17 00:00:00 2001 From: mattias Date: Wed, 26 Jul 2023 10:45:48 +0100 Subject: [PATCH] ide: apply subtarget to packages --- ide/buildmanager.pas | 14 ++++++++++++++ ide/compileroptions.pp | 7 +++++-- ide/lazarusidestrconsts.pas | 1 + 3 files changed, 20 insertions(+), 2 deletions(-) diff --git a/ide/buildmanager.pas b/ide/buildmanager.pas index 18bdfee226..01c51023b3 100644 --- a/ide/buildmanager.pas +++ b/ide/buildmanager.pas @@ -538,6 +538,7 @@ begin tr('LCLWidgetType',lisLCLWidgetType); tr('TargetCPU',lisTargetCPU); tr('TargetOS',lisTargetOS); + tr('SubTarget',lisSubTarget); tr('SrcOS',lisSrcOS); tr('FPCVer',lisFPCVersionEG222); tr('LAZVer',lisLAZVer); @@ -626,6 +627,8 @@ begin Result:=OverrideTargetOS else if SysUtils.CompareText(MacroName,'TargetCPU')=0 then Result:=OverrideTargetCPU + else if SysUtils.CompareText(MacroName,'SubTarget')=0 then + Result:=OverrideSubTarget else if SysUtils.CompareText(MacroName,'LCLWidgetType')=0 then Result:=OverrideLCLWidgetType; end; @@ -637,6 +640,8 @@ begin Result.Values['TargetOS']:=OverrideTargetOS; if OverrideTargetCPU<>'' then Result.Values['TargetCPU']:=OverrideTargetCPU; + if OverrideSubTarget<>'' then + Result.Values['SubTarget']:=OverrideSubTarget; if OverrideLCLWidgetType<>'' then Result.Values['LCLWidgetType']:=OverrideLCLWidgetType; end; @@ -2760,6 +2765,15 @@ function TBuildManager.GetBuildMacroValuesHandler(Options: TBaseCompilerOptions; s:=GetCompiledTargetCPU; end; end; + // SubTarget + if not Values.IsDefined('SubTarget') then begin + s:=''; + if FBuildTarget<>nil then + s:=FBuildTarget.CompilerOptions.SubTarget; + if s='' then + s:=fSubTarget; + Values.Values['SubTarget']:=s; + end; end; procedure ApplyMacroOverrides(Vars: TCTCfgScriptVariables); diff --git a/ide/compileroptions.pp b/ide/compileroptions.pp index d74371030d..df0e10601d 100644 --- a/ide/compileroptions.pp +++ b/ide/compileroptions.pp @@ -2567,6 +2567,7 @@ var Vars: TCTCfgScriptVariables; CurTargetOS: String; CurTargetCPU: String; + CurSubTarget: String; CurSrcOS: String; dit: TCompilerDbgSymbolType; CompilerFilename: String; @@ -2623,6 +2624,7 @@ begin CurTargetOS:=''; CurTargetCPU:=''; + CurSubTarget:=''; if not (ccloNoMacroParams in Flags) then begin Vars:=GetBuildMacroValues(Self,true); @@ -2630,6 +2632,7 @@ begin begin CurTargetOS:=GetFPCTargetOS(Vars.Values['TargetOS']); CurTargetCPU:=GetFPCTargetCPU(Vars.Values['TargetCPU']); + CurSubTarget:=Vars.Values['SubTarget']; end; end; CurSrcOS:=GetDefaultSrcOSForTargetOS(CurTargetOS); @@ -2648,8 +2651,8 @@ begin and ((TargetCPU<>'') or (CurTargetCPU<>DefaultTargetCPU)) then Result.Add('-P' + CurTargetCPU); { SubTarget } - if SubTarget<>'' then - Result.Add('-t'+SubTarget); + if CurSubTarget<>'' then + Result.Add('-t'+CurSubTarget); { TargetProcessor } if TargetProcessor<>'' then Result.Add('-Cp'+UpperCase(TargetProcessor)); diff --git a/ide/lazarusidestrconsts.pas b/ide/lazarusidestrconsts.pas index e08c3db9db..d88f30bf5d 100644 --- a/ide/lazarusidestrconsts.pas +++ b/ide/lazarusidestrconsts.pas @@ -196,6 +196,7 @@ resourcestring lisLCLWidgetType = 'LCL widget type'; lisTargetCPU = 'Target CPU'; lisTargetOS = 'Target OS'; + lisSubTarget = 'SubTarget'; lisSrcOS = 'Src OS'; lisCommandLineParamsOfProgram = 'Command line parameters of program'; lisPromptForValue = 'Prompt for value';