diff --git a/.gitattributes b/.gitattributes index bc0f4fff65..71f6f91960 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4006,6 +4006,7 @@ ideintf/columndlg.pp svneol=native#text/pascal ideintf/componenteditors.pas svneol=native#text/pascal ideintf/componentreg.pas svneol=native#text/pascal ideintf/componenttreeview.pas svneol=native#text/pascal +ideintf/compoptsintf.pas svneol=native#text/plain ideintf/dbpropedits.pas svneol=native#text/pascal ideintf/docs/formeditingintf.xml svneol=native#text/plain ideintf/docs/ideimagesintf.xml svneol=native#text/plain diff --git a/components/codetools/ide/ppulistdlg.lfm b/components/codetools/ide/ppulistdlg.lfm index fb830393eb..c11f265844 100644 --- a/components/codetools/ide/ppulistdlg.lfm +++ b/components/codetools/ide/ppulistdlg.lfm @@ -38,31 +38,36 @@ object PPUListDialog: TPPUListDialog Align = alTop AutoFillColumns = True BorderSpacing.Around = 6 + ColCount = 6 Columns = < item SizePriority = 10 Title.Caption = 'Unit' - Width = 145 + Width = 121 end item SizePriority = 10 Title.Caption = 'Size of .ppu file' - Width = 145 + Width = 121 end item SizePriority = 10 Title.Caption = 'Size of .o file' - Width = 145 + Width = 121 end item SizePriority = 5 Title.Caption = 'Uses' - Width = 145 + Width = 121 end item SizePriority = 5 Title.Caption = 'Used by' - Width = 146 + Width = 121 + end + item + Title.Caption = 'Package' + Width = 121 end> DefaultColWidth = 150 FixedCols = 0 @@ -72,11 +77,12 @@ object PPUListDialog: TPPUListDialog OnMouseDown = UnitsStringGridMouseDown OnSelectCell = UnitsStringGridSelectCell ColWidths = ( - 145 - 145 - 145 - 145 - 146 + 121 + 121 + 121 + 121 + 121 + 121 ) end object ScopeLabel: TLabel @@ -183,14 +189,14 @@ object PPUListDialog: TPPUListDialog Columns = < item Title.Caption = 'Unit' - Width = 714 + Width = 716 end> FixedCols = 0 Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goThumbTracking, goSmoothScroll] TabOrder = 0 OnMouseDown = UnitStringGridMouseDown ColWidths = ( - 714 + 716 ) end end @@ -209,13 +215,13 @@ object PPUListDialog: TPPUListDialog Columns = < item Title.Caption = 'Unit' - Width = 714 + Width = 716 end> FixedCols = 0 TabOrder = 0 OnMouseDown = UnitStringGridMouseDown ColWidths = ( - 714 + 716 ) end end diff --git a/components/codetools/ide/ppulistdlg.pas b/components/codetools/ide/ppulistdlg.pas index 07fb84ba5c..f6b6811eee 100644 --- a/components/codetools/ide/ppulistdlg.pas +++ b/components/codetools/ide/ppulistdlg.pas @@ -35,6 +35,7 @@ uses ComCtrls, // IDEIntf IDECommands, MenuIntf, ProjectIntf, LazIDEIntf, IDEDialogs, IDEWindowIntf, + PackageIntf, // codetools BasicCodeTools, FileProcs, CodyStrConsts, CodeToolManager, CodeCache, PPUParser, PPUCodeTools; @@ -71,6 +72,7 @@ type OFileSize: int64; UsesUnits: TStrings; // =nil means uses section not yet scanned UsedByUnits: TStrings; + PackageName: string; destructor Destroy; override; function UsesCount: integer; function UsedByCount: integer; @@ -120,6 +122,7 @@ type function FindUnit(AnUnitName: string): TPPUListItem; function FindUnitInList(AnUnitName: string; List: TStrings): integer; function FindUnitOfListitem(List: TStrings; Index: integer): TPPUListItem; + function FindPackageOfUnit(Item: TPPUListItem): string; procedure UpdateAll; @@ -258,6 +261,7 @@ var i: Integer; l: Integer; begin + if FItems=nil then exit; Col:=-1; Row:=-1; UnitsStringGrid.MouseToCell(X,Y,Col,Row); @@ -292,6 +296,7 @@ procedure TPPUListDialog.UnitsStringGridSelectCell(Sender: TObject; aCol, var AnUnitName: String; begin + if FItems=nil then exit; if (aRow<2) or (aRow>=UnitsStringGrid.RowCount) then AnUnitName:='' else @@ -307,6 +312,7 @@ var Row: Longint; AnUnitName: string; begin + if FItems=nil then exit; Grid:=TStringGrid(Sender); if Shift=[ssLeft,ssDouble] then begin Col:=0; @@ -354,6 +360,38 @@ begin List.Objects[Index]:=Result; end; +function TPPUListDialog.FindPackageOfUnit(Item: TPPUListItem): string; +var + i: Integer; + Pkg: TIDEPackage; + OutDir: String; + PPUDir: String; +begin + if Item.PackageName='' then begin + if Item.PPUFile<>'' then begin + PPUDir:=ExtractFileName(Item.PPUFile); + + // search in output directories of packages + for i:=0 to PackageEditingInterface.GetPackageCount-1 do begin + Pkg:=PackageEditingInterface.GetPackages(i); + OutDir:=Pkg.LazCompilerOptions.GetUnitOutputDirectory(false); + if (OutDir<>'') and FilenameIsAbsolute(OutDir) + and (CompareFilenames(AppendPathDelim(OutDir),PPUDir)=0) then begin + Item.PackageName:=Pkg.Name; + break; + end; + end; + + // search in FPC unit paths + if Item.PackageName='' then begin + //CodeToolBoss.GetUnitSetIDForDirectory(); + end; + end; + + end; + Result:=Item.PackageName; +end; + procedure TPPUListDialog.UpdateAll; var s: String; @@ -748,15 +786,15 @@ begin Item.UsesUnits:=TStringList.Create; if Item.UsedByUnits=nil then Item.UsedByUnits:=TStringList.Create; - debugln(['TPPUListDialog.OnIdle search used units of ',AnUnitName]); + //debugln(['TPPUListDialog.OnIdle search used units of ',AnUnitName]); // scan for used units Scanned:=false; if Item.PPUFile<>PPUFileNotFound then begin - debugln(['TPPUListDialog.OnIdle search used units of ppu "',Item.PPUFile,'" ...']); + //debugln(['TPPUListDialog.OnIdle search used units of ppu "',Item.PPUFile,'" ...']); PPUTool:=CodeToolBoss.PPUCache.LoadFile(Item.PPUFile, [ppInterfaceHeader,ppImplementationHeader]); if (PPUTool<>nil) and (PPUTool.ErrorMsg='') then begin - debugln(['TPPUListDialog.OnIdle parsed ppu "',Item.PPUFile,'"']); + //debugln(['TPPUListDialog.OnIdle parsed ppu "',Item.PPUFile,'"']); MainUsesSection:=nil; ImplementationUsesSection:=nil; try @@ -822,6 +860,7 @@ begin FSearchingItems.Add(UsedUnit); UsedUnits.Objects[i]:=UsedUnit; UsedUnit.UsedByUnits:=TStringList.Create; + FindPackageOfUnit(UsedUnit); end; if FindUnitInList(AnUnitName,SrcItem.UsesUnits)<0 then diff --git a/ide/buildmanager.pas b/ide/buildmanager.pas index dc29cd2a4e..0bd21f79e9 100644 --- a/ide/buildmanager.pas +++ b/ide/buildmanager.pas @@ -41,7 +41,7 @@ uses CodeToolsCfgScript, Laz_XMLCfg, CodeToolsStructs, // IDEIntf SrcEditorIntf, ProjectIntf, MacroIntf, IDEDialogs, IDEExternToolIntf, - LazIDEIntf, + CompOptsIntf, LazIDEIntf, // IDE LazarusIDEStrConsts, DialogProcs, IDEProcs, CodeToolsOptions, InputHistory, EditDefineTree, ProjectResources, MiscOptions, LazConf, EnvironmentOpts, diff --git a/ide/checkcompoptsfornewunitdlg.pas b/ide/checkcompoptsfornewunitdlg.pas index d89af4ab4f..632a59f7f8 100644 --- a/ide/checkcompoptsfornewunitdlg.pas +++ b/ide/checkcompoptsfornewunitdlg.pas @@ -34,7 +34,7 @@ uses Classes, SysUtils, LCLProc, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, ExtCtrls, CodeToolManager, BasicCodeTools, DefineTemplates, - ProjectIntf, IDEDialogs, + CompOptsIntf, ProjectIntf, IDEDialogs, InputHistory, TransferMacros, Project, LazarusIDEStrConsts; type diff --git a/ide/compileroptions.pp b/ide/compileroptions.pp index f9ceda168a..a3fd5810c4 100644 --- a/ide/compileroptions.pp +++ b/ide/compileroptions.pp @@ -30,17 +30,6 @@ *************************************************************************** ToDo: - - create Makefile: - - create a special .compiled file - - an IDE created with make, without extra options should not recompile a - package with this special .compiled file - - writable package output directory: set it on load package or when output dir changes - - use the same macros to get the same diversity - - use a readonly directory if package is valid - - make synedit a package - - make IDEIntf a package - - make LCL a package - - make FCL a package - when adding/removing search path: do it for all build modes - add unit to project - remove unit from project @@ -49,8 +38,6 @@ - license gpl2 - create package lazbuildsystem with some units - move - - remove TGlobalCompilerOptions - - implement switching active project - i18n for descriptions - keyword help for a build macro @@ -70,7 +57,8 @@ uses Classes, SysUtils, FileProcs, FileUtil, InterfaceBase, LCLProc, Forms, Controls, Laz_XMLCfg, ExprEval, DefineTemplates, CodeToolsCfgScript, // IDEIntf - ProjectIntf, MacroIntf, IDEExternToolIntf, SrcEditorIntf, IDEOptionsIntf, + ProjectIntf, MacroIntf, IDEExternToolIntf, SrcEditorIntf, CompOptsIntf, + IDEOptionsIntf, // IDE LazarusIDEStrConsts, IDEProcs, IDEMsgIntf, LazConf, TransferMacros, CompOptsModes; diff --git a/ide/debugmanager.pas b/ide/debugmanager.pas index 8f1ff846fe..0e258dfda4 100644 --- a/ide/debugmanager.pas +++ b/ide/debugmanager.pas @@ -47,7 +47,7 @@ uses Laz_XMLCfg, SynEdit, CodeCache, CodeToolManager, // IDEIntf IDEWindowIntf, SrcEditorIntf, MenuIntf, IDECommands, LazIDEIntf, ProjectIntf, - IDEDialogs, + CompOptsIntf, IDEDialogs, // IDE LazConf, CompilerOptions, EditorOptions, EnvironmentOpts, KeyMapping, SourceEditor, ProjectDefs, Project, IDEProcs, InputHistory, Debugger, diff --git a/ide/environmentopts.pp b/ide/environmentopts.pp index 65ea37cac1..0f97c6fa92 100644 --- a/ide/environmentopts.pp +++ b/ide/environmentopts.pp @@ -41,7 +41,7 @@ uses Laz_XMLCfg, LazConfigStorage, // IDEIntf ProjectIntf, ObjectInspector, IDEWindowIntf, IDEOptionsIntf, - IDEExternToolIntf, + CompOptsIntf, IDEExternToolIntf, // IDE IDEProcs, LazarusIDEStrConsts, IDETranslations, LazConf, IDEOptionDefs, TransferMacros, Debugger; diff --git a/ide/exttooldialog.pas b/ide/exttooldialog.pas index 1424cb1712..d02d3a4deb 100644 --- a/ide/exttooldialog.pas +++ b/ide/exttooldialog.pas @@ -43,7 +43,7 @@ uses Buttons, StdCtrls, ComCtrls, Dialogs, ExtCtrls, ButtonPanel, LazConfigStorage, FileUtil, UTF8Process, IDEExternToolIntf, IDEImagesIntf, IDEDialogs, IDEHelpIntf, IDECommands, - ProjectIntf, + CompOptsIntf, ProjectIntf, EnvironmentOpts, ExtToolEditDlg, KeyMapping, TransferMacros, IDEProcs, InfoBuild, CompilerOptions, OutputFilter, LazarusIDEStrConsts; diff --git a/ide/frames/buildmodeseditor.pas b/ide/frames/buildmodeseditor.pas index a9ed211424..79da085d30 100644 --- a/ide/frames/buildmodeseditor.pas +++ b/ide/frames/buildmodeseditor.pas @@ -33,7 +33,7 @@ uses Math, Classes, SysUtils, LCLProc, Controls, FileUtil, Forms, Grids, Graphics, Menus, ComCtrls, Dialogs, AvgLvlTree, DefineTemplates, StdCtrls, GraphMath, ExtCtrls, Buttons, - ProjectIntf, IDEImagesIntf, IDEOptionsIntf, + ProjectIntf, IDEImagesIntf, IDEOptionsIntf, CompOptsIntf, PackageDefs, compiler_inherited_options, TransferMacros, PathEditorDlg, Project, PackageSystem, LazarusIDEStrConsts, CompilerOptions, IDEProcs, BuildModeDiffDlg; diff --git a/ide/frames/compiler_compilation_options.pas b/ide/frames/compiler_compilation_options.pas index a3d0c2226c..5897a56920 100644 --- a/ide/frames/compiler_compilation_options.pas +++ b/ide/frames/compiler_compilation_options.pas @@ -7,7 +7,7 @@ interface uses Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, IDEOptionsIntf, Project, CompilerOptions, LazarusIDEStrConsts, - ProjectIntf, PackageDefs; + ProjectIntf, CompOptsIntf, PackageDefs; type diff --git a/ide/frames/compiler_inherited_options.pas b/ide/frames/compiler_inherited_options.pas index 863d84f8b0..fffb5f6246 100644 --- a/ide/frames/compiler_inherited_options.pas +++ b/ide/frames/compiler_inherited_options.pas @@ -38,7 +38,7 @@ interface uses Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, ComCtrls, ExtCtrls, - CodeToolsCfgScript, IDEOptionsIntf, IDEImagesIntf, ProjectIntf, + CodeToolsCfgScript, IDEOptionsIntf, IDEImagesIntf, ProjectIntf, CompOptsIntf, Project, CompilerOptions, LazarusIDEStrConsts, IDEProcs; type diff --git a/ide/main.pp b/ide/main.pp index 4379c6bb06..de80190cc7 100644 --- a/ide/main.pp +++ b/ide/main.pp @@ -74,7 +74,7 @@ uses IDEIntf, BaseIDEIntf, ObjectInspector, PropEdits, PropEditUtils, MacroIntf, IDECommands, IDEWindowIntf, SrcEditorIntf, NewItemIntf, IDEExternToolIntf, IDEMsgIntf, - PackageIntf, ProjectIntf, MenuIntf, LazIDEIntf, IDEDialogs, + PackageIntf, ProjectIntf, CompOptsIntf, MenuIntf, LazIDEIntf, IDEDialogs, IDEOptionsIntf, IDEImagesIntf, // protocol IDEProtocol, diff --git a/ide/mainintf.pas b/ide/mainintf.pas index e16b6a7c25..051233d2c8 100644 --- a/ide/mainintf.pas +++ b/ide/mainintf.pas @@ -65,7 +65,7 @@ uses CodeCache, AVL_Tree, SynEditKeyCmds, // IDE PropEdits, ObjectInspector, MenuIntf, SrcEditorIntf, ProjectIntf, MacroIntf, - LazIDEIntf, + CompOptsIntf, LazIDEIntf, LazConf, LazarusIDEStrConsts, ProjectDefs, Project, PublishModule, BuildLazDialog, Compiler, ComponentReg, diff --git a/ide/project.pp b/ide/project.pp index 7a1b836589..ed95c98012 100644 --- a/ide/project.pp +++ b/ide/project.pp @@ -54,7 +54,7 @@ uses Laz_XMLCfg, CodeToolsConfig, ExprEval, FileProcs, DefineTemplates, CodeToolsCfgScript, CodeToolManager, CodeCache, // IDEIntf - ProjectIntf, MacroIntf, LazIDEIntf, + CompOptsIntf, ProjectIntf, MacroIntf, LazIDEIntf, // IDE CompOptsModes, ProjectResources, LazConf, LazarusIDEStrConsts, CompilerOptions, diff --git a/ide/projectdefs.pas b/ide/projectdefs.pas index 7db2afaabc..3290c5d1bb 100644 --- a/ide/projectdefs.pas +++ b/ide/projectdefs.pas @@ -39,7 +39,7 @@ interface uses Classes, SysUtils, Laz_XMLCfg, Controls, Forms, SynRegExpr, FileProcs, LCLProc, - ProjectIntf, PublishModule, LazIDEIntf, + CompOptsIntf, ProjectIntf, PublishModule, LazIDEIntf, frmCustomApplicationOptions, IDEProcs, LazarusIDEStrConsts; type diff --git a/ide/projectresources.pas b/ide/projectresources.pas index 1ce34f9f5b..c15141a32a 100644 --- a/ide/projectresources.pas +++ b/ide/projectresources.pas @@ -38,10 +38,12 @@ interface uses Classes, SysUtils, Contnrs, Controls, LCLProc, LResources, FileUtil, Laz_XMLCfg, - Dialogs, ProjectIntf, ProjectResourcesIntf, LazarusIDEStrConsts, AvgLvlTree, - KeywordFuncLists, BasicCodeTools, IDEProcs, DialogProcs, CodeToolManager, - CodeCache, resource, reswriter, - W32Manifest,W32VersionInfo,ProjectIcon; + Dialogs, AvgLvlTree, resource, reswriter, + KeywordFuncLists, BasicCodeTools, CodeToolManager, CodeCache, + ProjectIntf, ProjectResourcesIntf, CompOptsIntf, + LazarusIDEStrConsts, + IDEProcs, DialogProcs, + W32Manifest, W32VersionInfo, ProjectIcon; type { TProjectResources } diff --git a/ide/w32versioninfo.pas b/ide/w32versioninfo.pas index 340dbabb1b..428f351447 100644 --- a/ide/w32versioninfo.pas +++ b/ide/w32versioninfo.pas @@ -44,7 +44,7 @@ uses {$ELSE} Laz_DOM, {$ENDIF} - IDEProcs, ProjectIntf, + IDEProcs, ProjectIntf, CompOptsIntf, ProjectResourcesIntf, resource, versionresource, versiontypes; type diff --git a/ideintf/compoptsintf.pas b/ideintf/compoptsintf.pas new file mode 100644 index 0000000000..cd35f5e176 --- /dev/null +++ b/ideintf/compoptsintf.pas @@ -0,0 +1,876 @@ +{ + ***************************************************************************** + * * + * See the file COPYING.modifiedLGPL.txt, included in this distribution, * + * for details about the copyright. * + * * + * This program is distributed in the hope that it will be useful, * + * but WITHOUT ANY WARRANTY; without even the implied warranty of * + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * + * * + ***************************************************************************** + + Author: Mattias Gaertner + + Abstract: + IDE interface to the IDE compiler options. +} +unit CompOptsIntf; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils, LCLProc, + IDEOptionsIntf; + +type + + { TLazBuildMacro + Every package/project can define build macros. A build macro has a name, + a description, a list of possible values and a default value. + The default value can be an expression using other build macros. + The IDE defines basic macros like TargetOS and TargetCPU. + The LCL package defines the macro LCLWidgetType. } + + TLazBuildMacro = class + protected + FDefaultValue: string; + FIdentifier: string; + FDescription: string; + FValueDescriptions: TStrings; + FValues: TStrings; + procedure SetIdentifier(const AValue: string); virtual; abstract; + procedure SetDescription(const AValue: string); virtual; abstract; + procedure SetValueDescriptions(const AValue: TStrings); virtual; abstract; + procedure SetValues(const AValue: TStrings); virtual; abstract; + public + procedure Assign(Source: TLazBuildMacro); virtual; abstract; + property Identifier: string read FIdentifier write SetIdentifier; + property Description: string read FDescription write SetDescription; + property Values: TStrings read FValues write SetValues; + property ValueDescriptions: TStrings read FValueDescriptions write SetValueDescriptions; + end; + + { TLazBuildMacros + The list of build macros of a package/project. + They are stored in the compiler options. } + + TLazBuildMacros = class + private + FOwner: TObject; + protected + function GetItems(Index: integer): TLazBuildMacro; virtual; abstract; + public + constructor Create(TheOwner: TObject); virtual; + function Add(Identifier: string): TLazBuildMacro; virtual; abstract; + procedure Delete(Index: integer); virtual; abstract; + procedure Move(OldIndex, NewIndex: integer); virtual; abstract; + function IndexOfIdentifier(Identifier: string): integer; virtual; abstract; + function VarWithIdentifier(Identifier: string): TLazBuildMacro; virtual; abstract; + function Count: integer; virtual; abstract; + procedure Clear; virtual; abstract; + property Items[Index: integer]: TLazBuildMacro read GetItems; default; + property Owner: TObject read FOwner; + end; + + { TLazCompilerOptions } + + TCompilationExecutableType = ( + cetProgram, + cetLibrary + ); + + TCompileReason = ( + crCompile, // normal build current project/package + crBuild, // build all + crRun // quick build before run + ); + TCompileReasons = set of TCompileReason; +const + crAll = [crCompile, crBuild, crRun]; + +type + { TLazCompilerOptions } + + TLazCompilerOptions = class(TAbstractIDECompilerOptions) + private + FOnModified: TNotifyEvent; + fOwner: TObject; + SetEmulatedFloatOpcodes: boolean; + procedure SetAllowLabel(const AValue: Boolean); + procedure SetAssemblerStyle(const AValue: Integer); + procedure SetCMacros(const AValue: Boolean); + procedure SetConfigFilePath(const AValue: String); + procedure SetCPPInline(const AValue: Boolean); + procedure SetCStyleOp(const AValue: Boolean); + procedure SetCustomConfigFile(const AValue: Boolean); + procedure SetDontUseConfigFile(const AValue: Boolean); + procedure SetExecutableType(const AValue: TCompilationExecutableType); + procedure SetGenDebugInfo(const AValue: Boolean); + procedure SetGenerateDwarf(const AValue: Boolean); + procedure SetGenGProfCode(const AValue: Boolean); + procedure SetHeapSize(const AValue: Integer); + procedure SetIncludeAssertionCode(const AValue: Boolean); + procedure SetInitConst(const AValue: Boolean); + procedure SetIOChecks(const AValue: Boolean); + procedure SetLinkSmart(const AValue: Boolean); + procedure SetOptLevel(const AValue: Integer); + procedure SetOverflowChecks(const AValue: Boolean); + procedure SetPassLinkerOpt(const AValue: Boolean); + procedure SetRangeChecks(const AValue: Boolean); + procedure SetShowAll(const AValue: Boolean); + procedure SetShowAllProcsOnError(const AValue: Boolean); + procedure SetShowCompProc(const AValue: Boolean); + procedure SetShowCond(const AValue: Boolean); + procedure SetShowDebugInfo(const AValue: Boolean); + procedure SetShowDefMacros(const AValue: Boolean); + procedure SetShowErrors(const AValue: Boolean); + procedure SetShowExecInfo(const AValue: Boolean); + procedure SetShowGenInfo(const AValue: Boolean); + procedure SetShowHints(const AValue: Boolean); + procedure SetShowHintsForSenderNotUsed(const AValue: Boolean); + procedure SetShowHintsForUnusedUnitsInMainSrc(const AValue: Boolean); + procedure SetShowLineNum(const AValue: Boolean); + procedure SetShowNotes(const AValue: Boolean); + procedure SetShowNothing(const AValue: Boolean); + procedure SetShowSummary(const AValue: Boolean); + procedure SetShowTriedFiles(const AValue: Boolean); + procedure SetShowUsedFiles(const AValue: Boolean); + procedure SetShowWarn(const AValue: Boolean); + procedure SetSmallerCode(const AValue: boolean); + procedure SetSmartLinkUnit(const AValue: Boolean); + procedure SetStackChecks(const AValue: Boolean); + procedure SetStaticKeyword(const AValue: Boolean); + procedure SetStopAfterErrCount(const AValue: integer); + procedure SetStripSymbols(const AValue: Boolean); + procedure SetSyntaxMode(const AValue: string); + procedure SetTargetFilenameAppplyConventions(const AValue: boolean); + procedure SetUncertainOpt(const AValue: Boolean); + procedure SetUseAnsiStr(const AValue: Boolean); + procedure SetUseExternalDbgSyms(const AValue: Boolean); + procedure SetUseHeaptrc(const AValue: Boolean); + procedure SetUseLineInfoUnit(const AValue: Boolean); + procedure SetUseValgrind(const AValue: Boolean); + procedure SetVarsInReg(const AValue: Boolean); + procedure SetVerifyObjMethodCall(const AValue: boolean); + procedure SetWin32GraphicApp(const AValue: boolean); + procedure SetWriteFPCLogo(const AValue: Boolean); + protected + FChangeStamp: int64; + FSavedChangeStamp: int64; + fOnChanged: TMethodList; + + // Paths: + + // conditionals / build modes + FConditionals: string; + fBuildMacros: TLazBuildMacros; + fLCLWidgetType: string; + + // Parsing: + // assembler style + fAssemblerStyle: Integer; + + // syntax options + FSyntaxMode: string; + fCStyleOp: Boolean; + fIncludeAssertionCode: Boolean; + fAllowLabel: Boolean; + fUseAnsiStr: Boolean; + fCPPInline: Boolean; + fCMacros: Boolean; + fInitConst: Boolean; + fStaticKeyword: Boolean; + + // Code generation: + fSmartLinkUnit: Boolean; + fIOChecks: Boolean; + fRangeChecks: Boolean; + fOverflowChecks: Boolean; + fStackChecks: Boolean; + FEmulatedFloatOpcodes: boolean; + fHeapSize: LongInt; + fVerifyObjMethodCall: boolean; + FSmallerCode: boolean; + fTargetProc: string; + fTargetCPU: string; + fVarsInReg: Boolean; + fUncertainOpt: Boolean; + fOptLevel: Integer; + fTargetOS: String; + + // Linking: + fGenDebugInfo: Boolean; + fUseLineInfoUnit: Boolean; + FGenerateDwarf: Boolean; + fUseHeaptrc: Boolean; + fUseValgrind: Boolean; + fGenGProfCode: Boolean; + fStripSymbols: Boolean; + fLinkSmart: Boolean; + fPassLinkerOpt: Boolean; + fLinkerOptions: String; + FWin32GraphicApp: boolean; + FExecutableType: TCompilationExecutableType; + FUseExternalDbgSyms : Boolean; + fTargetFilename: string; + FTargetFilenameAppplyConventions: boolean; + + // Messages: + fShowErrors: Boolean; + fShowWarn: Boolean; + fShowNotes: Boolean; + fShowHints: Boolean; + fShowGenInfo: Boolean; + fShowLineNum: Boolean; + fShowAll: Boolean; + fShowAllProcsOnError: Boolean; + fShowDebugInfo: Boolean; + fShowUsedFiles: Boolean; + fShowTriedFiles: Boolean; + fShowDefMacros: Boolean; + fShowCompProc: Boolean; + fShowCond: Boolean; + fShowExecInfo: Boolean; + fShowNothing: Boolean; + fShowSummary: Boolean; + fShowHintsForUnusedUnitsInMainSrc: Boolean; + fShowHintsForSenderNotUsed: Boolean; + fWriteFPCLogo: Boolean; + fStopAfterErrCount: integer; + + // Other: + fDontUseConfigFile: Boolean; + fCustomConfigFile: Boolean; + fConfigFilePath: String; + protected + function GetCustomOptions: string; virtual; abstract; + function GetDebugPath: string; virtual; abstract; + function GetIncludePaths: String; virtual; abstract; + function GetLibraryPaths: String; virtual; abstract; + function GetModified: boolean; virtual; + function GetObjectPath: string; virtual; abstract; + function GetSrcPath: string; virtual; abstract; + function GetUnitOutputDir: string; virtual; abstract; + function GetUnitPaths: String; virtual; abstract; + procedure SetCompilerPath(const AValue: String); virtual; abstract; + procedure SetConditionals(const AValue: string); virtual; abstract; + procedure SetCustomOptions(const AValue: string); virtual; abstract; + procedure SetDebugPath(const AValue: string); virtual; abstract; + procedure SetIncludePaths(const AValue: String); virtual; abstract; + procedure SetLibraryPaths(const AValue: String); virtual; abstract; + procedure SetLinkerOptions(const AValue: String); virtual; abstract; + procedure SetModified(const AValue: boolean); virtual; abstract; + procedure SetObjectPath(const AValue: string); virtual; abstract; + procedure SetSrcPath(const AValue: string); virtual; abstract; + procedure SetTargetCPU(const AValue: string); virtual; abstract; + procedure SetTargetFilename(const AValue: String); virtual; abstract; + procedure SetTargetOS(const AValue: string); virtual; abstract; + procedure SetTargetProc(const AValue: string); virtual; abstract; + procedure SetUnitOutputDir(const AValue: string); virtual; abstract; + procedure SetUnitPaths(const AValue: String); virtual; abstract; + procedure SetLCLWidgetType(const AValue: string); virtual; + public + constructor Create(const TheOwner: TObject); virtual; + destructor Destroy; override; + function IsActive: boolean; virtual; + function TrimCustomOptions(o: string): string; virtual; abstract; + function CreatePPUFilename(const SourceFileName: string): string; virtual; abstract; + function GetUnitOutputDirectory(RelativeToBaseDir: boolean): string; virtual; abstract; + public + property Owner: TObject read fOwner write fOwner; + property Modified: boolean read GetModified write SetModified; + property OnModified: TNotifyEvent read FOnModified write FOnModified; + property ChangeStamp: int64 read FChangeStamp; + procedure IncreaseChangeStamp; + class function InvalidChangeStamp: int64; + procedure AddOnChangedHandler(const Handler: TNotifyEvent); + procedure RemoveOnChangedHandler(const Handler: TNotifyEvent); + + // search paths: + property IncludePath: String read GetIncludePaths write SetIncludePaths; // alias IncPath + property Libraries: String read GetLibraryPaths write SetLibraryPaths; // alias LibraryPath + property OtherUnitFiles: String read GetUnitPaths write SetUnitPaths; // alias UnitPath + property ObjectPath: string read GetObjectPath write SetObjectPath; + property SrcPath: string read GetSrcPath write SetSrcPath; // alias SrcPath + property DebugPath: string read GetDebugPath write SetDebugPath; + property UnitOutputDirectory: string read GetUnitOutputDir write SetUnitOutputDir; + + // conditional / build modes + property Conditionals: string read FConditionals write SetConditionals; + property BuildMacros: TLazBuildMacros read fBuildMacros; + // Beware: eventually LCLWidgetType will be replaced by a more generic solution + property LCLWidgetType: string read fLCLWidgetType write SetLCLWidgetType; + + // target: + property TargetFilename: String read fTargetFilename write SetTargetFilename; + property TargetFilenameAppplyConventions: boolean read FTargetFilenameAppplyConventions write SetTargetFilenameAppplyConventions; + + // parsing: + property SyntaxMode: string read FSyntaxMode write SetSyntaxMode; + property AssemblerStyle: Integer read fAssemblerStyle write SetAssemblerStyle; + property CStyleOperators: Boolean read fCStyleOp write SetCStyleOp; + property IncludeAssertionCode: Boolean + read fIncludeAssertionCode write SetIncludeAssertionCode; + property AllowLabel: Boolean read fAllowLabel write SetAllowLabel; + property UseAnsiStrings: Boolean read fUseAnsiStr write SetUseAnsiStr; + property CPPInline: Boolean read fCPPInline write SetCPPInline; + property CStyleMacros: Boolean read fCMacros write SetCMacros; + property InitConstructor: Boolean read fInitConst write SetInitConst; + property StaticKeyword: Boolean read fStaticKeyword write SetStaticKeyword; + + // code generation: + property IOChecks: Boolean read fIOChecks write SetIOChecks; + property RangeChecks: Boolean read fRangeChecks write SetRangeChecks; + property OverflowChecks: Boolean read fOverflowChecks write SetOverflowChecks; + property StackChecks: Boolean read fStackChecks write SetStackChecks; + property SmartLinkUnit: Boolean read fSmartLinkUnit write SetSmartLinkUnit; + property EmulatedFloatOpcodes: boolean read SetEmulatedFloatOpcodes + write SetEmulatedFloatOpcodes; + property HeapSize: Integer read fHeapSize write SetHeapSize; + property VerifyObjMethodCall: boolean read FVerifyObjMethodCall + write SetVerifyObjMethodCall; + property SmallerCode: boolean read FSmallerCode write SetSmallerCode; + property TargetCPU: string read fTargetCPU write SetTargetCPU; // general type + property TargetProcessor: String read fTargetProc write SetTargetProc; // specific + property TargetOS: string read fTargetOS write SetTargetOS; + property VariablesInRegisters: Boolean read fVarsInReg write SetVarsInReg; + property UncertainOptimizations: Boolean read fUncertainOpt write SetUncertainOpt; + property OptimizationLevel: Integer read fOptLevel write SetOptLevel; + + // linking: + property GenerateDebugInfo: Boolean read fGenDebugInfo write SetGenDebugInfo; + property UseLineInfoUnit: Boolean read fUseLineInfoUnit write SetUseLineInfoUnit; + property GenerateDwarf: Boolean read FGenerateDwarf write SetGenerateDwarf; + property UseHeaptrc: Boolean read fUseHeaptrc write SetUseHeaptrc; + property UseValgrind: Boolean read fUseValgrind write SetUseValgrind; + property GenGProfCode: Boolean read fGenGProfCode write SetGenGProfCode; + property StripSymbols: Boolean read fStripSymbols write SetStripSymbols; + property LinkSmart: Boolean read fLinkSmart write SetLinkSmart; + property PassLinkerOptions: Boolean read fPassLinkerOpt write SetPassLinkerOpt; + property LinkerOptions: String read fLinkerOptions write SetLinkerOptions; + property Win32GraphicApp: boolean read FWin32GraphicApp write SetWin32GraphicApp; + property ExecutableType: TCompilationExecutableType + read FExecutableType write SetExecutableType; + property UseExternalDbgSyms: Boolean read FUseExternalDbgSyms write SetUseExternalDbgSyms; + + // messages: + property ShowErrors: Boolean read fShowErrors write SetShowErrors; + property ShowWarn: Boolean read fShowWarn write SetShowWarn; + property ShowNotes: Boolean read fShowNotes write SetShowNotes; + property ShowHints: Boolean read fShowHints write SetShowHints; + property ShowGenInfo: Boolean read fShowGenInfo write SetShowGenInfo; + property ShowLineNum: Boolean read fShowLineNum write SetShowLineNum; + property ShowAll: Boolean read fShowAll write SetShowAll; + property ShowAllProcsOnError: Boolean + read fShowAllProcsOnError write SetShowAllProcsOnError; + property ShowDebugInfo: Boolean read fShowDebugInfo write SetShowDebugInfo; + property ShowUsedFiles: Boolean read fShowUsedFiles write SetShowUsedFiles; + property ShowTriedFiles: Boolean read fShowTriedFiles write SetShowTriedFiles; + property ShowDefMacros: Boolean read fShowDefMacros write SetShowDefMacros; + property ShowCompProc: Boolean read fShowCompProc write SetShowCompProc; + property ShowCond: Boolean read fShowCond write SetShowCond; + property ShowExecInfo: Boolean read fShowExecInfo write SetShowExecInfo; + property ShowNothing: Boolean read fShowNothing write SetShowNothing; + property ShowSummary: Boolean read FShowSummary write SetShowSummary; + property ShowHintsForUnusedUnitsInMainSrc: Boolean + read fShowHintsForUnusedUnitsInMainSrc write SetShowHintsForUnusedUnitsInMainSrc; + property ShowHintsForSenderNotUsed: Boolean + read fShowHintsForSenderNotUsed write SetShowHintsForSenderNotUsed; + property WriteFPCLogo: Boolean read fWriteFPCLogo write SetWriteFPCLogo; + property StopAfterErrCount: integer + read fStopAfterErrCount write SetStopAfterErrCount; + + // other + property DontUseConfigFile: Boolean read fDontUseConfigFile + write SetDontUseConfigFile; + property CustomConfigFile: Boolean read fCustomConfigFile + write SetCustomConfigFile; + property ConfigFilePath: String read fConfigFilePath write SetConfigFilePath; + property CustomOptions: string read GetCustomOptions write SetCustomOptions; + end; + +implementation + +{ TLazBuildMacros } + +constructor TLazBuildMacros.Create(TheOwner: TObject); +begin + FOwner:=TheOwner +end; + +{ TLazCompilerOptions } + +procedure TLazCompilerOptions.SetLCLWidgetType(const AValue: string); +begin + if AValue=LCLWidgetType then exit; + fLCLWidgetType:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetLinkSmart(const AValue: Boolean); +begin + if fLinkSmart=AValue then exit; + fLinkSmart:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetOptLevel(const AValue: Integer); +begin + if fOptLevel=AValue then exit; + fOptLevel:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetOverflowChecks(const AValue: Boolean); +begin + if fOverflowChecks=AValue then exit; + fOverflowChecks:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetPassLinkerOpt(const AValue: Boolean); +begin + if fPassLinkerOpt=AValue then exit; + fPassLinkerOpt:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetRangeChecks(const AValue: Boolean); +begin + if fRangeChecks=AValue then exit; + fRangeChecks:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetShowAll(const AValue: Boolean); +begin + if fShowAll=AValue then exit; + fShowAll:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetShowAllProcsOnError(const AValue: Boolean); +begin + if fShowAllProcsOnError=AValue then exit; + fShowAllProcsOnError:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetShowCompProc(const AValue: Boolean); +begin + if fShowCompProc=AValue then exit; + fShowCompProc:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetShowCond(const AValue: Boolean); +begin + if fShowCond=AValue then exit; + fShowCond:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetShowDebugInfo(const AValue: Boolean); +begin + if fShowDebugInfo=AValue then exit; + fShowDebugInfo:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetShowDefMacros(const AValue: Boolean); +begin + if fShowDefMacros=AValue then exit; + fShowDefMacros:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetShowErrors(const AValue: Boolean); +begin + if fShowErrors=AValue then exit; + fShowErrors:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetShowExecInfo(const AValue: Boolean); +begin + if fShowExecInfo=AValue then exit; + fShowExecInfo:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetShowGenInfo(const AValue: Boolean); +begin + if fShowGenInfo=AValue then exit; + fShowGenInfo:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetShowHints(const AValue: Boolean); +begin + if fShowHints=AValue then exit; + fShowHints:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetShowHintsForSenderNotUsed(const AValue: Boolean + ); +begin + if fShowHintsForSenderNotUsed=AValue then exit; + fShowHintsForSenderNotUsed:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetShowHintsForUnusedUnitsInMainSrc( + const AValue: Boolean); +begin + if fShowHintsForUnusedUnitsInMainSrc=AValue then exit; + fShowHintsForUnusedUnitsInMainSrc:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetShowLineNum(const AValue: Boolean); +begin + if fShowLineNum=AValue then exit; + fShowLineNum:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetShowNotes(const AValue: Boolean); +begin + if fShowNotes=AValue then exit; + fShowNotes:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetShowNothing(const AValue: Boolean); +begin + if fShowNothing=AValue then exit; + fShowNothing:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetShowSummary(const AValue: Boolean); +begin + if FShowSummary=AValue then exit; + FShowSummary:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetShowTriedFiles(const AValue: Boolean); +begin + if fShowTriedFiles=AValue then exit; + fShowTriedFiles:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetShowUsedFiles(const AValue: Boolean); +begin + if fShowUsedFiles=AValue then exit; + fShowUsedFiles:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetShowWarn(const AValue: Boolean); +begin + if fShowWarn=AValue then exit; + fShowWarn:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetSmallerCode(const AValue: boolean); +begin + if FSmallerCode=AValue then exit; + FSmallerCode:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetSmartLinkUnit(const AValue: Boolean); +begin + if fSmartLinkUnit=AValue then exit; + fSmartLinkUnit:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetStackChecks(const AValue: Boolean); +begin + if fStackChecks=AValue then exit; + fStackChecks:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetAllowLabel(const AValue: Boolean); +begin + if fAllowLabel=AValue then exit; + fAllowLabel:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetAssemblerStyle(const AValue: Integer); +begin + if fAssemblerStyle=AValue then exit; + fAssemblerStyle:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetCMacros(const AValue: Boolean); +begin + if fCMacros=AValue then exit; + fCMacros:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetConfigFilePath(const AValue: String); +begin + if fConfigFilePath=AValue then exit; + fConfigFilePath:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetCPPInline(const AValue: Boolean); +begin + if fCPPInline=AValue then exit; + fCPPInline:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetCStyleOp(const AValue: Boolean); +begin + if fCStyleOp=AValue then exit; + fCStyleOp:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetCustomConfigFile(const AValue: Boolean); +begin + if fCustomConfigFile=AValue then exit; + fCustomConfigFile:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetDontUseConfigFile(const AValue: Boolean); +begin + if fDontUseConfigFile=AValue then exit; + fDontUseConfigFile:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetExecutableType( + const AValue: TCompilationExecutableType); +begin + if FExecutableType=AValue then exit; + FExecutableType:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetGenDebugInfo(const AValue: Boolean); +begin + if fGenDebugInfo=AValue then exit; + fGenDebugInfo:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetGenerateDwarf(const AValue: Boolean); +begin + if FGenerateDwarf=AValue then exit; + FGenerateDwarf:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetGenGProfCode(const AValue: Boolean); +begin + if fGenGProfCode=AValue then exit; + fGenGProfCode:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetHeapSize(const AValue: Integer); +begin + if fHeapSize=AValue then exit; + fHeapSize:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetIncludeAssertionCode(const AValue: Boolean); +begin + if fIncludeAssertionCode=AValue then exit; + fIncludeAssertionCode:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetInitConst(const AValue: Boolean); +begin + if fInitConst=AValue then exit; + fInitConst:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetIOChecks(const AValue: Boolean); +begin + if fIOChecks=AValue then exit; + fIOChecks:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetStaticKeyword(const AValue: Boolean); +begin + if fStaticKeyword=AValue then exit; + fStaticKeyword:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetStopAfterErrCount(const AValue: integer); +begin + if fStopAfterErrCount=AValue then exit; + fStopAfterErrCount:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetStripSymbols(const AValue: Boolean); +begin + if fStripSymbols=AValue then exit; + fStripSymbols:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetSyntaxMode(const AValue: string); +begin + if FSyntaxMode=AValue then exit; + FSyntaxMode:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetTargetFilenameAppplyConventions( + const AValue: boolean); +begin + if FTargetFilenameAppplyConventions=AValue then exit; + FTargetFilenameAppplyConventions:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetUncertainOpt(const AValue: Boolean); +begin + if fUncertainOpt=AValue then exit; + fUncertainOpt:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetUseAnsiStr(const AValue: Boolean); +begin + if fUseAnsiStr=AValue then exit; + fUseAnsiStr:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetUseExternalDbgSyms(const AValue: Boolean); +begin + if FUseExternalDbgSyms=AValue then exit; + FUseExternalDbgSyms:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetUseHeaptrc(const AValue: Boolean); +begin + if fUseHeaptrc=AValue then exit; + fUseHeaptrc:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetUseLineInfoUnit(const AValue: Boolean); +begin + if fUseLineInfoUnit=AValue then exit; + fUseLineInfoUnit:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetUseValgrind(const AValue: Boolean); +begin + if fUseValgrind=AValue then exit; + fUseValgrind:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetVarsInReg(const AValue: Boolean); +begin + if fVarsInReg=AValue then exit; + fVarsInReg:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetVerifyObjMethodCall(const AValue: boolean); +begin + if FVerifyObjMethodCall=AValue then exit; + FVerifyObjMethodCall:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetWin32GraphicApp(const AValue: boolean); +begin + if FWin32GraphicApp=AValue then exit; + FWin32GraphicApp:=AValue; + IncreaseChangeStamp; +end; + +procedure TLazCompilerOptions.SetWriteFPCLogo(const AValue: Boolean); +begin + if fWriteFPCLogo=AValue then exit; + fWriteFPCLogo:=AValue; + IncreaseChangeStamp; +end; + +function TLazCompilerOptions.GetModified: boolean; +begin + Result:=(FSavedChangeStamp=InvalidChangeStamp) + or (FSavedChangeStamp<>FChangeStamp); +end; + +constructor TLazCompilerOptions.Create(const TheOwner: TObject); +begin + inherited Create; + fOnChanged:=TMethodList.Create; + FChangeStamp:=InvalidChangeStamp; + FSavedChangeStamp:=FChangeStamp; + FTargetFilenameAppplyConventions:=true; + FOwner := TheOwner; +end; + +destructor TLazCompilerOptions.Destroy; +begin + FreeAndNil(fOnChanged); + inherited Destroy; +end; + +function TLazCompilerOptions.IsActive: boolean; +begin + Result:=false; +end; + +procedure TLazCompilerOptions.IncreaseChangeStamp; +begin + if fChangeStampnil then fOnChanged.CallNotifyEvents(Self); +end; + +class function TLazCompilerOptions.InvalidChangeStamp: int64; +begin + Result:=Low(int64); +end; + +procedure TLazCompilerOptions.AddOnChangedHandler(const Handler: TNotifyEvent); +begin + fOnChanged.Add(TMethod(Handler)); +end; + +procedure TLazCompilerOptions.RemoveOnChangedHandler(const Handler: TNotifyEvent + ); +begin + fOnChanged.Remove(TMethod(Handler)); +end; + +end. + diff --git a/ideintf/ideintf.lpk b/ideintf/ideintf.lpk index f2d09f09a3..dbb761572f 100644 --- a/ideintf/ideintf.lpk +++ b/ideintf/ideintf.lpk @@ -5,7 +5,7 @@ - + @@ -22,7 +22,7 @@ - + @@ -292,6 +292,10 @@ + + + + diff --git a/ideintf/ideintf.pas b/ideintf/ideintf.pas index 0aec56c87b..e4176a95f7 100644 --- a/ideintf/ideintf.pas +++ b/ideintf/ideintf.pas @@ -7,7 +7,7 @@ unit IDEIntf; interface uses - ActionsEditor, ActionsEditorStd, BaseIDEIntf, CheckGroupEditorDlg, + ActionsEditor, ActionsEditorStd, BaseIDEIntf, CheckGroupEditorDlg, CheckListboxEditorDlg, CollectionPropEditForm, ColumnDlg, ComponentEditors, ComponentReg, ComponentTreeView, DBPropEdits, fieldseditor, fieldslist, FormEditingIntf, frmSelectProps, GraphicPropEdit, GraphPropEdits, @@ -18,7 +18,8 @@ uses newfield, NewItemIntf, ObjectInspector, ObjInspStrConsts, OIFavouriteProperties, PackageIntf, ProjectIntf, ProjectResourcesIntf, PropEdits, PropEditUtils, SrcEditorIntf, StatusBarPropEdit, - StringsPropEditDlg, TextTools, TreeViewPropEdit, LazarusPackageIntf; + StringsPropEditDlg, TextTools, TreeViewPropEdit, CompOptsIntf, + LazarusPackageIntf; implementation diff --git a/ideintf/lazideintf.pas b/ideintf/lazideintf.pas index e0b6ca8779..ae8725642b 100644 --- a/ideintf/lazideintf.pas +++ b/ideintf/lazideintf.pas @@ -23,7 +23,7 @@ interface uses Classes, SysUtils, LCLProc, Forms, Controls, Dialogs, PropEdits, LazHelpHTML, - IDEExternToolIntf, IDEOptionsIntf, ProjectIntf, SrcEditorIntf, LDockCtrl; + IDEExternToolIntf, IDEOptionsIntf, CompOptsIntf, ProjectIntf, SrcEditorIntf; type // open file flags diff --git a/ideintf/packageintf.pas b/ideintf/packageintf.pas index c38a466ab4..c182e12977 100644 --- a/ideintf/packageintf.pas +++ b/ideintf/packageintf.pas @@ -23,7 +23,8 @@ unit PackageIntf; interface uses - Classes, SysUtils, LCLProc, Forms, LazConfigStorage, NewItemIntf, IDEOptionsIntf, AvgLvlTree; + Classes, SysUtils, LCLProc, Forms, LazConfigStorage, AvgLvlTree, + NewItemIntf, CompOptsIntf, IDEOptionsIntf; const PkgDescGroupName = 'Package'; @@ -117,6 +118,7 @@ type FCustomOptions: TConfigStorage; FFilename: string; FChangeStamp: integer; + FLazCompilerOptions: TLazCompilerOptions; function GetDirectoryExpanded: string; virtual; abstract; function GetFileCount: integer; virtual; abstract; function GetPkgFiles(Index: integer): TLazPackageFile; virtual; abstract; @@ -141,6 +143,7 @@ type property Files[Index: integer]: TLazPackageFile read GetPkgFiles; property RemovedFilesCount: integer read GetRemovedCount; property RemovedFiles[Index: integer]: TLazPackageFile read GetRemovedPkgFiles; + property LazCompilerOptions: TLazCompilerOptions read FLazCompilerOptions; end; type diff --git a/ideintf/projectintf.pas b/ideintf/projectintf.pas index 8802f19ef1..2ac46908da 100644 --- a/ideintf/projectintf.pas +++ b/ideintf/projectintf.pas @@ -23,7 +23,7 @@ interface uses Classes, SysUtils, LCLProc, FileUtil, Controls, Forms, AvgLvlTree, - NewItemIntf, ObjInspStrConsts, IDEOptionsIntf; + NewItemIntf, ObjInspStrConsts, IDEOptionsIntf, CompOptsIntf; const FileDescGroupName = 'File'; @@ -50,374 +50,6 @@ type rtRes // fpc resources ); -type - - { TLazBuildMacro - Every package/project can define build macros. A build macro has a name, - a description, a list of possible values and a default value. - The default value can be an expression using other build macros. - The IDE defines basic macros like TargetOS and TargetCPU. - The LCL package defines the macro LCLWidgetType. } - - TLazBuildMacro = class - protected - FDefaultValue: string; - FIdentifier: string; - FDescription: string; - FValueDescriptions: TStrings; - FValues: TStrings; - procedure SetIdentifier(const AValue: string); virtual; abstract; - procedure SetDescription(const AValue: string); virtual; abstract; - procedure SetValueDescriptions(const AValue: TStrings); virtual; abstract; - procedure SetValues(const AValue: TStrings); virtual; abstract; - public - procedure Assign(Source: TLazBuildMacro); virtual; abstract; - property Identifier: string read FIdentifier write SetIdentifier; - property Description: string read FDescription write SetDescription; - property Values: TStrings read FValues write SetValues; - property ValueDescriptions: TStrings read FValueDescriptions write SetValueDescriptions; - end; - - { TLazBuildMacros - The list of build macros of a package/project. - They are stored in the compiler options. } - - TLazBuildMacros = class - private - FOwner: TObject; - protected - function GetItems(Index: integer): TLazBuildMacro; virtual; abstract; - public - constructor Create(TheOwner: TObject); virtual; - function Add(Identifier: string): TLazBuildMacro; virtual; abstract; - procedure Delete(Index: integer); virtual; abstract; - procedure Move(OldIndex, NewIndex: integer); virtual; abstract; - function IndexOfIdentifier(Identifier: string): integer; virtual; abstract; - function VarWithIdentifier(Identifier: string): TLazBuildMacro; virtual; abstract; - function Count: integer; virtual; abstract; - procedure Clear; virtual; abstract; - property Items[Index: integer]: TLazBuildMacro read GetItems; default; - property Owner: TObject read FOwner; - end; - - { TLazCompilerOptions } - - TCompilationExecutableType = ( - cetProgram, - cetLibrary - ); - - TCompileReason = ( - crCompile, // normal build current project/package - crBuild, // build all - crRun // quick build before run - ); - TCompileReasons = set of TCompileReason; -const - crAll = [crCompile, crBuild, crRun]; - -type - { TLazCompilerOptions } - - TLazCompilerOptions = class(TAbstractIDECompilerOptions) - private - FOnModified: TNotifyEvent; - fOwner: TObject; - SetEmulatedFloatOpcodes: boolean; - procedure SetAllowLabel(const AValue: Boolean); - procedure SetAssemblerStyle(const AValue: Integer); - procedure SetCMacros(const AValue: Boolean); - procedure SetConfigFilePath(const AValue: String); - procedure SetCPPInline(const AValue: Boolean); - procedure SetCStyleOp(const AValue: Boolean); - procedure SetCustomConfigFile(const AValue: Boolean); - procedure SetDontUseConfigFile(const AValue: Boolean); - procedure SetExecutableType(const AValue: TCompilationExecutableType); - procedure SetGenDebugInfo(const AValue: Boolean); - procedure SetGenerateDwarf(const AValue: Boolean); - procedure SetGenGProfCode(const AValue: Boolean); - procedure SetHeapSize(const AValue: Integer); - procedure SetIncludeAssertionCode(const AValue: Boolean); - procedure SetInitConst(const AValue: Boolean); - procedure SetIOChecks(const AValue: Boolean); - procedure SetLinkSmart(const AValue: Boolean); - procedure SetOptLevel(const AValue: Integer); - procedure SetOverflowChecks(const AValue: Boolean); - procedure SetPassLinkerOpt(const AValue: Boolean); - procedure SetRangeChecks(const AValue: Boolean); - procedure SetShowAll(const AValue: Boolean); - procedure SetShowAllProcsOnError(const AValue: Boolean); - procedure SetShowCompProc(const AValue: Boolean); - procedure SetShowCond(const AValue: Boolean); - procedure SetShowDebugInfo(const AValue: Boolean); - procedure SetShowDefMacros(const AValue: Boolean); - procedure SetShowErrors(const AValue: Boolean); - procedure SetShowExecInfo(const AValue: Boolean); - procedure SetShowGenInfo(const AValue: Boolean); - procedure SetShowHints(const AValue: Boolean); - procedure SetShowHintsForSenderNotUsed(const AValue: Boolean); - procedure SetShowHintsForUnusedUnitsInMainSrc(const AValue: Boolean); - procedure SetShowLineNum(const AValue: Boolean); - procedure SetShowNotes(const AValue: Boolean); - procedure SetShowNothing(const AValue: Boolean); - procedure SetShowSummary(const AValue: Boolean); - procedure SetShowTriedFiles(const AValue: Boolean); - procedure SetShowUsedFiles(const AValue: Boolean); - procedure SetShowWarn(const AValue: Boolean); - procedure SetSmallerCode(const AValue: boolean); - procedure SetSmartLinkUnit(const AValue: Boolean); - procedure SetStackChecks(const AValue: Boolean); - procedure SetStaticKeyword(const AValue: Boolean); - procedure SetStopAfterErrCount(const AValue: integer); - procedure SetStripSymbols(const AValue: Boolean); - procedure SetSyntaxMode(const AValue: string); - procedure SetTargetFilenameAppplyConventions(const AValue: boolean); - procedure SetUncertainOpt(const AValue: Boolean); - procedure SetUseAnsiStr(const AValue: Boolean); - procedure SetUseExternalDbgSyms(const AValue: Boolean); - procedure SetUseHeaptrc(const AValue: Boolean); - procedure SetUseLineInfoUnit(const AValue: Boolean); - procedure SetUseValgrind(const AValue: Boolean); - procedure SetVarsInReg(const AValue: Boolean); - procedure SetVerifyObjMethodCall(const AValue: boolean); - procedure SetWin32GraphicApp(const AValue: boolean); - procedure SetWriteFPCLogo(const AValue: Boolean); - protected - FChangeStamp: int64; - FSavedChangeStamp: int64; - fOnChanged: TMethodList; - - // Paths: - - // conditionals / build modes - FConditionals: string; - fBuildMacros: TLazBuildMacros; - fLCLWidgetType: string; - - // Parsing: - // assembler style - fAssemblerStyle: Integer; - - // syntax options - FSyntaxMode: string; - fCStyleOp: Boolean; - fIncludeAssertionCode: Boolean; - fAllowLabel: Boolean; - fUseAnsiStr: Boolean; - fCPPInline: Boolean; - fCMacros: Boolean; - fInitConst: Boolean; - fStaticKeyword: Boolean; - - // Code generation: - fSmartLinkUnit: Boolean; - fIOChecks: Boolean; - fRangeChecks: Boolean; - fOverflowChecks: Boolean; - fStackChecks: Boolean; - FEmulatedFloatOpcodes: boolean; - fHeapSize: LongInt; - fVerifyObjMethodCall: boolean; - FSmallerCode: boolean; - fTargetProc: string; - fTargetCPU: string; - fVarsInReg: Boolean; - fUncertainOpt: Boolean; - fOptLevel: Integer; - fTargetOS: String; - - // Linking: - fGenDebugInfo: Boolean; - fUseLineInfoUnit: Boolean; - FGenerateDwarf: Boolean; - fUseHeaptrc: Boolean; - fUseValgrind: Boolean; - fGenGProfCode: Boolean; - fStripSymbols: Boolean; - fLinkSmart: Boolean; - fPassLinkerOpt: Boolean; - fLinkerOptions: String; - FWin32GraphicApp: boolean; - FExecutableType: TCompilationExecutableType; - FUseExternalDbgSyms : Boolean; - fTargetFilename: string; - FTargetFilenameAppplyConventions: boolean; - - // Messages: - fShowErrors: Boolean; - fShowWarn: Boolean; - fShowNotes: Boolean; - fShowHints: Boolean; - fShowGenInfo: Boolean; - fShowLineNum: Boolean; - fShowAll: Boolean; - fShowAllProcsOnError: Boolean; - fShowDebugInfo: Boolean; - fShowUsedFiles: Boolean; - fShowTriedFiles: Boolean; - fShowDefMacros: Boolean; - fShowCompProc: Boolean; - fShowCond: Boolean; - fShowExecInfo: Boolean; - fShowNothing: Boolean; - fShowSummary: Boolean; - fShowHintsForUnusedUnitsInMainSrc: Boolean; - fShowHintsForSenderNotUsed: Boolean; - fWriteFPCLogo: Boolean; - fStopAfterErrCount: integer; - - // Other: - fDontUseConfigFile: Boolean; - fCustomConfigFile: Boolean; - fConfigFilePath: String; - protected - function GetCustomOptions: string; virtual; abstract; - function GetDebugPath: string; virtual; abstract; - function GetIncludePaths: String; virtual; abstract; - function GetLibraryPaths: String; virtual; abstract; - function GetModified: boolean; virtual; - function GetObjectPath: string; virtual; abstract; - function GetSrcPath: string; virtual; abstract; - function GetUnitOutputDir: string; virtual; abstract; - function GetUnitPaths: String; virtual; abstract; - procedure SetCompilerPath(const AValue: String); virtual; abstract; - procedure SetConditionals(const AValue: string); virtual; abstract; - procedure SetCustomOptions(const AValue: string); virtual; abstract; - procedure SetDebugPath(const AValue: string); virtual; abstract; - procedure SetIncludePaths(const AValue: String); virtual; abstract; - procedure SetLibraryPaths(const AValue: String); virtual; abstract; - procedure SetLinkerOptions(const AValue: String); virtual; abstract; - procedure SetModified(const AValue: boolean); virtual; abstract; - procedure SetObjectPath(const AValue: string); virtual; abstract; - procedure SetSrcPath(const AValue: string); virtual; abstract; - procedure SetTargetCPU(const AValue: string); virtual; abstract; - procedure SetTargetFilename(const AValue: String); virtual; abstract; - procedure SetTargetOS(const AValue: string); virtual; abstract; - procedure SetTargetProc(const AValue: string); virtual; abstract; - procedure SetUnitOutputDir(const AValue: string); virtual; abstract; - procedure SetUnitPaths(const AValue: String); virtual; abstract; - procedure SetLCLWidgetType(const AValue: string); virtual; - public - constructor Create(const TheOwner: TObject); virtual; - destructor Destroy; override; - function IsActive: boolean; virtual; - function TrimCustomOptions(o: string): string; virtual; abstract; - function CreatePPUFilename(const SourceFileName: string): string; virtual; abstract; - function GetUnitOutputDirectory(RelativeToBaseDir: boolean): string; virtual; abstract; - public - property Owner: TObject read fOwner write fOwner; - property Modified: boolean read GetModified write SetModified; - property OnModified: TNotifyEvent read FOnModified write FOnModified; - property ChangeStamp: int64 read FChangeStamp; - procedure IncreaseChangeStamp; - class function InvalidChangeStamp: int64; - procedure AddOnChangedHandler(const Handler: TNotifyEvent); - procedure RemoveOnChangedHandler(const Handler: TNotifyEvent); - - // search paths: - property IncludePath: String read GetIncludePaths write SetIncludePaths; // alias IncPath - property Libraries: String read GetLibraryPaths write SetLibraryPaths; // alias LibraryPath - property OtherUnitFiles: String read GetUnitPaths write SetUnitPaths; // alias UnitPath - property ObjectPath: string read GetObjectPath write SetObjectPath; - property SrcPath: string read GetSrcPath write SetSrcPath; // alias SrcPath - property DebugPath: string read GetDebugPath write SetDebugPath; - property UnitOutputDirectory: string read GetUnitOutputDir write SetUnitOutputDir; - - // conditional / build modes - property Conditionals: string read FConditionals write SetConditionals; - property BuildMacros: TLazBuildMacros read fBuildMacros; - // Beware: eventually LCLWidgetType will be replaced by a more generic solution - property LCLWidgetType: string read fLCLWidgetType write SetLCLWidgetType; - - // target: - property TargetFilename: String read fTargetFilename write SetTargetFilename; - property TargetFilenameAppplyConventions: boolean read FTargetFilenameAppplyConventions write SetTargetFilenameAppplyConventions; - - // parsing: - property SyntaxMode: string read FSyntaxMode write SetSyntaxMode; - property AssemblerStyle: Integer read fAssemblerStyle write SetAssemblerStyle; - property CStyleOperators: Boolean read fCStyleOp write SetCStyleOp; - property IncludeAssertionCode: Boolean - read fIncludeAssertionCode write SetIncludeAssertionCode; - property AllowLabel: Boolean read fAllowLabel write SetAllowLabel; - property UseAnsiStrings: Boolean read fUseAnsiStr write SetUseAnsiStr; - property CPPInline: Boolean read fCPPInline write SetCPPInline; - property CStyleMacros: Boolean read fCMacros write SetCMacros; - property InitConstructor: Boolean read fInitConst write SetInitConst; - property StaticKeyword: Boolean read fStaticKeyword write SetStaticKeyword; - - // code generation: - property IOChecks: Boolean read fIOChecks write SetIOChecks; - property RangeChecks: Boolean read fRangeChecks write SetRangeChecks; - property OverflowChecks: Boolean read fOverflowChecks write SetOverflowChecks; - property StackChecks: Boolean read fStackChecks write SetStackChecks; - property SmartLinkUnit: Boolean read fSmartLinkUnit write SetSmartLinkUnit; - property EmulatedFloatOpcodes: boolean read SetEmulatedFloatOpcodes - write SetEmulatedFloatOpcodes; - property HeapSize: Integer read fHeapSize write SetHeapSize; - property VerifyObjMethodCall: boolean read FVerifyObjMethodCall - write SetVerifyObjMethodCall; - property SmallerCode: boolean read FSmallerCode write SetSmallerCode; - property TargetCPU: string read fTargetCPU write SetTargetCPU; // general type - property TargetProcessor: String read fTargetProc write SetTargetProc; // specific - property TargetOS: string read fTargetOS write SetTargetOS; - property VariablesInRegisters: Boolean read fVarsInReg write SetVarsInReg; - property UncertainOptimizations: Boolean read fUncertainOpt write SetUncertainOpt; - property OptimizationLevel: Integer read fOptLevel write SetOptLevel; - - // linking: - property GenerateDebugInfo: Boolean read fGenDebugInfo write SetGenDebugInfo; - property UseLineInfoUnit: Boolean read fUseLineInfoUnit write SetUseLineInfoUnit; - property GenerateDwarf: Boolean read FGenerateDwarf write SetGenerateDwarf; - property UseHeaptrc: Boolean read fUseHeaptrc write SetUseHeaptrc; - property UseValgrind: Boolean read fUseValgrind write SetUseValgrind; - property GenGProfCode: Boolean read fGenGProfCode write SetGenGProfCode; - property StripSymbols: Boolean read fStripSymbols write SetStripSymbols; - property LinkSmart: Boolean read fLinkSmart write SetLinkSmart; - property PassLinkerOptions: Boolean read fPassLinkerOpt write SetPassLinkerOpt; - property LinkerOptions: String read fLinkerOptions write SetLinkerOptions; - property Win32GraphicApp: boolean read FWin32GraphicApp write SetWin32GraphicApp; - property ExecutableType: TCompilationExecutableType - read FExecutableType write SetExecutableType; - property UseExternalDbgSyms: Boolean read FUseExternalDbgSyms write SetUseExternalDbgSyms; - - // messages: - property ShowErrors: Boolean read fShowErrors write SetShowErrors; - property ShowWarn: Boolean read fShowWarn write SetShowWarn; - property ShowNotes: Boolean read fShowNotes write SetShowNotes; - property ShowHints: Boolean read fShowHints write SetShowHints; - property ShowGenInfo: Boolean read fShowGenInfo write SetShowGenInfo; - property ShowLineNum: Boolean read fShowLineNum write SetShowLineNum; - property ShowAll: Boolean read fShowAll write SetShowAll; - property ShowAllProcsOnError: Boolean - read fShowAllProcsOnError write SetShowAllProcsOnError; - property ShowDebugInfo: Boolean read fShowDebugInfo write SetShowDebugInfo; - property ShowUsedFiles: Boolean read fShowUsedFiles write SetShowUsedFiles; - property ShowTriedFiles: Boolean read fShowTriedFiles write SetShowTriedFiles; - property ShowDefMacros: Boolean read fShowDefMacros write SetShowDefMacros; - property ShowCompProc: Boolean read fShowCompProc write SetShowCompProc; - property ShowCond: Boolean read fShowCond write SetShowCond; - property ShowExecInfo: Boolean read fShowExecInfo write SetShowExecInfo; - property ShowNothing: Boolean read fShowNothing write SetShowNothing; - property ShowSummary: Boolean read FShowSummary write SetShowSummary; - property ShowHintsForUnusedUnitsInMainSrc: Boolean - read fShowHintsForUnusedUnitsInMainSrc write SetShowHintsForUnusedUnitsInMainSrc; - property ShowHintsForSenderNotUsed: Boolean - read fShowHintsForSenderNotUsed write SetShowHintsForSenderNotUsed; - property WriteFPCLogo: Boolean read fWriteFPCLogo write SetWriteFPCLogo; - property StopAfterErrCount: integer - read fStopAfterErrCount write SetStopAfterErrCount; - - // other - property DontUseConfigFile: Boolean read fDontUseConfigFile - write SetDontUseConfigFile; - property CustomConfigFile: Boolean read fCustomConfigFile - write SetCustomConfigFile; - property ConfigFilePath: String read fConfigFilePath write SetConfigFilePath; - property CustomOptions: string read GetCustomOptions write SetCustomOptions; - end; - - { TLazProjectFile } TLazProjectFile = class(TPersistent) @@ -1416,477 +1048,6 @@ begin inherited Destroy; end; -{ TLazCompilerOptions } - -procedure TLazCompilerOptions.SetLCLWidgetType(const AValue: string); -begin - if AValue=LCLWidgetType then exit; - fLCLWidgetType:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetLinkSmart(const AValue: Boolean); -begin - if fLinkSmart=AValue then exit; - fLinkSmart:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetOptLevel(const AValue: Integer); -begin - if fOptLevel=AValue then exit; - fOptLevel:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetOverflowChecks(const AValue: Boolean); -begin - if fOverflowChecks=AValue then exit; - fOverflowChecks:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetPassLinkerOpt(const AValue: Boolean); -begin - if fPassLinkerOpt=AValue then exit; - fPassLinkerOpt:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetRangeChecks(const AValue: Boolean); -begin - if fRangeChecks=AValue then exit; - fRangeChecks:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetShowAll(const AValue: Boolean); -begin - if fShowAll=AValue then exit; - fShowAll:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetShowAllProcsOnError(const AValue: Boolean); -begin - if fShowAllProcsOnError=AValue then exit; - fShowAllProcsOnError:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetShowCompProc(const AValue: Boolean); -begin - if fShowCompProc=AValue then exit; - fShowCompProc:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetShowCond(const AValue: Boolean); -begin - if fShowCond=AValue then exit; - fShowCond:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetShowDebugInfo(const AValue: Boolean); -begin - if fShowDebugInfo=AValue then exit; - fShowDebugInfo:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetShowDefMacros(const AValue: Boolean); -begin - if fShowDefMacros=AValue then exit; - fShowDefMacros:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetShowErrors(const AValue: Boolean); -begin - if fShowErrors=AValue then exit; - fShowErrors:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetShowExecInfo(const AValue: Boolean); -begin - if fShowExecInfo=AValue then exit; - fShowExecInfo:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetShowGenInfo(const AValue: Boolean); -begin - if fShowGenInfo=AValue then exit; - fShowGenInfo:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetShowHints(const AValue: Boolean); -begin - if fShowHints=AValue then exit; - fShowHints:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetShowHintsForSenderNotUsed(const AValue: Boolean - ); -begin - if fShowHintsForSenderNotUsed=AValue then exit; - fShowHintsForSenderNotUsed:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetShowHintsForUnusedUnitsInMainSrc( - const AValue: Boolean); -begin - if fShowHintsForUnusedUnitsInMainSrc=AValue then exit; - fShowHintsForUnusedUnitsInMainSrc:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetShowLineNum(const AValue: Boolean); -begin - if fShowLineNum=AValue then exit; - fShowLineNum:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetShowNotes(const AValue: Boolean); -begin - if fShowNotes=AValue then exit; - fShowNotes:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetShowNothing(const AValue: Boolean); -begin - if fShowNothing=AValue then exit; - fShowNothing:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetShowSummary(const AValue: Boolean); -begin - if FShowSummary=AValue then exit; - FShowSummary:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetShowTriedFiles(const AValue: Boolean); -begin - if fShowTriedFiles=AValue then exit; - fShowTriedFiles:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetShowUsedFiles(const AValue: Boolean); -begin - if fShowUsedFiles=AValue then exit; - fShowUsedFiles:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetShowWarn(const AValue: Boolean); -begin - if fShowWarn=AValue then exit; - fShowWarn:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetSmallerCode(const AValue: boolean); -begin - if FSmallerCode=AValue then exit; - FSmallerCode:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetSmartLinkUnit(const AValue: Boolean); -begin - if fSmartLinkUnit=AValue then exit; - fSmartLinkUnit:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetStackChecks(const AValue: Boolean); -begin - if fStackChecks=AValue then exit; - fStackChecks:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetAllowLabel(const AValue: Boolean); -begin - if fAllowLabel=AValue then exit; - fAllowLabel:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetAssemblerStyle(const AValue: Integer); -begin - if fAssemblerStyle=AValue then exit; - fAssemblerStyle:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetCMacros(const AValue: Boolean); -begin - if fCMacros=AValue then exit; - fCMacros:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetConfigFilePath(const AValue: String); -begin - if fConfigFilePath=AValue then exit; - fConfigFilePath:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetCPPInline(const AValue: Boolean); -begin - if fCPPInline=AValue then exit; - fCPPInline:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetCStyleOp(const AValue: Boolean); -begin - if fCStyleOp=AValue then exit; - fCStyleOp:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetCustomConfigFile(const AValue: Boolean); -begin - if fCustomConfigFile=AValue then exit; - fCustomConfigFile:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetDontUseConfigFile(const AValue: Boolean); -begin - if fDontUseConfigFile=AValue then exit; - fDontUseConfigFile:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetExecutableType( - const AValue: TCompilationExecutableType); -begin - if FExecutableType=AValue then exit; - FExecutableType:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetGenDebugInfo(const AValue: Boolean); -begin - if fGenDebugInfo=AValue then exit; - fGenDebugInfo:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetGenerateDwarf(const AValue: Boolean); -begin - if FGenerateDwarf=AValue then exit; - FGenerateDwarf:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetGenGProfCode(const AValue: Boolean); -begin - if fGenGProfCode=AValue then exit; - fGenGProfCode:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetHeapSize(const AValue: Integer); -begin - if fHeapSize=AValue then exit; - fHeapSize:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetIncludeAssertionCode(const AValue: Boolean); -begin - if fIncludeAssertionCode=AValue then exit; - fIncludeAssertionCode:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetInitConst(const AValue: Boolean); -begin - if fInitConst=AValue then exit; - fInitConst:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetIOChecks(const AValue: Boolean); -begin - if fIOChecks=AValue then exit; - fIOChecks:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetStaticKeyword(const AValue: Boolean); -begin - if fStaticKeyword=AValue then exit; - fStaticKeyword:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetStopAfterErrCount(const AValue: integer); -begin - if fStopAfterErrCount=AValue then exit; - fStopAfterErrCount:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetStripSymbols(const AValue: Boolean); -begin - if fStripSymbols=AValue then exit; - fStripSymbols:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetSyntaxMode(const AValue: string); -begin - if FSyntaxMode=AValue then exit; - FSyntaxMode:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetTargetFilenameAppplyConventions( - const AValue: boolean); -begin - if FTargetFilenameAppplyConventions=AValue then exit; - FTargetFilenameAppplyConventions:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetUncertainOpt(const AValue: Boolean); -begin - if fUncertainOpt=AValue then exit; - fUncertainOpt:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetUseAnsiStr(const AValue: Boolean); -begin - if fUseAnsiStr=AValue then exit; - fUseAnsiStr:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetUseExternalDbgSyms(const AValue: Boolean); -begin - if FUseExternalDbgSyms=AValue then exit; - FUseExternalDbgSyms:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetUseHeaptrc(const AValue: Boolean); -begin - if fUseHeaptrc=AValue then exit; - fUseHeaptrc:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetUseLineInfoUnit(const AValue: Boolean); -begin - if fUseLineInfoUnit=AValue then exit; - fUseLineInfoUnit:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetUseValgrind(const AValue: Boolean); -begin - if fUseValgrind=AValue then exit; - fUseValgrind:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetVarsInReg(const AValue: Boolean); -begin - if fVarsInReg=AValue then exit; - fVarsInReg:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetVerifyObjMethodCall(const AValue: boolean); -begin - if FVerifyObjMethodCall=AValue then exit; - FVerifyObjMethodCall:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetWin32GraphicApp(const AValue: boolean); -begin - if FWin32GraphicApp=AValue then exit; - FWin32GraphicApp:=AValue; - IncreaseChangeStamp; -end; - -procedure TLazCompilerOptions.SetWriteFPCLogo(const AValue: Boolean); -begin - if fWriteFPCLogo=AValue then exit; - fWriteFPCLogo:=AValue; - IncreaseChangeStamp; -end; - -function TLazCompilerOptions.GetModified: boolean; -begin - Result:=(FSavedChangeStamp=InvalidChangeStamp) - or (FSavedChangeStamp<>FChangeStamp); -end; - -constructor TLazCompilerOptions.Create(const TheOwner: TObject); -begin - inherited Create; - fOnChanged:=TMethodList.Create; - FChangeStamp:=InvalidChangeStamp; - FSavedChangeStamp:=FChangeStamp; - FTargetFilenameAppplyConventions:=true; - FOwner := TheOwner; -end; - -destructor TLazCompilerOptions.Destroy; -begin - FreeAndNil(fOnChanged); - inherited Destroy; -end; - -function TLazCompilerOptions.IsActive: boolean; -begin - Result:=false; -end; - -procedure TLazCompilerOptions.IncreaseChangeStamp; -begin - if fChangeStampnil then fOnChanged.CallNotifyEvents(Self); -end; - -class function TLazCompilerOptions.InvalidChangeStamp: int64; -begin - Result:=Low(int64); -end; - -procedure TLazCompilerOptions.AddOnChangedHandler(const Handler: TNotifyEvent); -begin - fOnChanged.Add(TMethod(Handler)); -end; - -procedure TLazCompilerOptions.RemoveOnChangedHandler(const Handler: TNotifyEvent - ); -begin - fOnChanged.Remove(TMethod(Handler)); -end; - { TNewItemProjectFile } function TNewItemProjectFile.LocalizedName: string; @@ -1925,13 +1086,6 @@ begin FDescriptor:=TNewItemProject(Source).Descriptor; end; -{ TLazBuildMacros } - -constructor TLazBuildMacros.Create(TheOwner: TObject); -begin - FOwner:=TheOwner -end; - initialization ProjectFileDescriptors:=nil; diff --git a/ideintf/projectresourcesintf.pas b/ideintf/projectresourcesintf.pas index 79c406fe61..90129a3d6a 100644 --- a/ideintf/projectresourcesintf.pas +++ b/ideintf/projectresourcesintf.pas @@ -17,7 +17,7 @@ unit ProjectResourcesIntf; interface uses - Classes, SysUtils, ProjectIntf, resource; + Classes, SysUtils, CompOptsIntf, ProjectIntf, resource; type TAbstractProjectResources = class; diff --git a/packager/packagedefs.pas b/packager/packagedefs.pas index d957df6a06..7db7210d98 100644 --- a/packager/packagedefs.pas +++ b/packager/packagedefs.pas @@ -2473,6 +2473,7 @@ begin FMacros.MarkUnhandledMacros:=false; FMacros.OnSubstitution:=@OnMacroListSubstitution; FCompilerOptions:=TPkgCompilerOptions.Create(Self); + FLazCompilerOptions:=FCompilerOptions; FCompilerOptions.ParsedOpts.InvalidateParseOnChange:=true; FCompilerOptions.ParsedOpts.OnLocalSubstitute:=@SubstitutePkgMacros; FCompilerOptions.DefaultMakeOptionsFlags:=[ccloNoLinkerOpts]; diff --git a/packager/packagesystem.pas b/packager/packagesystem.pas index 8412a3e17a..c6f8286973 100644 --- a/packager/packagesystem.pas +++ b/packager/packagesystem.pas @@ -54,7 +54,7 @@ uses CodeToolManager, // IDEIntf, SrcEditorIntf, IDEExternToolIntf, IDEDialogs, IDEMsgIntf, PackageIntf, - LazIDEIntf, + CompOptsIntf, LazIDEIntf, // package registration LazarusPackageIntf, // IDE diff --git a/packager/pkgmanager.pas b/packager/pkgmanager.pas index 16c887aa0c..c6388db261 100644 --- a/packager/pkgmanager.pas +++ b/packager/pkgmanager.pas @@ -50,7 +50,7 @@ uses CodeToolsCfgScript, CodeToolsConfig, CodeToolManager, CodeCache, BasicCodeTools, FileProcs, Laz_XMLCfg, // IDE Interface - SrcEditorIntf, NewItemIntf, ProjectIntf, PackageIntf, + SrcEditorIntf, NewItemIntf, ProjectIntf, PackageIntf, CompOptsIntf, MenuIntf, IDEWindowIntf, PropEdits, MacroIntf, LazIDEIntf, // IDE LazConf, LazarusIDEStrConsts, IDEProcs, ObjectLists, DialogProcs, IDECommands,