IDEIntf: moved compiler options to unit of its own (compoptsintf.pas), added access to compiler options of packages

git-svn-id: trunk@29523 -
This commit is contained in:
mattias 2011-02-13 13:42:19 +00:00
parent ac062467ca
commit 2755108d9c
28 changed files with 979 additions and 904 deletions

1
.gitattributes vendored
View File

@ -4006,6 +4006,7 @@ ideintf/columndlg.pp svneol=native#text/pascal
ideintf/componenteditors.pas svneol=native#text/pascal ideintf/componenteditors.pas svneol=native#text/pascal
ideintf/componentreg.pas svneol=native#text/pascal ideintf/componentreg.pas svneol=native#text/pascal
ideintf/componenttreeview.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/dbpropedits.pas svneol=native#text/pascal
ideintf/docs/formeditingintf.xml svneol=native#text/plain ideintf/docs/formeditingintf.xml svneol=native#text/plain
ideintf/docs/ideimagesintf.xml svneol=native#text/plain ideintf/docs/ideimagesintf.xml svneol=native#text/plain

View File

@ -38,31 +38,36 @@ object PPUListDialog: TPPUListDialog
Align = alTop Align = alTop
AutoFillColumns = True AutoFillColumns = True
BorderSpacing.Around = 6 BorderSpacing.Around = 6
ColCount = 6
Columns = < Columns = <
item item
SizePriority = 10 SizePriority = 10
Title.Caption = 'Unit' Title.Caption = 'Unit'
Width = 145 Width = 121
end end
item item
SizePriority = 10 SizePriority = 10
Title.Caption = 'Size of .ppu file' Title.Caption = 'Size of .ppu file'
Width = 145 Width = 121
end end
item item
SizePriority = 10 SizePriority = 10
Title.Caption = 'Size of .o file' Title.Caption = 'Size of .o file'
Width = 145 Width = 121
end end
item item
SizePriority = 5 SizePriority = 5
Title.Caption = 'Uses' Title.Caption = 'Uses'
Width = 145 Width = 121
end end
item item
SizePriority = 5 SizePriority = 5
Title.Caption = 'Used by' Title.Caption = 'Used by'
Width = 146 Width = 121
end
item
Title.Caption = 'Package'
Width = 121
end> end>
DefaultColWidth = 150 DefaultColWidth = 150
FixedCols = 0 FixedCols = 0
@ -72,11 +77,12 @@ object PPUListDialog: TPPUListDialog
OnMouseDown = UnitsStringGridMouseDown OnMouseDown = UnitsStringGridMouseDown
OnSelectCell = UnitsStringGridSelectCell OnSelectCell = UnitsStringGridSelectCell
ColWidths = ( ColWidths = (
145 121
145 121
145 121
145 121
146 121
121
) )
end end
object ScopeLabel: TLabel object ScopeLabel: TLabel
@ -183,14 +189,14 @@ object PPUListDialog: TPPUListDialog
Columns = < Columns = <
item item
Title.Caption = 'Unit' Title.Caption = 'Unit'
Width = 714 Width = 716
end> end>
FixedCols = 0 FixedCols = 0
Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goThumbTracking, goSmoothScroll] Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goThumbTracking, goSmoothScroll]
TabOrder = 0 TabOrder = 0
OnMouseDown = UnitStringGridMouseDown OnMouseDown = UnitStringGridMouseDown
ColWidths = ( ColWidths = (
714 716
) )
end end
end end
@ -209,13 +215,13 @@ object PPUListDialog: TPPUListDialog
Columns = < Columns = <
item item
Title.Caption = 'Unit' Title.Caption = 'Unit'
Width = 714 Width = 716
end> end>
FixedCols = 0 FixedCols = 0
TabOrder = 0 TabOrder = 0
OnMouseDown = UnitStringGridMouseDown OnMouseDown = UnitStringGridMouseDown
ColWidths = ( ColWidths = (
714 716
) )
end end
end end

View File

@ -35,6 +35,7 @@ uses
ComCtrls, ComCtrls,
// IDEIntf // IDEIntf
IDECommands, MenuIntf, ProjectIntf, LazIDEIntf, IDEDialogs, IDEWindowIntf, IDECommands, MenuIntf, ProjectIntf, LazIDEIntf, IDEDialogs, IDEWindowIntf,
PackageIntf,
// codetools // codetools
BasicCodeTools, FileProcs, CodyStrConsts, CodeToolManager, CodeCache, BasicCodeTools, FileProcs, CodyStrConsts, CodeToolManager, CodeCache,
PPUParser, PPUCodeTools; PPUParser, PPUCodeTools;
@ -71,6 +72,7 @@ type
OFileSize: int64; OFileSize: int64;
UsesUnits: TStrings; // =nil means uses section not yet scanned UsesUnits: TStrings; // =nil means uses section not yet scanned
UsedByUnits: TStrings; UsedByUnits: TStrings;
PackageName: string;
destructor Destroy; override; destructor Destroy; override;
function UsesCount: integer; function UsesCount: integer;
function UsedByCount: integer; function UsedByCount: integer;
@ -120,6 +122,7 @@ type
function FindUnit(AnUnitName: string): TPPUListItem; function FindUnit(AnUnitName: string): TPPUListItem;
function FindUnitInList(AnUnitName: string; List: TStrings): integer; function FindUnitInList(AnUnitName: string; List: TStrings): integer;
function FindUnitOfListitem(List: TStrings; Index: integer): TPPUListItem; function FindUnitOfListitem(List: TStrings; Index: integer): TPPUListItem;
function FindPackageOfUnit(Item: TPPUListItem): string;
procedure UpdateAll; procedure UpdateAll;
@ -258,6 +261,7 @@ var
i: Integer; i: Integer;
l: Integer; l: Integer;
begin begin
if FItems=nil then exit;
Col:=-1; Col:=-1;
Row:=-1; Row:=-1;
UnitsStringGrid.MouseToCell(X,Y,Col,Row); UnitsStringGrid.MouseToCell(X,Y,Col,Row);
@ -292,6 +296,7 @@ procedure TPPUListDialog.UnitsStringGridSelectCell(Sender: TObject; aCol,
var var
AnUnitName: String; AnUnitName: String;
begin begin
if FItems=nil then exit;
if (aRow<2) or (aRow>=UnitsStringGrid.RowCount) then if (aRow<2) or (aRow>=UnitsStringGrid.RowCount) then
AnUnitName:='' AnUnitName:=''
else else
@ -307,6 +312,7 @@ var
Row: Longint; Row: Longint;
AnUnitName: string; AnUnitName: string;
begin begin
if FItems=nil then exit;
Grid:=TStringGrid(Sender); Grid:=TStringGrid(Sender);
if Shift=[ssLeft,ssDouble] then begin if Shift=[ssLeft,ssDouble] then begin
Col:=0; Col:=0;
@ -354,6 +360,38 @@ begin
List.Objects[Index]:=Result; List.Objects[Index]:=Result;
end; 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; procedure TPPUListDialog.UpdateAll;
var var
s: String; s: String;
@ -748,15 +786,15 @@ begin
Item.UsesUnits:=TStringList.Create; Item.UsesUnits:=TStringList.Create;
if Item.UsedByUnits=nil then if Item.UsedByUnits=nil then
Item.UsedByUnits:=TStringList.Create; Item.UsedByUnits:=TStringList.Create;
debugln(['TPPUListDialog.OnIdle search used units of ',AnUnitName]); //debugln(['TPPUListDialog.OnIdle search used units of ',AnUnitName]);
// scan for used units // scan for used units
Scanned:=false; Scanned:=false;
if Item.PPUFile<>PPUFileNotFound then begin 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, PPUTool:=CodeToolBoss.PPUCache.LoadFile(Item.PPUFile,
[ppInterfaceHeader,ppImplementationHeader]); [ppInterfaceHeader,ppImplementationHeader]);
if (PPUTool<>nil) and (PPUTool.ErrorMsg='') then begin if (PPUTool<>nil) and (PPUTool.ErrorMsg='') then begin
debugln(['TPPUListDialog.OnIdle parsed ppu "',Item.PPUFile,'"']); //debugln(['TPPUListDialog.OnIdle parsed ppu "',Item.PPUFile,'"']);
MainUsesSection:=nil; MainUsesSection:=nil;
ImplementationUsesSection:=nil; ImplementationUsesSection:=nil;
try try
@ -822,6 +860,7 @@ begin
FSearchingItems.Add(UsedUnit); FSearchingItems.Add(UsedUnit);
UsedUnits.Objects[i]:=UsedUnit; UsedUnits.Objects[i]:=UsedUnit;
UsedUnit.UsedByUnits:=TStringList.Create; UsedUnit.UsedByUnits:=TStringList.Create;
FindPackageOfUnit(UsedUnit);
end; end;
if FindUnitInList(AnUnitName,SrcItem.UsesUnits)<0 then if FindUnitInList(AnUnitName,SrcItem.UsesUnits)<0 then

View File

@ -41,7 +41,7 @@ uses
CodeToolsCfgScript, Laz_XMLCfg, CodeToolsStructs, CodeToolsCfgScript, Laz_XMLCfg, CodeToolsStructs,
// IDEIntf // IDEIntf
SrcEditorIntf, ProjectIntf, MacroIntf, IDEDialogs, IDEExternToolIntf, SrcEditorIntf, ProjectIntf, MacroIntf, IDEDialogs, IDEExternToolIntf,
LazIDEIntf, CompOptsIntf, LazIDEIntf,
// IDE // IDE
LazarusIDEStrConsts, DialogProcs, IDEProcs, CodeToolsOptions, InputHistory, LazarusIDEStrConsts, DialogProcs, IDEProcs, CodeToolsOptions, InputHistory,
EditDefineTree, ProjectResources, MiscOptions, LazConf, EnvironmentOpts, EditDefineTree, ProjectResources, MiscOptions, LazConf, EnvironmentOpts,

View File

@ -34,7 +34,7 @@ uses
Classes, SysUtils, LCLProc, FileUtil, Forms, Controls, Graphics, Dialogs, Classes, SysUtils, LCLProc, FileUtil, Forms, Controls, Graphics, Dialogs,
StdCtrls, ExtCtrls, StdCtrls, ExtCtrls,
CodeToolManager, BasicCodeTools, DefineTemplates, CodeToolManager, BasicCodeTools, DefineTemplates,
ProjectIntf, IDEDialogs, CompOptsIntf, ProjectIntf, IDEDialogs,
InputHistory, TransferMacros, Project, LazarusIDEStrConsts; InputHistory, TransferMacros, Project, LazarusIDEStrConsts;
type type

View File

@ -30,17 +30,6 @@
*************************************************************************** ***************************************************************************
ToDo: 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 - when adding/removing search path: do it for all build modes
- add unit to project - add unit to project
- remove unit from project - remove unit from project
@ -49,8 +38,6 @@
- license gpl2 - license gpl2
- create package lazbuildsystem with some units - create package lazbuildsystem with some units
- move - move
- remove TGlobalCompilerOptions
- implement switching active project
- i18n for descriptions - i18n for descriptions
- keyword help for a build macro - keyword help for a build macro
@ -70,7 +57,8 @@ uses
Classes, SysUtils, FileProcs, FileUtil, InterfaceBase, LCLProc, Forms, Classes, SysUtils, FileProcs, FileUtil, InterfaceBase, LCLProc, Forms,
Controls, Laz_XMLCfg, ExprEval, DefineTemplates, CodeToolsCfgScript, Controls, Laz_XMLCfg, ExprEval, DefineTemplates, CodeToolsCfgScript,
// IDEIntf // IDEIntf
ProjectIntf, MacroIntf, IDEExternToolIntf, SrcEditorIntf, IDEOptionsIntf, ProjectIntf, MacroIntf, IDEExternToolIntf, SrcEditorIntf, CompOptsIntf,
IDEOptionsIntf,
// IDE // IDE
LazarusIDEStrConsts, IDEProcs, IDEMsgIntf, LazConf, TransferMacros, CompOptsModes; LazarusIDEStrConsts, IDEProcs, IDEMsgIntf, LazConf, TransferMacros, CompOptsModes;

View File

@ -47,7 +47,7 @@ uses
Laz_XMLCfg, SynEdit, CodeCache, CodeToolManager, Laz_XMLCfg, SynEdit, CodeCache, CodeToolManager,
// IDEIntf // IDEIntf
IDEWindowIntf, SrcEditorIntf, MenuIntf, IDECommands, LazIDEIntf, ProjectIntf, IDEWindowIntf, SrcEditorIntf, MenuIntf, IDECommands, LazIDEIntf, ProjectIntf,
IDEDialogs, CompOptsIntf, IDEDialogs,
// IDE // IDE
LazConf, CompilerOptions, EditorOptions, EnvironmentOpts, KeyMapping, LazConf, CompilerOptions, EditorOptions, EnvironmentOpts, KeyMapping,
SourceEditor, ProjectDefs, Project, IDEProcs, InputHistory, Debugger, SourceEditor, ProjectDefs, Project, IDEProcs, InputHistory, Debugger,

View File

@ -41,7 +41,7 @@ uses
Laz_XMLCfg, LazConfigStorage, Laz_XMLCfg, LazConfigStorage,
// IDEIntf // IDEIntf
ProjectIntf, ObjectInspector, IDEWindowIntf, IDEOptionsIntf, ProjectIntf, ObjectInspector, IDEWindowIntf, IDEOptionsIntf,
IDEExternToolIntf, CompOptsIntf, IDEExternToolIntf,
// IDE // IDE
IDEProcs, LazarusIDEStrConsts, IDETranslations, LazConf, IDEProcs, LazarusIDEStrConsts, IDETranslations, LazConf,
IDEOptionDefs, TransferMacros, Debugger; IDEOptionDefs, TransferMacros, Debugger;

View File

@ -43,7 +43,7 @@ uses
Buttons, StdCtrls, ComCtrls, Dialogs, ExtCtrls, ButtonPanel, Buttons, StdCtrls, ComCtrls, Dialogs, ExtCtrls, ButtonPanel,
LazConfigStorage, FileUtil, UTF8Process, LazConfigStorage, FileUtil, UTF8Process,
IDEExternToolIntf, IDEImagesIntf, IDEDialogs, IDEHelpIntf, IDECommands, IDEExternToolIntf, IDEImagesIntf, IDEDialogs, IDEHelpIntf, IDECommands,
ProjectIntf, CompOptsIntf, ProjectIntf,
EnvironmentOpts, EnvironmentOpts,
ExtToolEditDlg, KeyMapping, TransferMacros, IDEProcs, ExtToolEditDlg, KeyMapping, TransferMacros, IDEProcs,
InfoBuild, CompilerOptions, OutputFilter, LazarusIDEStrConsts; InfoBuild, CompilerOptions, OutputFilter, LazarusIDEStrConsts;

View File

@ -33,7 +33,7 @@ uses
Math, Classes, SysUtils, LCLProc, Controls, FileUtil, Forms, Math, Classes, SysUtils, LCLProc, Controls, FileUtil, Forms,
Grids, Graphics, Menus, ComCtrls, Dialogs, AvgLvlTree, DefineTemplates, Grids, Graphics, Menus, ComCtrls, Dialogs, AvgLvlTree, DefineTemplates,
StdCtrls, GraphMath, ExtCtrls, Buttons, StdCtrls, GraphMath, ExtCtrls, Buttons,
ProjectIntf, IDEImagesIntf, IDEOptionsIntf, ProjectIntf, IDEImagesIntf, IDEOptionsIntf, CompOptsIntf,
PackageDefs, compiler_inherited_options, TransferMacros, PackageDefs, compiler_inherited_options, TransferMacros,
PathEditorDlg, Project, PackageSystem, LazarusIDEStrConsts, CompilerOptions, PathEditorDlg, Project, PackageSystem, LazarusIDEStrConsts, CompilerOptions,
IDEProcs, BuildModeDiffDlg; IDEProcs, BuildModeDiffDlg;

View File

@ -7,7 +7,7 @@ interface
uses uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,
StdCtrls, IDEOptionsIntf, Project, CompilerOptions, LazarusIDEStrConsts, StdCtrls, IDEOptionsIntf, Project, CompilerOptions, LazarusIDEStrConsts,
ProjectIntf, PackageDefs; ProjectIntf, CompOptsIntf, PackageDefs;
type type

View File

@ -38,7 +38,7 @@ interface
uses uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs,
StdCtrls, ComCtrls, ExtCtrls, StdCtrls, ComCtrls, ExtCtrls,
CodeToolsCfgScript, IDEOptionsIntf, IDEImagesIntf, ProjectIntf, CodeToolsCfgScript, IDEOptionsIntf, IDEImagesIntf, ProjectIntf, CompOptsIntf,
Project, CompilerOptions, LazarusIDEStrConsts, IDEProcs; Project, CompilerOptions, LazarusIDEStrConsts, IDEProcs;
type type

View File

@ -74,7 +74,7 @@ uses
IDEIntf, BaseIDEIntf, ObjectInspector, PropEdits, PropEditUtils, IDEIntf, BaseIDEIntf, ObjectInspector, PropEdits, PropEditUtils,
MacroIntf, IDECommands, IDEWindowIntf, MacroIntf, IDECommands, IDEWindowIntf,
SrcEditorIntf, NewItemIntf, IDEExternToolIntf, IDEMsgIntf, SrcEditorIntf, NewItemIntf, IDEExternToolIntf, IDEMsgIntf,
PackageIntf, ProjectIntf, MenuIntf, LazIDEIntf, IDEDialogs, PackageIntf, ProjectIntf, CompOptsIntf, MenuIntf, LazIDEIntf, IDEDialogs,
IDEOptionsIntf, IDEImagesIntf, IDEOptionsIntf, IDEImagesIntf,
// protocol // protocol
IDEProtocol, IDEProtocol,

View File

@ -65,7 +65,7 @@ uses
CodeCache, AVL_Tree, SynEditKeyCmds, CodeCache, AVL_Tree, SynEditKeyCmds,
// IDE // IDE
PropEdits, ObjectInspector, MenuIntf, SrcEditorIntf, ProjectIntf, MacroIntf, PropEdits, ObjectInspector, MenuIntf, SrcEditorIntf, ProjectIntf, MacroIntf,
LazIDEIntf, CompOptsIntf, LazIDEIntf,
LazConf, LazarusIDEStrConsts, LazConf, LazarusIDEStrConsts,
ProjectDefs, Project, PublishModule, BuildLazDialog, Compiler, ProjectDefs, Project, PublishModule, BuildLazDialog, Compiler,
ComponentReg, ComponentReg,

View File

@ -54,7 +54,7 @@ uses
Laz_XMLCfg, CodeToolsConfig, ExprEval, FileProcs, DefineTemplates, Laz_XMLCfg, CodeToolsConfig, ExprEval, FileProcs, DefineTemplates,
CodeToolsCfgScript, CodeToolManager, CodeCache, CodeToolsCfgScript, CodeToolManager, CodeCache,
// IDEIntf // IDEIntf
ProjectIntf, MacroIntf, LazIDEIntf, CompOptsIntf, ProjectIntf, MacroIntf, LazIDEIntf,
// IDE // IDE
CompOptsModes, ProjectResources, LazConf, CompOptsModes, ProjectResources, LazConf,
LazarusIDEStrConsts, CompilerOptions, LazarusIDEStrConsts, CompilerOptions,

View File

@ -39,7 +39,7 @@ interface
uses uses
Classes, SysUtils, Laz_XMLCfg, Classes, SysUtils, Laz_XMLCfg,
Controls, Forms, SynRegExpr, FileProcs, LCLProc, Controls, Forms, SynRegExpr, FileProcs, LCLProc,
ProjectIntf, PublishModule, LazIDEIntf, CompOptsIntf, ProjectIntf, PublishModule, LazIDEIntf,
frmCustomApplicationOptions, IDEProcs, LazarusIDEStrConsts; frmCustomApplicationOptions, IDEProcs, LazarusIDEStrConsts;
type type

View File

@ -38,10 +38,12 @@ interface
uses uses
Classes, SysUtils, Contnrs, Controls, LCLProc, LResources, FileUtil, Laz_XMLCfg, Classes, SysUtils, Contnrs, Controls, LCLProc, LResources, FileUtil, Laz_XMLCfg,
Dialogs, ProjectIntf, ProjectResourcesIntf, LazarusIDEStrConsts, AvgLvlTree, Dialogs, AvgLvlTree, resource, reswriter,
KeywordFuncLists, BasicCodeTools, IDEProcs, DialogProcs, CodeToolManager, KeywordFuncLists, BasicCodeTools, CodeToolManager, CodeCache,
CodeCache, resource, reswriter, ProjectIntf, ProjectResourcesIntf, CompOptsIntf,
W32Manifest,W32VersionInfo,ProjectIcon; LazarusIDEStrConsts,
IDEProcs, DialogProcs,
W32Manifest, W32VersionInfo, ProjectIcon;
type type
{ TProjectResources } { TProjectResources }

View File

@ -44,7 +44,7 @@ uses
{$ELSE} {$ELSE}
Laz_DOM, Laz_DOM,
{$ENDIF} {$ENDIF}
IDEProcs, ProjectIntf, IDEProcs, ProjectIntf, CompOptsIntf,
ProjectResourcesIntf, resource, versionresource, versiontypes; ProjectResourcesIntf, resource, versionresource, versiontypes;
type type

876
ideintf/compoptsintf.pas Normal file
View File

@ -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 fChangeStamp<High(ChangeStamp) then
inc(fChangeStamp)
else
fChangeStamp:=Low(int64)+1;
if fOnChanged<>nil 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.

View File

@ -5,7 +5,7 @@
<AddToProjectUsesSection Value="False"/> <AddToProjectUsesSection Value="False"/>
<Author Value="Lazarus"/> <Author Value="Lazarus"/>
<CompilerOptions> <CompilerOptions>
<Version Value="9"/> <Version Value="10"/>
<SearchPaths> <SearchPaths>
<UnitOutputDirectory Value="units/$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="units/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
@ -22,7 +22,7 @@
<Description Value="IDEIntf - the interface units for the Lazarus IDE"/> <Description Value="IDEIntf - the interface units for the Lazarus IDE"/>
<License Value="Modified LPGL2"/> <License Value="Modified LPGL2"/>
<Version Major="1"/> <Version Major="1"/>
<Files Count="67"> <Files Count="68">
<Item1> <Item1>
<Filename Value="actionseditor.lfm"/> <Filename Value="actionseditor.lfm"/>
<Type Value="LFM"/> <Type Value="LFM"/>
@ -292,6 +292,10 @@
<Filename Value="treeviewpropedit.pas"/> <Filename Value="treeviewpropedit.pas"/>
<UnitName Value="TreeViewPropEdit"/> <UnitName Value="TreeViewPropEdit"/>
</Item67> </Item67>
<Item68>
<Filename Value="compoptsintf.pas"/>
<UnitName Value="compoptsintf"/>
</Item68>
</Files> </Files>
<i18n> <i18n>
<EnableI18N Value="True"/> <EnableI18N Value="True"/>

View File

@ -7,7 +7,7 @@ unit IDEIntf;
interface interface
uses uses
ActionsEditor, ActionsEditorStd, BaseIDEIntf, CheckGroupEditorDlg, ActionsEditor, ActionsEditorStd, BaseIDEIntf, CheckGroupEditorDlg,
CheckListboxEditorDlg, CollectionPropEditForm, ColumnDlg, ComponentEditors, CheckListboxEditorDlg, CollectionPropEditForm, ColumnDlg, ComponentEditors,
ComponentReg, ComponentTreeView, DBPropEdits, fieldseditor, fieldslist, ComponentReg, ComponentTreeView, DBPropEdits, fieldseditor, fieldslist,
FormEditingIntf, frmSelectProps, GraphicPropEdit, GraphPropEdits, FormEditingIntf, frmSelectProps, GraphicPropEdit, GraphPropEdits,
@ -18,7 +18,8 @@ uses
newfield, NewItemIntf, ObjectInspector, ObjInspStrConsts, newfield, NewItemIntf, ObjectInspector, ObjInspStrConsts,
OIFavouriteProperties, PackageIntf, ProjectIntf, ProjectResourcesIntf, OIFavouriteProperties, PackageIntf, ProjectIntf, ProjectResourcesIntf,
PropEdits, PropEditUtils, SrcEditorIntf, StatusBarPropEdit, PropEdits, PropEditUtils, SrcEditorIntf, StatusBarPropEdit,
StringsPropEditDlg, TextTools, TreeViewPropEdit, LazarusPackageIntf; StringsPropEditDlg, TextTools, TreeViewPropEdit, CompOptsIntf,
LazarusPackageIntf;
implementation implementation

View File

@ -23,7 +23,7 @@ interface
uses uses
Classes, SysUtils, LCLProc, Forms, Controls, Dialogs, PropEdits, LazHelpHTML, Classes, SysUtils, LCLProc, Forms, Controls, Dialogs, PropEdits, LazHelpHTML,
IDEExternToolIntf, IDEOptionsIntf, ProjectIntf, SrcEditorIntf, LDockCtrl; IDEExternToolIntf, IDEOptionsIntf, CompOptsIntf, ProjectIntf, SrcEditorIntf;
type type
// open file flags // open file flags

View File

@ -23,7 +23,8 @@ unit PackageIntf;
interface interface
uses uses
Classes, SysUtils, LCLProc, Forms, LazConfigStorage, NewItemIntf, IDEOptionsIntf, AvgLvlTree; Classes, SysUtils, LCLProc, Forms, LazConfigStorage, AvgLvlTree,
NewItemIntf, CompOptsIntf, IDEOptionsIntf;
const const
PkgDescGroupName = 'Package'; PkgDescGroupName = 'Package';
@ -117,6 +118,7 @@ type
FCustomOptions: TConfigStorage; FCustomOptions: TConfigStorage;
FFilename: string; FFilename: string;
FChangeStamp: integer; FChangeStamp: integer;
FLazCompilerOptions: TLazCompilerOptions;
function GetDirectoryExpanded: string; virtual; abstract; function GetDirectoryExpanded: string; virtual; abstract;
function GetFileCount: integer; virtual; abstract; function GetFileCount: integer; virtual; abstract;
function GetPkgFiles(Index: integer): TLazPackageFile; virtual; abstract; function GetPkgFiles(Index: integer): TLazPackageFile; virtual; abstract;
@ -141,6 +143,7 @@ type
property Files[Index: integer]: TLazPackageFile read GetPkgFiles; property Files[Index: integer]: TLazPackageFile read GetPkgFiles;
property RemovedFilesCount: integer read GetRemovedCount; property RemovedFilesCount: integer read GetRemovedCount;
property RemovedFiles[Index: integer]: TLazPackageFile read GetRemovedPkgFiles; property RemovedFiles[Index: integer]: TLazPackageFile read GetRemovedPkgFiles;
property LazCompilerOptions: TLazCompilerOptions read FLazCompilerOptions;
end; end;
type type

View File

@ -23,7 +23,7 @@ interface
uses uses
Classes, SysUtils, LCLProc, FileUtil, Controls, Forms, AvgLvlTree, Classes, SysUtils, LCLProc, FileUtil, Controls, Forms, AvgLvlTree,
NewItemIntf, ObjInspStrConsts, IDEOptionsIntf; NewItemIntf, ObjInspStrConsts, IDEOptionsIntf, CompOptsIntf;
const const
FileDescGroupName = 'File'; FileDescGroupName = 'File';
@ -50,374 +50,6 @@ type
rtRes // fpc resources 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 }
TLazProjectFile = class(TPersistent) TLazProjectFile = class(TPersistent)
@ -1416,477 +1048,6 @@ begin
inherited Destroy; inherited Destroy;
end; 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 fChangeStamp<High(ChangeStamp) then
inc(fChangeStamp)
else
fChangeStamp:=Low(int64)+1;
if fOnChanged<>nil 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 } { TNewItemProjectFile }
function TNewItemProjectFile.LocalizedName: string; function TNewItemProjectFile.LocalizedName: string;
@ -1925,13 +1086,6 @@ begin
FDescriptor:=TNewItemProject(Source).Descriptor; FDescriptor:=TNewItemProject(Source).Descriptor;
end; end;
{ TLazBuildMacros }
constructor TLazBuildMacros.Create(TheOwner: TObject);
begin
FOwner:=TheOwner
end;
initialization initialization
ProjectFileDescriptors:=nil; ProjectFileDescriptors:=nil;

View File

@ -17,7 +17,7 @@ unit ProjectResourcesIntf;
interface interface
uses uses
Classes, SysUtils, ProjectIntf, resource; Classes, SysUtils, CompOptsIntf, ProjectIntf, resource;
type type
TAbstractProjectResources = class; TAbstractProjectResources = class;

View File

@ -2473,6 +2473,7 @@ begin
FMacros.MarkUnhandledMacros:=false; FMacros.MarkUnhandledMacros:=false;
FMacros.OnSubstitution:=@OnMacroListSubstitution; FMacros.OnSubstitution:=@OnMacroListSubstitution;
FCompilerOptions:=TPkgCompilerOptions.Create(Self); FCompilerOptions:=TPkgCompilerOptions.Create(Self);
FLazCompilerOptions:=FCompilerOptions;
FCompilerOptions.ParsedOpts.InvalidateParseOnChange:=true; FCompilerOptions.ParsedOpts.InvalidateParseOnChange:=true;
FCompilerOptions.ParsedOpts.OnLocalSubstitute:=@SubstitutePkgMacros; FCompilerOptions.ParsedOpts.OnLocalSubstitute:=@SubstitutePkgMacros;
FCompilerOptions.DefaultMakeOptionsFlags:=[ccloNoLinkerOpts]; FCompilerOptions.DefaultMakeOptionsFlags:=[ccloNoLinkerOpts];

View File

@ -54,7 +54,7 @@ uses
CodeToolManager, CodeToolManager,
// IDEIntf, // IDEIntf,
SrcEditorIntf, IDEExternToolIntf, IDEDialogs, IDEMsgIntf, PackageIntf, SrcEditorIntf, IDEExternToolIntf, IDEDialogs, IDEMsgIntf, PackageIntf,
LazIDEIntf, CompOptsIntf, LazIDEIntf,
// package registration // package registration
LazarusPackageIntf, LazarusPackageIntf,
// IDE // IDE

View File

@ -50,7 +50,7 @@ uses
CodeToolsCfgScript, CodeToolsConfig, CodeToolManager, CodeCache, CodeToolsCfgScript, CodeToolsConfig, CodeToolManager, CodeCache,
BasicCodeTools, FileProcs, Laz_XMLCfg, BasicCodeTools, FileProcs, Laz_XMLCfg,
// IDE Interface // IDE Interface
SrcEditorIntf, NewItemIntf, ProjectIntf, PackageIntf, SrcEditorIntf, NewItemIntf, ProjectIntf, PackageIntf, CompOptsIntf,
MenuIntf, IDEWindowIntf, PropEdits, MacroIntf, LazIDEIntf, MenuIntf, IDEWindowIntf, PropEdits, MacroIntf, LazIDEIntf,
// IDE // IDE
LazConf, LazarusIDEStrConsts, IDEProcs, ObjectLists, DialogProcs, IDECommands, LazConf, LazarusIDEStrConsts, IDEProcs, ObjectLists, DialogProcs, IDECommands,