diff --git a/components/compilers/delphi/delphioptions.pas b/components/compilers/delphi/delphioptions.pas
index 8b6fad9bfa..f8d49d3ca9 100644
--- a/components/compilers/delphi/delphioptions.pas
+++ b/components/compilers/delphi/delphioptions.pas
@@ -38,7 +38,6 @@ Type
procedure Reset;
class property Instance : TDelphiToolOptions Read _Instance;
Property CompilerFileName : String Read FCompilerFileName Write FCompilerFileName;
- Property GenerateConfigFile : Boolean Read FGenerateConfigFile Write FGenerateConfigFile;
Property ConfigFileExtension : String Read FConfigFileExtension Write FConfigFileExtension;
Property ConvertPathsToUnix : Boolean Read FConvertPathsToUnix Write FConvertPathsToUnix;
Property AdditionalOptions : String Read FAdditionalOptions Write FAdditionalOptions;
@@ -60,19 +59,17 @@ end;
procedure TDelphiToolOptions.LoadFromConfig(Cfg: TConfigStorage);
begin
CompilerFilename:=Cfg.GetValue(KeyCompiler, CompilerFilename);
- GenerateConfigFile:=Cfg.GetValue(KeyGenConfigFile, GenerateConfigFile);
ConfigFileExtension:=Cfg.GetValue(KeyConfigFileExt, ConfigFileExtension);
ConvertPathsToUnix:=Cfg.GetValue(KeyConvertPaths, ConvertPathsToUnix);
- AdditionalOptions:=Cfg.GetValue(KeyConvertPaths, AdditionalOptions);
+ AdditionalOptions:=Cfg.GetValue(KeyAdditionalOptions, AdditionalOptions);
end;
procedure TDelphiToolOptions.SaveToConfig(Cfg: TConfigStorage);
begin
Cfg.SetDeleteValue(KeyCompiler, CompilerFilename, DefaultCompilerFileName);
- Cfg.SetDeleteValue(KeyGenConfigFile, GenerateConfigFile, DefaultGenConfig);
Cfg.SetDeleteValue(KeyConfigFileExt, ConfigFileExtension, DefaultConfigExtension);
Cfg.SetDeleteValue(KeyConvertPaths, ConvertPathsToUnix, DefaultConvertPathsToUnix);
- Cfg.SetDeleteValue(KeyConvertPaths, AdditionalOptions, DefaultAdditionalOptions);
+ Cfg.SetDeleteValue(KeyAdditionalOptions, AdditionalOptions, DefaultAdditionalOptions);
end;
constructor TDelphiToolOptions.Create;
@@ -121,7 +118,6 @@ end;
procedure TDelphiToolOptions.Reset;
begin
CompilerFileName:=DefaultCompilerFileName;
- GenerateConfigFile:=DefaultGenConfig;
ConfigFileExtension:=DefaultConfigExtension;
ConvertPathsToUnix:=DefaultConvertPathsToUnix;
AdditionalOptions:=DefaultAdditionalOptions;
diff --git a/components/compilers/delphi/delphitool.pas b/components/compilers/delphi/delphitool.pas
index 34898b8cd7..7649e738fa 100644
--- a/components/compilers/delphi/delphitool.pas
+++ b/components/compilers/delphi/delphitool.pas
@@ -1,11 +1,14 @@
unit delphitool;
{$mode objfpc}{$H+}
+{$modeswitch typehelpers}
interface
uses
- Classes, SysUtils, System.UITypes, dialogs, CompOptsIntf, IDEExternToolIntf, MacroDefIntf, MacroIntf, RegExpr, strdelphitool;
+ Classes, SysUtils, System.UITypes, dialogs,
+ ProjectIntf, CompOptsIntf, IDEExternToolIntf, MacroDefIntf, MacroIntf, RegExpr,
+ strdelphitool;
Const
@@ -76,6 +79,19 @@ type
Class Property Instance: TDelphiTool read _Instance;
end;
+ { TLazProjectDelphiOptions }
+
+ TLazProjectDelphiOptions = class helper for TLazProject
+ private
+ function GetADO: String;
+ function GetDCF: Boolean;
+ procedure SetADO(AValue: String);
+ procedure SetDCF(AValue: Boolean);
+ Public
+ Property GenerateDelphiConfigFile : Boolean Read GetDCF Write SetDCF;
+ Property AdditionalDelphiOptions : String Read GetADO Write SetADO;
+ end;
+
implementation
uses
@@ -425,6 +441,7 @@ function TDelphiTool.FPCToDelphiOpts(Opts : TLazCompilerOptions; aDelphiOpts: TS
procedure AddOption(aValue : String; const FlagName : String);
begin
+ IDEMacros.SubstituteMacros(aValue);
AddOption(aValue<>'',FlagName+aValue);
end;
@@ -433,9 +450,8 @@ begin
AddOption(Opts.GetUnitPath(False,coptParsed,True),'U');
AddOPtion(Opts.GetIncludePath(False,coptParsed,True),'I');
AddOption(Opts.GenerateDebugInfo,'V');
- AddOption(Opts.UnitOutputDirectory,'NU');
- AddOption(Opts.UnitOutputDirectory,'NO');
- AddOption(Opts.GetObjectPath(True,coptParsed,True),'O');
+ AddOption(Opts.GetUnitOutputDirectory(False),'NU');
+ AddOption(Opts.GetObjectPath(false,coptParsed,True),'O');
AddOption(Opts.ShowWarn,'W');
AddOption(Opts.ShowHints,'H');
AddOption(Opts.DontUseConfigFile,'-no-config');
@@ -486,7 +502,7 @@ begin
FMacros[dmConfigFileName].LazbuildValue:=GetCurrentConfigFileName;
FMacros[dmCompileCommand].LazbuildValue:=GetCompileCommand;
FMacros[dmAdditionalArgs].LazbuildValue:=GetCompilerArguments;
- if DelphiToolOptions.GenerateConfigFile and assigned(LazarusIDE.ActiveProject) then
+ if Assigned(LazarusIDE.ActiveProject) and LazarusIDE.ActiveProject.GenerateDelphiConfigFile then
GenerateConfigFilename(GetCurrentConfigFileName(False));
end;
@@ -515,7 +531,7 @@ end;
function TDelphiTool.GetCurrentConfigFileName(PrependAt: Boolean = True): String;
begin
- if Assigned(LazarusIDE.ActiveProject) and DelphiToolOptions.GenerateConfigFile then
+ if Assigned(LazarusIDE.ActiveProject) and LazarusIDE.ActiveProject.GenerateDelphiConfigFile then
begin
Result:=ChangeFileExt(LazarusIDE.ActiveProject.ProjectInfoFile,DelphiOptions.DefaultConfigExtension);
if PrependAt then
@@ -526,9 +542,21 @@ begin
end;
function TDelphiTool.GetCompilerArguments: string;
+
+var
+ S : String;
+
begin
Result:=DelphiToolOptions.AdditionalOptions;
IDEMacros.SubstituteMacros(Result);
+ if Assigned(LazarusIDE.ActiveProject) then
+ begin
+ S:=LazarusIDE.ActiveProject.AdditionalDelphiOptions;
+ if S<>'' then
+ IDEMacros.SubstituteMacros(S);
+ if S<>'' then
+ Result:=Result+' ';
+ end;
end;
@@ -539,6 +567,28 @@ begin
IDEMacros.SubstituteMacros(Result);
end;
+{ TLazProjectDelphiOptions }
+
+function TLazProjectDelphiOptions.GetADO: String;
+begin
+ Result:=CustomData[pKeyAdditionalOptions];
+end;
+
+function TLazProjectDelphiOptions.GetDCF: Boolean;
+begin
+ Result:=CustomData[pKeyGenConfigFile]='1';
+end;
+
+procedure TLazProjectDelphiOptions.SetADO(AValue: String);
+begin
+ CustomData[pKeyAdditionalOptions]:=aValue
+end;
+
+procedure TLazProjectDelphiOptions.SetDCF(AValue: Boolean);
+begin
+ CustomData[pKeyGenConfigFile]:=IntToStr(Ord(aValue));
+end;
+
end.
diff --git a/components/compilers/delphi/fradelphioptions.lfm b/components/compilers/delphi/fradelphioptions.lfm
index cdef523311..70a999676c 100644
--- a/components/compilers/delphi/fradelphioptions.lfm
+++ b/components/compilers/delphi/fradelphioptions.lfm
@@ -26,7 +26,7 @@ object DelphiOptionsFrame: TDelphiOptionsFrame
AnchorSideLeft.Control = lblDelphiPath
AnchorSideTop.Control = lblDelphiPath
AnchorSideTop.Side = asrBottom
- AnchorSideRight.Control = Pas2jsPathBrowseButton
+ AnchorSideRight.Control = DelphiPathBrowseButton
Left = 16
Height = 27
Top = 32
@@ -36,7 +36,7 @@ object DelphiOptionsFrame: TDelphiOptionsFrame
ItemHeight = 0
TabOrder = 0
end
- object Pas2jsPathBrowseButton: TButton
+ object DelphiPathBrowseButton: TButton
AnchorSideTop.Control = cbDelphiPath
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
@@ -50,41 +50,30 @@ object DelphiOptionsFrame: TDelphiOptionsFrame
AutoSize = True
BorderSpacing.Right = 8
Caption = '...'
+ OnClick = DelphiPathBrowseButtonClick
ParentShowHint = False
ShowHint = True
TabOrder = 1
end
- object cbGenConfig: TCheckBox
- AnchorSideLeft.Control = lblDelphiPath
- AnchorSideTop.Control = cbDelphiPath
- AnchorSideTop.Side = asrBottom
- Left = 16
- Height = 23
- Top = 67
- Width = 377
- BorderSpacing.Top = 8
- Caption = 'Generate Delphi config file based on FPC compiler options'
- TabOrder = 2
- end
object cbConfigFileExtension: TComboBox
AnchorSideLeft.Control = lblConfigFileExtension
AnchorSideTop.Control = lblConfigFileExtension
AnchorSideTop.Side = asrBottom
Left = 16
Height = 27
- Top = 122
+ Top = 91
Width = 136
BorderSpacing.Top = 8
ItemHeight = 0
- TabOrder = 3
+ TabOrder = 2
end
object lblConfigFileExtension: TLabel
AnchorSideLeft.Control = Owner
- AnchorSideTop.Control = cbGenConfig
+ AnchorSideTop.Control = cbDelphiPath
AnchorSideTop.Side = asrBottom
Left = 16
Height = 16
- Top = 98
+ Top = 67
Width = 170
BorderSpacing.Left = 16
BorderSpacing.Top = 8
@@ -99,11 +88,11 @@ object DelphiOptionsFrame: TDelphiOptionsFrame
AnchorSideTop.Side = asrBottom
Left = 16
Height = 23
- Top = 157
+ Top = 126
Width = 306
BorderSpacing.Top = 8
Caption = 'Map filenames from Windows to Unix notation'
- TabOrder = 4
+ TabOrder = 3
end
object lblAdditionalOptions: TLabel
AnchorSideLeft.Control = Owner
@@ -111,7 +100,7 @@ object DelphiOptionsFrame: TDelphiOptionsFrame
AnchorSideTop.Side = asrBottom
Left = 16
Height = 16
- Top = 188
+ Top = 157
Width = 167
BorderSpacing.Left = 16
BorderSpacing.Top = 8
@@ -124,14 +113,14 @@ object DelphiOptionsFrame: TDelphiOptionsFrame
AnchorSideLeft.Control = lblAdditionalOptions
AnchorSideTop.Control = lblAdditionalOptions
AnchorSideTop.Side = asrBottom
- AnchorSideRight.Control = Pas2jsPathBrowseButton
+ AnchorSideRight.Control = DelphiPathBrowseButton
Left = 16
Height = 27
- Top = 212
+ Top = 181
Width = 577
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 8
ItemHeight = 0
- TabOrder = 5
+ TabOrder = 4
end
end
diff --git a/components/compilers/delphi/fradelphioptions.pas b/components/compilers/delphi/fradelphioptions.pas
index 3cca938588..eadbd4e2fc 100644
--- a/components/compilers/delphi/fradelphioptions.pas
+++ b/components/compilers/delphi/fradelphioptions.pas
@@ -19,13 +19,13 @@ type
TDelphiOptionsFrame = class(TAbstractIDEOptionsEditor)
cbConfigFileExtension: TComboBox;
cbAdditionalOptions: TComboBox;
- cbGenConfig: TCheckBox;
cbConvertDosToUnix: TCheckBox;
lblConfigFileExtension: TLabel;
lblAdditionalOptions: TLabel;
- Pas2jsPathBrowseButton: TButton;
+ DelphiPathBrowseButton: TButton;
cbDelphiPath: TComboBox;
lblDelphiPath: TLabel;
+ procedure DelphiPathBrowseButtonClick(Sender: TObject);
private
public
@@ -38,12 +38,32 @@ type
implementation
-uses strdelphitool;
+uses dialogs, strdelphitool;
{$R *.lfm}
{ TDelphiOptionsFrame }
+procedure TDelphiOptionsFrame.DelphiPathBrowseButtonClick(Sender: TObject);
+var
+ OpenDialog: TOpenDialog;
+ AFilename: String;
+begin
+ OpenDialog:=TOpenDialog.Create(nil);
+ try
+ //InputHistories.ApplyFileDialogSettings(OpenDialog);
+ OpenDialog.Options:=OpenDialog.Options+[ofPathMustExist];
+ OpenDialog.Title:=SSelectDelphiExecutable;
+ OpenDialog.FileName:=cbDelphiPath.Text;
+ if OpenDialog.Execute then begin
+ AFilename:=CleanAndExpandFilename(OpenDialog.Filename);
+ SetComboBoxText(cbDelphiPath,AFilename,cstFilename,30);
+ end;
+ finally
+ OpenDialog.Free;
+ end;
+end;
+
function TDelphiOptionsFrame.GetTitle: String;
begin
Result:=SDelphiToolOptionsTitle;
@@ -53,7 +73,6 @@ procedure TDelphiOptionsFrame.Setup(ADialog: TAbstractOptionsEditorDialog);
begin
lblDelphiPath.Caption:=SDelphiCompilerFileNameCaption;
lblConfigFileExtension.Caption:=SConfigFileExtensionCaption;
- cbGenConfig.Caption:=SGenerateConfigFileCaption;
cbConvertDosToUnix.Caption:=SConvertDosToUnixCaption;
cbConvertDosToUnix.Enabled:={$IFDEF UNIX}True{$ELSE}False{$ENDIF};
lblAdditionalOptions.Caption:=SDelphiCompilerArgs;
@@ -66,7 +85,6 @@ var
begin
Opts:=DelphiToolOptions;
- cbGenConfig.Checked:=Opts.GenerateConfigFile;
cbConvertDosToUnix.Checked:=Opts.ConvertPathsToUnix;
cbDelphiPath.Text:=Opts.CompilerFileName;
cbConfigFileExtension.Text:=Opts.ConfigFileExtension;
@@ -79,7 +97,6 @@ var
begin
Opts:=DelphiToolOptions;
- Opts.GenerateConfigFile:=cbGenConfig.Checked;
Opts.ConvertPathsToUnix:=cbConvertDosToUnix.Checked;
Opts.CompilerFileName:=cbDelphiPath.Text;
Opts.ConfigFileExtension:=cbConfigFileExtension.Text;
diff --git a/components/compilers/delphi/fraprojectdelphioptions.lfm b/components/compilers/delphi/fraprojectdelphioptions.lfm
new file mode 100644
index 0000000000..12ce88449a
--- /dev/null
+++ b/components/compilers/delphi/fraprojectdelphioptions.lfm
@@ -0,0 +1,50 @@
+object ProjectDelphiOptionsFrame: TProjectDelphiOptionsFrame
+ Left = 0
+ Height = 240
+ Top = 0
+ Width = 736
+ ClientHeight = 240
+ ClientWidth = 736
+ TabOrder = 0
+ DesignLeft = 610
+ DesignTop = 313
+ object cbGenConfigFile: TCheckBox
+ AnchorSideLeft.Control = Owner
+ AnchorSideTop.Control = Owner
+ Left = 16
+ Height = 23
+ Top = 8
+ Width = 192
+ BorderSpacing.Left = 16
+ BorderSpacing.Top = 8
+ Caption = 'Generate Delphi config file '
+ TabOrder = 0
+ end
+ object lblAdditionalOptions: TLabel
+ AnchorSideLeft.Control = cbGenConfigFile
+ AnchorSideTop.Control = cbGenConfigFile
+ AnchorSideTop.Side = asrBottom
+ Left = 16
+ Height = 16
+ Top = 39
+ Width = 167
+ BorderSpacing.Top = 8
+ Caption = 'Additional compiler options'
+ ParentColor = False
+ ParentShowHint = False
+ ShowHint = True
+ end
+ object cbAdditionalOptions: TComboBox
+ AnchorSideLeft.Control = lblAdditionalOptions
+ AnchorSideTop.Control = lblAdditionalOptions
+ AnchorSideTop.Side = asrBottom
+ Left = 16
+ Height = 27
+ Top = 63
+ Width = 696
+ Anchors = [akTop, akLeft, akRight]
+ BorderSpacing.Top = 8
+ ItemHeight = 0
+ TabOrder = 1
+ end
+end
diff --git a/components/compilers/delphi/fraprojectdelphioptions.pas b/components/compilers/delphi/fraprojectdelphioptions.pas
new file mode 100644
index 0000000000..55da02577d
--- /dev/null
+++ b/components/compilers/delphi/fraprojectdelphioptions.pas
@@ -0,0 +1,77 @@
+unit fraprojectdelphioptions;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+ Classes, SysUtils, Forms, Controls, StdCtrls,
+ LazLoggerBase, LazFileUtils, LazUTF8,
+ // IdeIntf
+ LazIDEIntf, ProjectIntf, CompOptsIntf, IDEOptionsIntf, IDEOptEditorIntf,
+ delphioptions, strdelphitool, delphitool;
+
+type
+
+ { TProjectDelphiOptionsFrame }
+
+ TProjectDelphiOptionsFrame = class(TAbstractIDEOptionsEditor)
+ cbAdditionalOptions: TComboBox;
+ cbGenConfigFile: TCheckBox;
+ lblAdditionalOptions: TLabel;
+ private
+
+ public
+ function GetTitle: string; override;
+ procedure Setup({%H-}ADialog: TAbstractOptionsEditorDialog); override;
+ procedure ReadSettings(AOptions: TAbstractIDEOptions); override;
+ procedure WriteSettings(AOptions: TAbstractIDEOptions); override;
+ class function SupportedOptionsClass: TAbstractIDEOptionsClass; override;
+ end;
+
+implementation
+
+{$R *.lfm}
+
+{ TProjectDelphiOptionsFrame }
+
+function TProjectDelphiOptionsFrame.GetTitle: string;
+begin
+ Result:=SDelphiToolOptionsTitle
+end;
+
+procedure TProjectDelphiOptionsFrame.Setup(ADialog: TAbstractOptionsEditorDialog);
+begin
+ lblAdditionalOptions.Caption:=SDelphiCompilerArgs;
+ cbGenConfigFile.Caption:=SGenerateConfigFileCaption;
+end;
+
+procedure TProjectDelphiOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions);
+Var
+ Prj : TLazProject;
+
+begin
+ if AOptions=nil then ;
+ Prj:=LazarusIDE.ActiveProject;
+ cbGenConfigFile.Checked:=Prj.GenerateDelphiConfigFile;
+ cbAdditionalOptions.Text:=Prj.AdditionalDelphiOptions;
+end;
+
+procedure TProjectDelphiOptionsFrame.WriteSettings(AOptions: TAbstractIDEOptions);
+Var
+ Prj : TLazProject;
+
+begin
+ if AOptions=nil then ;
+ Prj:=LazarusIDE.ActiveProject;
+ Prj.GenerateDelphiConfigFile:=cbGenConfigFile.Checked;
+ Prj.AdditionalDelphiOptions:=cbAdditionalOptions.Text;
+end;
+
+class function TProjectDelphiOptionsFrame.SupportedOptionsClass: TAbstractIDEOptionsClass;
+begin
+ Result:=TAbstractIDEProjectOptions;
+end;
+
+end.
+
diff --git a/components/compilers/delphi/lazdelphi.lpk b/components/compilers/delphi/lazdelphi.lpk
index bfedb9a5f2..852736f0b1 100644
--- a/components/compilers/delphi/lazdelphi.lpk
+++ b/components/compilers/delphi/lazdelphi.lpk
@@ -31,6 +31,10 @@
+ -
+
+
+
-
diff --git a/components/compilers/delphi/lazdelphi.pas b/components/compilers/delphi/lazdelphi.pas
index 8a687be395..9f11a37355 100644
--- a/components/compilers/delphi/lazdelphi.pas
+++ b/components/compilers/delphi/lazdelphi.pas
@@ -9,7 +9,7 @@ interface
uses
LazDelphiReg, delphitool, fradelphioptions, strdelphitool, delphioptions,
- LazarusPackageIntf;
+ fraprojectdelphioptions, LazarusPackageIntf;
implementation
diff --git a/components/compilers/delphi/lazdelphireg.pas b/components/compilers/delphi/lazdelphireg.pas
index 42d58bba1f..419a71266f 100644
--- a/components/compilers/delphi/lazdelphireg.pas
+++ b/components/compilers/delphi/lazdelphireg.pas
@@ -5,13 +5,15 @@ unit LazDelphiReg;
interface
uses
- Classes, SysUtils, IDEIntf, IDEOptionsIntf, IDEOptEditorIntf, IDEExternToolIntf, delphitool, fradelphioptions;
+ Classes, SysUtils, IDEIntf, IDEOptionsIntf, IDEOptEditorIntf, IDEExternToolIntf, delphitool,
+ fradelphioptions, fraprojectdelphioptions;
var
IDEDelphiCompilerParserClass : TDelphiCompilerParserClass = nil;
var
- DelphiToolsFrameID: integer = 1001;
+ DelphiToolsFrameID : integer = 1001;
+ DelphiToolsOptionsIndex : Integer = ProjectOptionsMisc + 100;
procedure Register;
@@ -23,9 +25,10 @@ procedure Register;
begin
if IDEDelphiCompilerParserClass=Nil then
IDEDelphiCompilerParserClass:=TDelphiCompilerParser;
- ExternalToolList.RegisterParser(IDEDelphiCompilerParserClass);
- DelphiToolsFrameID:=RegisterIDEOptionsEditor( GroupEnvironment,TDelphiOptionsFrame, DelphiToolsFrameID)^.Index;
DelphiToolOptions.Load;
+ ExternalToolList.RegisterParser(IDEDelphiCompilerParserClass);
+ DelphiToolsFrameID:=RegisterIDEOptionsEditor(GroupEnvironment,TDelphiOptionsFrame, DelphiToolsFrameID)^.Index;
+ DelphiToolsOptionsIndex:=RegisterIDEOptionsEditor(GroupProject,TProjectDelphiOptionsFrame, DelphiToolsOptionsIndex)^.Index;
TDelphiTool.Instance.Hook;
end;
diff --git a/components/compilers/delphi/strdelphitool.pas b/components/compilers/delphi/strdelphitool.pas
index e9cc6abcb7..c54618f83b 100644
--- a/components/compilers/delphi/strdelphitool.pas
+++ b/components/compilers/delphi/strdelphitool.pas
@@ -18,12 +18,14 @@ const
SSubToolDelphi = 'Delphi';
SDelphiParserName = 'Delphi Compiler';
- // Settings
+ // globoal Settings
KeyCompiler = 'compiler/value';
- KeyGenConfigFile = 'genconfigfile/value';
KeyConfigFileExt = 'configfileext/value';
KeyConvertPaths = 'convertunixpath/value';
-
+ KeyAdditionalOptions = 'additionaloptions/value';
+ // Project settings
+ pKeyAdditionalOptions = 'additionaloptions';
+ pKeyGenConfigFile = 'genconfigfile';
resourcestring
SDelphiLocalizedParserName = 'Delphi Compiler';
@@ -35,7 +37,7 @@ resourcestring
SDelphiCompilerConfigFileName = 'Delphi compiler configuration filename for project';
SDelphiCompileCommand = 'Delphi compile command';
SDelphiCompilerArgs = 'Additional compiler options';
-
+ SSelectDelphiExecutable = 'Select Delphi compiler executable';
implementation