diff --git a/ide/packages/ideconfig/compileroptions.pp b/ide/packages/ideconfig/compileroptions.pp index ced7441c74..18bc490fb5 100644 --- a/ide/packages/ideconfig/compileroptions.pp +++ b/ide/packages/ideconfig/compileroptions.pp @@ -154,6 +154,18 @@ type ); TCompilerCmdLineOptions = set of TCompilerCmdLineOption; +const + CompilerCmdLineOptionNames: array[TCompilerCmdLineOption] of string = ( + 'NoLinkerOpts', + 'AddVerboseAll', + 'DoNotAppendOutFileOption', + 'AbsolutePaths', + 'NoMacroParams', + 'AddCompilerPath' + ); + +type + { TCompilationToolOptions } TCompilationToolOptions = class(TLazCompilationToolOptions) @@ -221,7 +233,7 @@ type function GetEnumerator: TCompilerMsgIDFlagsEnumerator; function GetMsgIdList(Delim: char; aValue: TCompilerFlagValue; FPCMsgFile: TFPCMsgFilePoolItem = nil): string; function CreateDiff(Tool: TCompilerDiffTool; Other: TCompilerMsgIDFlags): boolean; - function Count: SizeInt; inline; + function Count: SizeInt; property ChangeStamp: int64 read FChangeStamp; end; @@ -428,6 +440,8 @@ procedure SaveXMLCompileReasons(const AConfig: TXMLConfig; const APath: String; function EnumToStr(Flag: TCompilerFlagValue): string; overload; function CompareCompMsgIdFlag(Data1, Data2: Pointer): integer; +function dbgs(const Opts: TCompilerCmdLineOptions): string; overload; + var TestCompilerOptions: TNotifyEvent = nil; @@ -757,6 +771,19 @@ begin Result:=0; end; +function dbgs(const Opts: TCompilerCmdLineOptions): string; +var + o: TCompilerCmdLineOption; +begin + Result:=''; + for o in Opts do + begin + if Result<>'' then Result+=','; + Result+=CompilerCmdLineOptionNames[o]; + end; + Result:='['+Result+']'; +end; + { TCompilerMsgIDFlagsEnumerator } function TCompilerMsgIDFlagsEnumerator.GetCurrent: PCompilerMsgIdFlag; @@ -2663,7 +2690,7 @@ begin CurMainSrcFile:=GetDefaultMainSourceFileName; CurTargetFilename:=''; CurTargetDirectory:=''; - //DebugLn(['TBaseCompilerOptions.MakeOptionsString ',DbgSName(Self),' ',ccloDoNotAppendOutFileOption in Flags,' TargetFilename="',TargetFilename,'" CurMainSrcFile="',CurMainSrcFile,'" CurOutputDir="',CurOutputDir,'"']); + DebugLn(['TBaseCompilerOptions.MakeOptionsString ',DbgSName(Self),' ',dbgs(Flags),' TargetFilename="',TargetFilename,'" CurMainSrcFile="',CurMainSrcFile,'" CurOutputDir="',CurOutputDir,'"']); if (not (ccloDoNotAppendOutFileOption in Flags)) and (not (ccloNoMacroParams in Flags)) and ((TargetFilename<>'') or (CurMainSrcFile<>'') or (CurOutputDir<>'')) then diff --git a/ide/showcompileropts.pas b/ide/showcompileropts.pas index ec2e9b32af..e22dac90f1 100644 --- a/ide/showcompileropts.pas +++ b/ide/showcompileropts.pas @@ -295,28 +295,20 @@ end; procedure TShowCompilerOptionsDlg.UpdateMemo; var Flags: TCompilerCmdLineOptions; - CompPath: String; CompOptions: TStringListUTF8Fast; begin if CompilerOpts=nil then exit; // set flags Flags:=CompilerOpts.DefaultMakeOptionsFlags; - Include(Flags, ccloAddCompilerPath); + Include(Flags,ccloAddCompilerPath); if not RelativePathsCheckBox.Checked then Include(Flags,ccloAbsolutePaths); // get command line parameters (include compiler path) CompOptions := CompilerOpts.MakeCompilerParams(Flags); try - // add the main project unit after the compiler path - if (Project1<>nil) and (Project1.MainUnitInfo<>nil) and (CompOptions.Count>0) then - begin - if RelativePathsCheckBox.Checked then - CompOptions.Insert(1, Project1.MainUnitInfo.ShortFilename) - else - CompOptions.Insert(1, Project1.MainUnitInfo.GetFullFilename); - end; + CompOptions.Add(CompilerOpts.CreateTargetFilename); // show FillMemo(CmdLineMemo,CompOptions);