Build Lazarus: allow define defines :)

git-svn-id: trunk@28046 -
This commit is contained in:
juha 2010-11-02 22:30:03 +00:00
parent 7c42bbbec7
commit dca657ef9b
8 changed files with 304 additions and 211 deletions

View File

@ -1,13 +1,13 @@
object ConfigureBuildLazarusDlg: TConfigureBuildLazarusDlg
Left = 333
Height = 658
Top = 113
Width = 653
Height = 692
Top = 99
Width = 633
VertScrollBar.Visible = False
BorderIcons = [biSystemMenu]
Caption = 'ConfigureBuildLazarusDlg'
ClientHeight = 658
ClientWidth = 653
ClientHeight = 692
ClientWidth = 633
Constraints.MinHeight = 400
Constraints.MinWidth = 305
OnCreate = FormCreate
@ -17,18 +17,18 @@ object ConfigureBuildLazarusDlg: TConfigureBuildLazarusDlg
LCLVersion = '0.9.29'
object DetailsPanel: TPanel
Left = 0
Height = 620
Height = 648
Top = 0
Width = 653
Width = 633
Align = alClient
ClientHeight = 620
ClientWidth = 653
ClientHeight = 648
ClientWidth = 633
TabOrder = 0
object BuildProfileLabel: TLabel
Left = 8
Height = 14
Height = 16
Top = 17
Width = 56
Width = 72
BorderSpacing.Top = 7
BorderSpacing.Around = 6
Caption = 'Build Profile'
@ -37,14 +37,13 @@ object ConfigureBuildLazarusDlg: TConfigureBuildLazarusDlg
object LCLInterfaceRadioGroup: TRadioGroup
AnchorSideLeft.Control = MakeModeListHeader
AnchorSideLeft.Side = asrBottom
AnchorSideRight.Control = DetailSettingPanel
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = MakeModeListBox
AnchorSideBottom.Side = asrBottom
Left = 398
Height = 253
Height = 240
Top = 50
Width = 248
Width = 234
Anchors = [akTop, akLeft, akRight, akBottom]
AutoFill = True
BorderSpacing.Left = 6
@ -62,21 +61,21 @@ object ConfigureBuildLazarusDlg: TConfigureBuildLazarusDlg
end
object DetailSettingPanel: TPanel
Left = 1
Height = 310
Top = 309
Width = 651
Height = 351
Top = 296
Width = 631
Align = alBottom
BevelOuter = bvNone
ClientHeight = 310
ClientWidth = 651
ClientHeight = 351
ClientWidth = 631
TabOrder = 1
object OptionsLabel: TLabel
AnchorSideLeft.Control = DetailSettingPanel
AnchorSideTop.Control = OptionsMemo
Left = 7
Height = 14
Top = 13
Width = 38
Height = 16
Top = 94
Width = 49
Alignment = taRightJustify
BorderSpacing.Left = 7
Caption = 'Options'
@ -88,9 +87,9 @@ object ConfigureBuildLazarusDlg: TConfigureBuildLazarusDlg
AnchorSideTop.Control = TargetOSComboBox
AnchorSideTop.Side = asrCenter
Left = 7
Height = 14
Top = 95
Width = 50
Height = 16
Top = 42
Width = 63
Alignment = taRightJustify
Caption = 'Target OS'
ParentColor = False
@ -100,10 +99,11 @@ object ConfigureBuildLazarusDlg: TConfigureBuildLazarusDlg
AnchorSideTop.Control = TargetDirectoryComboBox
AnchorSideTop.Side = asrCenter
Left = 7
Height = 14
Top = 122
Width = 80
Height = 16
Top = 15
Width = 102
Alignment = taRightJustify
Anchors = [akTop]
Caption = 'Target Directory'
ParentColor = False
end
@ -112,96 +112,93 @@ object ConfigureBuildLazarusDlg: TConfigureBuildLazarusDlg
AnchorSideTop.Control = TargetCPUComboBox
AnchorSideTop.Side = asrCenter
Left = 7
Height = 14
Top = 149
Width = 56
Height = 16
Top = 69
Width = 69
Alignment = taRightJustify
Caption = 'Target CPU'
ParentColor = False
end
object TargetDirectoryComboBox: TComboBox
AnchorSideLeft.Control = TargetOSComboBox
AnchorSideTop.Control = TargetOSComboBox
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = TargetDirectoryButton
Left = 151
AnchorSideTop.Control = DetailSettingPanel
Left = 135
Height = 21
Top = 119
Width = 450
Top = 13
Width = 429
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 6
ItemHeight = 13
BorderSpacing.Top = 13
ItemHeight = 0
TabOrder = 0
end
object TargetDirectoryButton: TButton
AnchorSideLeft.Control = TargetDirectoryComboBox
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = TargetDirectoryComboBox
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = DetailSettingPanel
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = TargetDirectoryComboBox
AnchorSideBottom.Side = asrBottom
Left = 607
Left = 576
Height = 23
Top = 118
Width = 38
Anchors = [akTop, akRight]
AutoSize = True
BorderSpacing.Left = 6
Top = 12
Width = 44
BorderSpacing.Left = 12
BorderSpacing.Right = 6
Caption = '...'
OnClick = TargetDirectoryButtonClick
TabOrder = 1
end
object TargetCPUComboBox: TComboBox
AnchorSideLeft.Control = TargetDirectoryComboBox
AnchorSideTop.Control = TargetDirectoryComboBox
AnchorSideLeft.Control = TargetOSComboBox
AnchorSideTop.Control = TargetOSComboBox
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = DetailSettingPanel
AnchorSideRight.Side = asrBottom
Left = 151
Left = 135
Height = 21
Top = 146
Width = 494
Anchors = [akTop, akLeft, akRight]
Top = 67
Width = 226
BorderSpacing.Top = 6
BorderSpacing.Right = 6
ItemHeight = 13
ItemHeight = 0
TabOrder = 2
end
object RestartAfterBuildCheckBox: TCheckBox
AnchorSideLeft.Control = SelectedCheckBox
AnchorSideLeft.Control = DetailSettingPanel
AnchorSideTop.Control = CommonsDividerBevel
AnchorSideTop.Side = asrBottom
Left = 7
Height = 17
Top = 261
Width = 148
Height = 20
Top = 267
Width = 189
BorderSpacing.Left = 7
BorderSpacing.Top = 10
BorderSpacing.Bottom = 6
Caption = 'RestartAfterBuildCheckBox'
TabOrder = 3
end
object ConfirmBuildCheckBox: TCheckBox
AnchorSideLeft.Control = WithStaticPackagesCheckBox
AnchorSideLeft.Control = RestartAfterBuildCheckBox
AnchorSideTop.Control = RestartAfterBuildCheckBox
AnchorSideTop.Side = asrCenter
Left = 301
Height = 17
Top = 261
Width = 124
AnchorSideTop.Side = asrBottom
Left = 7
Height = 20
Top = 293
Width = 159
BorderSpacing.Top = 6
Caption = 'ConfirmBuildCheckBox'
TabOrder = 4
end
object CleanAllCheckBox: TCheckBox
AnchorSideLeft.Control = DetailSettingPanel
AnchorSideTop.Control = TargetCPUComboBox
AnchorSideTop.Control = OptionsMemo
AnchorSideTop.Side = asrBottom
AnchorSideRight.Side = asrBottom
Left = 301
Height = 17
Left = 7
Height = 20
Top = 177
Width = 103
BorderSpacing.Left = 301
Width = 132
BorderSpacing.Left = 7
BorderSpacing.Top = 10
BorderSpacing.Bottom = 6
Caption = 'CleanAllCheckBox'
@ -212,63 +209,50 @@ object ConfigureBuildLazarusDlg: TConfigureBuildLazarusDlg
AnchorSideTop.Control = CleanAllCheckBox
AnchorSideTop.Side = asrBottom
AnchorSideBottom.Side = asrBottom
Left = 301
Height = 17
Top = 200
Width = 159
Left = 7
Height = 20
Top = 203
Width = 206
BorderSpacing.Top = 6
Caption = 'WithStaticPackagesCheckBox'
TabOrder = 6
end
object TargetOSComboBox: TComboBox
AnchorSideLeft.Control = OptionsMemo
AnchorSideTop.Control = OptionsMemo
AnchorSideTop.Control = TargetDirectoryComboBox
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = DetailSettingPanel
AnchorSideRight.Side = asrBottom
Left = 151
Left = 135
Height = 21
Top = 92
Width = 494
Anchors = [akTop, akLeft, akRight]
Top = 40
Width = 226
BorderSpacing.Top = 6
BorderSpacing.Right = 6
ItemHeight = 13
ItemHeight = 0
TabOrder = 7
end
object UpdateRevisionIncCheckBox: TCheckBox
AnchorSideLeft.Control = TargetCPULabel
AnchorSideTop.Control = TargetCPUComboBox
AnchorSideLeft.Control = DetailSettingPanel
AnchorSideTop.Control = OptionsMemo
AnchorSideTop.Side = asrBottom
AnchorSideBottom.Side = asrBottom
Left = 7
Height = 17
Left = 210
Height = 20
Top = 177
Width = 155
Width = 198
BorderSpacing.Left = 210
BorderSpacing.Top = 10
Caption = 'UpdateRevisionIncCheckBox'
TabOrder = 8
end
object SelectedCheckBox: TCheckBox
AnchorSideLeft.Control = UpdateRevisionIncCheckBox
AnchorSideTop.Control = UpdateRevisionIncCheckBox
AnchorSideTop.Side = asrBottom
Left = 7
Height = 17
Top = 200
Width = 106
BorderSpacing.Top = 6
Caption = 'SelectedCheckBox'
TabOrder = 9
end
object CommonsDividerBevel: TDividerBevel
AnchorSideLeft.Control = DetailSettingPanel
AnchorSideTop.Control = WithStaticPackagesCheckBox
AnchorSideTop.Side = asrBottom
Left = 7
Height = 17
Top = 234
Width = 637
Top = 240
Width = 616
Caption = 'CommonsDividerBevel'
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 7
@ -277,22 +261,54 @@ object ConfigureBuildLazarusDlg: TConfigureBuildLazarusDlg
ParentFont = False
end
object OptionsMemo: TMemo
AnchorSideTop.Control = DetailSettingPanel
AnchorSideRight.Control = DetailSettingPanel
AnchorSideRight.Side = asrBottom
Left = 151
AnchorSideLeft.Control = TargetDirectoryComboBox
AnchorSideTop.Control = TargetCPUComboBox
AnchorSideTop.Side = asrBottom
Left = 135
Height = 73
Top = 13
Width = 494
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Top = 13
BorderSpacing.Right = 6
Top = 94
Width = 226
BorderSpacing.Top = 6
Lines.Strings = (
'Memo1'
''
)
ScrollBars = ssAutoBoth
TabOrder = 9
end
object DefinesListBox: TCheckListBox
AnchorSideTop.Control = TargetOSComboBox
Left = 447
Height = 193
Top = 40
Width = 176
Anchors = [akLeft, akRight]
ItemHeight = 0
TabOrder = 10
end
object DefinesLabel: TLabel
AnchorSideTop.Control = DefinesListBox
Left = 383
Height = 16
Top = 40
Width = 47
Caption = 'Defines'
ParentColor = False
end
object DefinesButton: TButton
AnchorSideTop.Control = CommonsDividerBevel
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = DefinesListBox
AnchorSideRight.Side = asrCenter
Left = 482
Height = 25
Top = 264
Width = 106
Anchors = [akTop, akRight]
BorderSpacing.Top = 7
Caption = 'Edit Defines'
OnClick = DefinesButtonClick
TabOrder = 11
end
end
object MakeModeListHeader: THeaderControl
AnchorSideLeft.Control = DetailSettingPanel
@ -315,7 +331,7 @@ object ConfigureBuildLazarusDlg: TConfigureBuildLazarusDlg
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = DetailSettingPanel
Left = 1
Height = 228
Height = 215
Top = 75
Width = 391
Anchors = [akTop, akLeft, akRight, akBottom]
@ -335,15 +351,15 @@ object ConfigureBuildLazarusDlg: TConfigureBuildLazarusDlg
AnchorSideTop.Control = BuildProfileLabel
AnchorSideTop.Side = asrCenter
AnchorSideRight.Control = BuildProfileButton
Left = 70
Left = 86
Height = 21
Hint = 'Name of the active profile.'
Top = 14
Width = 532
Top = 15
Width = 459
Anchors = [akTop, akLeft, akRight]
BorderSpacing.Left = 6
BorderSpacing.Right = 6
ItemHeight = 13
ItemHeight = 0
OnSelect = BuildProfileComboBoxSelect
ParentShowHint = False
ShowHint = True
@ -356,11 +372,11 @@ object ConfigureBuildLazarusDlg: TConfigureBuildLazarusDlg
AnchorSideRight.Control = DetailsPanel
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Side = asrBottom
Left = 608
Height = 23
Left = 551
Height = 25
Hint = 'Manage profiles'
Top = 13
Width = 38
Width = 75
Anchors = [akTop, akRight]
AutoSize = True
BorderSpacing.Left = 6
@ -375,18 +391,18 @@ object ConfigureBuildLazarusDlg: TConfigureBuildLazarusDlg
object CBLDBtnPanel: TPanel
AnchorSideTop.Side = asrBottom
Left = 0
Height = 38
Top = 620
Width = 653
Height = 44
Top = 648
Width = 633
Align = alBottom
AutoSize = True
BevelOuter = bvNone
ClientHeight = 38
ClientWidth = 653
ClientHeight = 44
ClientWidth = 633
TabOrder = 1
object CancelButton: TBitBtn
Left = 570
Height = 26
Left = 550
Height = 32
Top = 6
Width = 77
Align = alRight
@ -400,10 +416,10 @@ object ConfigureBuildLazarusDlg: TConfigureBuildLazarusDlg
TabOrder = 0
end
object SaveSettingsButton: TBitBtn
Left = 473
Height = 26
Left = 449
Height = 32
Top = 6
Width = 91
Width = 95
Align = alRight
AutoSize = True
BorderSpacing.Around = 6
@ -413,10 +429,10 @@ object ConfigureBuildLazarusDlg: TConfigureBuildLazarusDlg
TabOrder = 1
end
object CompileButton: TBitBtn
Left = 291
Height = 26
Left = 238
Height = 32
Top = 6
Width = 63
Width = 75
Align = alRight
AutoSize = True
BorderSpacing.Around = 6
@ -427,9 +443,9 @@ object ConfigureBuildLazarusDlg: TConfigureBuildLazarusDlg
end
object HelpButton: TBitBtn
Left = 6
Height = 26
Height = 32
Top = 6
Width = 66
Width = 75
Align = alLeft
AutoSize = True
BorderSpacing.Around = 6
@ -439,17 +455,17 @@ object ConfigureBuildLazarusDlg: TConfigureBuildLazarusDlg
OnClick = HelpButtonClick
TabOrder = 3
end
object CompileSelectedButton: TBitBtn
Left = 360
Height = 26
object CompileAdvancedButton: TBitBtn
Left = 319
Height = 32
Top = 6
Width = 107
Width = 124
Align = alRight
AutoSize = True
BorderSpacing.Around = 6
Caption = 'Compile Selected'
Caption = 'Compile Advanced'
NumGlyphs = 0
OnClick = CompileSelectedButtonClick
OnClick = CompileAdvancedButtonClick
TabOrder = 4
end
end

View File

@ -46,7 +46,7 @@ interface
uses
Classes, SysUtils, LCLProc, LConvEncoding, Forms, Controls, LCLType, LCLIntf,
Graphics, GraphType, StdCtrls, ExtCtrls, Buttons, FileUtil, Dialogs, Types,
InterfaceBase, Themes, ComCtrls,
InterfaceBase, Themes, ComCtrls, CheckLst,
DefineTemplates, Laz_XMLCfg, DividerBevel,
LazarusIDEStrConsts, TransferMacros, LazConf, IDEProcs, DialogProcs,
IDEMsgIntf, IDEContextHelpEdit, IDEImagesIntf, MainBar,
@ -54,7 +54,7 @@ uses
{$IFDEF win32}
CodeToolManager, // added for windres workaround
{$ENDIF}
ApplicationBundle, CompilerOptions, BuildProfileManager;
ApplicationBundle, CompilerOptions, BuildProfileManager, GenericListEditor;
type
@ -71,15 +71,17 @@ type
{ TConfigureBuildLazarusDlg }
TConfigureBuildLazarusDlg = class(TForm)
DefinesButton: TButton;
CancelButton: TBitBtn;
CBLDBtnPanel: TPanel;
DefinesListBox: TCheckListBox;
CleanAllCheckBox: TCheckBox;
BuildProfileComboBox: TComboBox;
CompileButton: TBitBtn;
CompileSelectedButton: TBitBtn;
CompileAdvancedButton: TBitBtn;
ConfirmBuildCheckBox: TCheckBox;
DefinesLabel: TLabel;
OptionsMemo: TMemo;
SelectedCheckBox: TCheckBox;
DetailsPanel: TPanel;
CommonsDividerBevel: TDividerBevel;
HelpButton: TBitBtn;
@ -104,8 +106,9 @@ type
WithStaticPackagesCheckBox: TCheckBox;
procedure BuildProfileButtonClick(Sender: TObject);
procedure BuildProfileComboBoxSelect(Sender: TObject);
procedure CompileSelectedButtonClick(Sender: TObject);
procedure CompileAdvancedButtonClick(Sender: TObject);
procedure CompileButtonClick(Sender: TObject);
procedure DefinesButtonClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
procedure FormShow(Sender: TObject);
@ -354,7 +357,7 @@ function CreateBuildLazarusOptions(Profiles: TBuildLazarusProfiles;
const PackageOptions: string; Flags: TBuildLazarusFlags;
var AExOptions: string; out UpdateRevisionInc: boolean;
out OutputDirRedirected: boolean): TModalResult;
{
function RemoveProfilerOption(const ExtraOptions: string): string;
var
p, StartPos: integer;
@ -372,7 +375,7 @@ function CreateBuildLazarusOptions(Profiles: TBuildLazarusProfiles;
System.Delete(Result,StartPos,p-StartPos+3);
end;
end;
}
procedure AppendExtraOption(const AddOption: string; EncloseIfSpace: boolean);
begin
if AddOption='' then exit;
@ -767,20 +770,19 @@ begin
CleanAllCheckBox.Caption := lisLazBuildCleanAll;
WithStaticPackagesCheckBox.Caption := lisLazBuildWithStaticPackages;
UpdateRevisionIncCheckBox.Caption := lisLazBuildUpdateRevInc;
SelectedCheckBox.Caption := lisLazBuildSelected;
CommonsDividerBevel.Caption := lisLazBuildCommonSettings;
RestartAfterBuildCheckBox.Caption := lisLazBuildRestartAfterBuild;
ConfirmBuildCheckBox.Caption := lisLazBuildConfirmBuild;
CompileButton.Caption := lisMenuBuild;
CompileSelectedButton.Caption := lisMenuBuildAll;
CompileAdvancedButton.Caption := lisLazBuildAdvanced;
SaveSettingsButton.Caption := lisLazBuildSaveSettings;
CancelButton.Caption := lisLazBuildCancel;
HelpButton.Caption := lisMenuHelp;
CompileButton.LoadGlyphFromLazarusResource('menu_build');
CompileSelectedButton.LoadGlyphFromLazarusResource('menu_build_all');
CompileAdvancedButton.LoadGlyphFromLazarusResource('menu_build_all');
SaveSettingsButton.LoadGlyphFromStock(idButtonSave);
if SaveSettingsButton.Glyph.Empty then
SaveSettingsButton.LoadGlyphFromLazarusResource('laz_save');
@ -994,35 +996,46 @@ begin
end;
procedure TConfigureBuildLazarusDlg.CopyProfileToUI(AProfile: TBuildLazarusProfile);
var
i: Integer;
begin
CleanAllCheckBox.Checked :=AProfile.CleanAll;
OptionsMemo.Text :=AProfile.ExtraOptions;
LCLInterfaceRadioGroup.ItemIndex :=ord(AProfile.TargetPlatform);
WithStaticPackagesCheckBox.Checked:=AProfile.WithStaticPackages;
UpdateRevisionIncCheckBox.Checked :=AProfile.UpdateRevisionInc;
SelectedCheckBox.Checked :=AProfile.Selected;
TargetOSComboBox.Text :=AProfile.TargetOS;
TargetDirectoryComboBox.Text :=AProfile.TargetDirectory;
TargetCPUComboBox.Text :=AProfile.TargetCPU;
OptionsMemo.Lines.Assign(AProfile.OptionsLines);
for i:=0 to DefinesListBox.Items.Count-1 do
DefinesListBox.Checked[i]:=AProfile.Defines.IndexOf(DefinesListBox.Items[i]) > -1;
end;
procedure TConfigureBuildLazarusDlg.CopyUIToProfile(AProfile: TBuildLazarusProfile);
var
i: Integer;
begin
AProfile.CleanAll :=CleanAllCheckBox.Checked;
AProfile.ExtraOptions :=OptionsMemo.Text;
AProfile.TargetPlatform :=TLCLPlatform(LCLInterfaceRadioGroup.ItemIndex);
AProfile.WithStaticPackages:=WithStaticPackagesCheckBox.Checked;
AProfile.UpdateRevisionInc :=UpdateRevisionIncCheckBox.Checked;
AProfile.Selected :=SelectedCheckBox.Checked;
AProfile.TargetOS :=TargetOSComboBox.Text;
AProfile.TargetDirectory :=TargetDirectoryComboBox.Text;
AProfile.TargetCPU :=TargetCPUComboBox.Text;
AProfile.OptionsLines.Assign(OptionsMemo.Lines);
AProfile.Defines.Clear;
for i:=0 to DefinesListBox.Items.Count-1 do
if DefinesListBox.Checked[i] then
AProfile.Defines.Add(DefinesListBox.Items[i]);
end;
procedure TConfigureBuildLazarusDlg.UpdateProfileNamesUI;
var
i: Integer;
begin
// List of defines to checklistbox.
for i:=0 to fProfiles.AllDefines.Count-1 do
DefinesListBox.Items.Add(fProfiles.AllDefines[i]);
// Update the Profiles ComboBox.
fUpdatingProfileCombo:=True;
BuildProfileComboBox.Items.BeginUpdate;
@ -1035,7 +1048,7 @@ begin
fUpdatingProfileCombo:=False;
RestartAfterBuildCheckBox.Checked:=fProfiles.RestartAfterBuild;
ConfirmBuildCheckBox.Checked :=fProfiles.ConfirmBuild;
MakeModeListBox.Invalidate;
MakeModeListBox.Invalidate; // Triggers owner-drawn update.
end;
function TConfigureBuildLazarusDlg.GetMakeModeAtX(const X: Integer;
@ -1082,7 +1095,7 @@ begin
Format(lisMenuBuildLazarusProf, [Profiles.Current.Name]);
end;
procedure TConfigureBuildLazarusDlg.CompileSelectedButtonClick(Sender: TObject);
procedure TConfigureBuildLazarusDlg.CompileAdvancedButtonClick(Sender: TObject);
begin
PrepareClose;
ModalResult:=mrAll;
@ -1100,6 +1113,29 @@ begin
ModalResult:=mrOk;
end;
procedure TConfigureBuildLazarusDlg.DefinesButtonClick(Sender: TObject);
var
EditForm: TGenericListEditForm;
i: Integer;
begin
EditForm:=TGenericListEditForm.Create(Nil);
try
EditForm.Caption:='Edit Defines';
EditForm.Memo1.Lines.Assign(fProfiles.AllDefines);
if EditForm.ShowModal=mrOK then begin
CopyUIToProfile(Profiles.Current); // Make sure changed fields don't get lost.
fProfiles.AllDefines.Assign(EditForm.Memo1.Lines);
DefinesListBox.Items.Clear;
for i:=0 to fProfiles.AllDefines.Count-1 do
DefinesListBox.Items.Add(fProfiles.AllDefines[i]);
for i:=0 to DefinesListBox.Items.Count-1 do // Check the right boxes again.
DefinesListBox.Checked[i]:=fProfiles.Current.Defines.IndexOf(DefinesListBox.Items[i]) > -1;
end;
finally
EditForm.Free;
end;
end;
procedure TConfigureBuildLazarusDlg.BuildProfileButtonClick(Sender: TObject);
var
Frm: TBuildProfileManagerForm;

View File

@ -8,6 +8,7 @@ object BuildProfileManagerForm: TBuildProfileManagerForm
ClientWidth = 360
OnCreate = FormCreate
OnDestroy = FormDestroy
Position = poScreenCenter
LCLVersion = '0.9.29'
object ProfilesPanel: TPanel
Left = 0
@ -40,21 +41,21 @@ object BuildProfileManagerForm: TBuildProfileManagerForm
OnClick = MoveDownButtonClick
end
object MoveUpButton: TToolButton
Left = 201
Left = 246
Top = 0
Caption = 'MoveUpButton'
ImageIndex = 3
OnClick = MoveUpButtonClick
end
object EditButton: TToolButton
Left = 139
Left = 171
Top = 0
Caption = 'EditButton'
ImageIndex = 2
OnClick = EditButtonClick
end
object RemoveButton: TToolButton
Left = 60
Left = 73
Top = 0
Caption = 'RemoveButton'
ImageIndex = 1
@ -68,7 +69,7 @@ object BuildProfileManagerForm: TBuildProfileManagerForm
OnClick = AddButtonClick
end
object tbSeparator: TToolButton
Left = 197
Left = 242
Top = 0
Width = 4
Caption = 'tbSeparator'
@ -77,7 +78,7 @@ object BuildProfileManagerForm: TBuildProfileManagerForm
end
object ProfilesListBox: TListBox
Left = 1
Height = 327
Height = 321
Top = 93
Width = 358
Align = alClient
@ -87,8 +88,8 @@ object BuildProfileManagerForm: TBuildProfileManagerForm
end
object ButtonPanel: TButtonPanel
Left = 7
Height = 26
Top = 426
Height = 32
Top = 420
Width = 346
OKButton.Name = 'OKButton'
OKButton.Caption = '&ОК'

View File

@ -113,17 +113,20 @@ type
fOwnerCnt: TBuildLazarusProfiles;
fName: string;
fCleanAll: boolean;
fExtraOptions: string;
fTargetOS: string;
fTargetDirectory: string;
fTargetCPU: string;
fTargetPlatform: TLCLPlatform;
fWithStaticPackages: boolean;
fUpdateRevisionInc: boolean;
fSelected: boolean;
// User defined options.
fOptions: TStringList;
// Defines selected for this profile.
fDefines: TStringList;
// MakeModeSettings is Synchronised with TMakeModeDefs, same indexes.
fMakeModes: TMakeModeSettings;
function GetExtraOptions: string;
function GetTargetPlatform: TLCLPlatform;
procedure SetExtraOptions(const AValue: string);
procedure SetTargetCPU(const AValue: string);
@ -139,15 +142,16 @@ type
function FPCTargetCPU: string;
public
property Name: string read fName;
property ExtraOptions: string read GetExtraOptions write SetExtraOptions;
property CleanAll: boolean read fCleanAll write fCleanAll;
property ExtraOptions: string read fExtraOptions write SetExtraOptions;
property TargetOS: string read fTargetOS write SetTargetOS;
property TargetDirectory: string read fTargetDirectory write fTargetDirectory;
property TargetCPU: string read fTargetCPU write SetTargetCPU;
property TargetPlatform: TLCLPlatform read GetTargetPlatform write SetTargetPlatform;
property WithStaticPackages: boolean read fWithStaticPackages write fWithStaticPackages;
property UpdateRevisionInc: boolean read fUpdateRevisionInc write fUpdateRevisionInc;
property Selected: boolean read fSelected write fSelected;
property OptionsLines: TStringList read fOptions;
property Defines: TStringList read fDefines;
property MakeModes: TMakeModeSettings read fMakeModes;
end;
@ -159,6 +163,7 @@ type
fMakeModeDefs: TMakeModeDefs;
fRestartAfterBuild: boolean;
fConfirmBuild: boolean;
fAllDefines: TStringList;
fStaticAutoInstallPackages: TStringList;
fCurrentIndex: integer;
function GetCurrentIdeMode: TMakeMode;
@ -169,6 +174,7 @@ type
destructor Destroy; override;
procedure Clear; override;
procedure Assign(Source: TBuildLazarusProfiles);
function IndexByName(AName: string): integer;
procedure CreateDefaults;
procedure Load(XMLConfig: TXMLConfig; const Path: string; const FileVersion: integer);
procedure Save(XMLConfig: TXMLConfig; const Path: string);
@ -179,6 +185,7 @@ type
property MakeModeDefs: TMakeModeDefs read fMakeModeDefs;
property RestartAfterBuild: boolean read fRestartAfterBuild write fRestartAfterBuild;
property ConfirmBuild: boolean read fConfirmBuild write fConfirmBuild;
property AllDefines: TStringList read fAllDefines;
property StaticAutoInstallPackages: TStringList read fStaticAutoInstallPackages;
property CurrentIndex: integer read fCurrentIndex write fCurrentIndex;
property Current: TBuildLazarusProfile read GetCurrentProfile;
@ -379,10 +386,11 @@ var
i: Integer;
begin
Result:=nil;
for i:=0 to Count-1 do if CompareText(Name,Items[i].Name)=0 then begin
Result:=Items[i];
exit;
end;
for i:=0 to Count-1 do
if CompareText(Name,Items[i].Name)=0 then begin
Result:=Items[i];
exit;
end;
end;
{ TBuildLazarusProfile }
@ -395,6 +403,8 @@ begin
inherited Create;
fOwnerCnt:=AOwnerCnt;
fName:=AName;
fOptions:=TStringList.Create;
fDefines:=TStringList.Create;
// Set default values for MakeModes.
SetLength(fMakeModes, fOwnerCnt.fMakeModeDefs.Count);
for i:=0 to fOwnerCnt.fMakeModeDefs.Count-1 do
@ -403,6 +413,8 @@ end;
destructor TBuildLazarusProfile.Destroy;
begin
fDefines.Free;
fOptions.Free;
inherited Destroy;
end;
@ -418,7 +430,6 @@ begin
Path+'Build'+fMakeModeDefs[i].Name+'/Value',
MakeModeNames[fMakeModeDefs[i].DefaultMakeMode]));
FCleanAll :=XMLConfig.GetValue(Path+'CleanAll/Value',false);
fExtraOptions :=XMLConfig.GetValue(Path+'ExtraOptions/Value','');
TargetOS :=XMLConfig.GetValue(Path+'TargetOS/Value','');
TargetCPU :=XMLConfig.GetValue(Path+'TargetCPU/Value','');
LCLPlatformStr :=XMLConfig.GetValue(Path+'LCLPlatform/Value','');
@ -430,7 +441,10 @@ begin
XMLConfig.GetValue(Path+'TargetDirectory/Value', DefaultTargetDirectory)));
FWithStaticPackages:=XMLConfig.GetValue(Path+'WithStaticPackages/Value',true);
FUpdateRevisionInc :=XMLConfig.GetValue(Path+'UpdateRevisionInc/Value',true);
fSelected :=XMLConfig.GetValue(Path+'BuildWithAll/Value',true);
LoadStringList(XMLConfig,fOptions,Path+'Options/');
if fOptions.Count=0 then // Support a syntax used earlier by profiles.
fOptions.Text:=XMLConfig.GetValue(Path+'ExtraOptions/Value','');
LoadStringList(XMLConfig,fDefines,Path+'Defines/');
end;
procedure TBuildLazarusProfile.Save(XMLConfig: TXMLConfig; const Path: string);
@ -444,7 +458,6 @@ begin
MakeModeNames[fMakeModeDefs[i].DefaultMakeMode]);
end;
XMLConfig.SetDeleteValue(Path+'CleanAll/Value',FCleanAll,false);
XMLConfig.SetDeleteValue(Path+'ExtraOptions/Value',fExtraOptions,'');
XMLConfig.SetDeleteValue(Path+'TargetOS/Value',TargetOS,'');
XMLConfig.SetDeleteValue(Path+'TargetCPU/Value',TargetCPU,'');
XMLConfig.SetDeleteValue(Path+'LCLPlatform/Value',
@ -454,7 +467,8 @@ begin
FTargetDirectory,DefaultTargetDirectory);
XMLConfig.SetDeleteValue(Path+'WithStaticPackages/Value',FWithStaticPackages,true);
XMLConfig.SetDeleteValue(Path+'UpdateRevisionInc/Value',FUpdateRevisionInc,true);
XMLConfig.SetDeleteValue(Path+'BuildWithAll/Value',fSelected,true);
SaveStringList(XMLConfig,fOptions,Path+'Options/');
SaveStringList(XMLConfig,fDefines,Path+'Defines/');
end;
procedure TBuildLazarusProfile.Assign(Source: TBuildLazarusProfile; ACopyName: Boolean);
@ -465,14 +479,14 @@ begin
if ACopyName then
fName :=Source.Name;
CleanAll :=Source.CleanAll;
ExtraOptions :=Source.ExtraOptions;
TargetOS :=Source.TargetOS;
TargetDirectory :=Source.TargetDirectory;
TargetCPU :=Source.TargetCPU;
TargetPlatform :=Source.TargetPlatform;
WithStaticPackages:=Source.WithStaticPackages;
UpdateRevisionInc :=Source.UpdateRevisionInc;
Selected :=Source.Selected;
fOptions.Assign(Source.fOptions);
fDefines.Assign(Source.fDefines);
for i:=0 to Length(fMakeModes)-1 do
fMakeModes[i]:=Source.MakeModes[i];
end;
@ -511,9 +525,22 @@ begin
fTargetPlatform:=AValue;
end;
function TBuildLazarusProfile.GetExtraOptions: string;
var
i: Integer;
begin
Result:='';
for i:=0 to fOptions.Count-1 do
Result:=Result+' '+fOptions[i];
Result:=Trim(Result);
for i:=0 to fDefines.Count-1 do
Result:=Result+' -d'+fDefines[i];
Result:=Trim(Result);
end;
procedure TBuildLazarusProfile.SetExtraOptions(const AValue: string);
begin
fExtraOptions:=Trim(StringReplace(AValue, sLineBreak, ' ', [rfReplaceAll]));
raise Exception.Create('SetExtraOptions should not be called.');
end;
@ -526,6 +553,7 @@ begin
fMakeModeDefs:=TMakeModeDefs.Create;
fRestartAfterBuild:=True;
fConfirmBuild:=True;
fAllDefines:=TStringList.Create;
fStaticAutoInstallPackages:=TStringList.Create;
end;
@ -536,10 +564,12 @@ begin
inherited Destroy;
// Clear is called by inherited Destroy. Must be freed later.
fStaticAutoInstallPackages.Free;
fAllDefines.Free;
end;
procedure TBuildLazarusProfiles.Clear;
begin
fAllDefines.Clear;
fStaticAutoInstallPackages.Clear;
inherited Clear;
end;
@ -554,7 +584,8 @@ begin
fGlobals.TargetOS:=Source.fGlobals.TargetOS;
fMakeModeDefs.Assign(Source.MakeModeDefs);
RestartAfterBuild :=Source.RestartAfterBuild;
ConfirmBuild :=Source.ConfirmBuild;
ConfirmBuild:=Source.ConfirmBuild;
fAllDefines.Assign(Source.fAllDefines);
fStaticAutoInstallPackages.Assign(Source.fStaticAutoInstallPackages);
fCurrentIndex:=Source.fCurrentIndex;
for i:=0 to Source.Count-1 do begin
@ -565,6 +596,18 @@ begin
end;
end;
function TBuildLazarusProfiles.IndexByName(AName: string): integer;
var
i: Integer;
begin
Result:=-1;
for i:=0 to Count-1 do
if Items[i].Name=AName then begin
Result:=i;
break;
end;
end;
procedure TBuildLazarusProfiles.CreateDefaults;
var
i: Integer;
@ -579,7 +622,6 @@ begin
fCleanAll:=False;
fTargetPlatform:=Platfrm;
fWithStaticPackages:=False;
fSelected:=True;
for i:=0 to fMakeModeDefs.Count-1 do
if fMakeModeDefs[i].Description=lisLCL then
fMakeModes[i]:=mmBuild
@ -594,7 +636,6 @@ begin
fCleanAll:=False;
fTargetPlatform:=Platfrm;
fWithStaticPackages:=True;
fSelected:=False;
for i:=0 to fMakeModeDefs.Count-1 do
if fMakeModeDefs[i].Description=lisIDE then
fMakeModes[i]:=mmBuild
@ -609,7 +650,6 @@ begin
fCleanAll:=False;
fTargetPlatform:=Platfrm;
fWithStaticPackages:=False;
fSelected:=False;
for i:=0 to fMakeModeDefs.Count-1 do
if fMakeModeDefs[i].Description=lisIDE then
fMakeModes[i]:=mmBuild
@ -624,7 +664,6 @@ begin
fCleanAll:=False;
fTargetPlatform:=Platfrm;
fWithStaticPackages:=True;
fSelected:=False;
for i:=0 to fMakeModeDefs.Count-1 do
if fMakeModeDefs[i].Description=lisExamples then
fMakeModes[i]:=mmNone // All exept for examples.
@ -639,11 +678,15 @@ begin
fCleanAll:=False;
fTargetPlatform:=Platfrm;
fWithStaticPackages:=True;
fSelected:=False;
for i:=0 to fMakeModeDefs.Count-1 do
fMakeModes[i]:=mmCleanBuild;
end;
Add(Profile);
// Defines to test.
if fAllDefines.Count = 0 then begin
fAllDefines.Add('Debug');
fAllDefines.Add('Verbose');
end;
end;
procedure TBuildLazarusProfiles.Load(XMLConfig: TXMLConfig; const Path: string;
@ -696,8 +739,13 @@ begin
end;
end;
// Load auto install packages.
LoadStringList(XMLConfig,fStaticAutoInstallPackages,
Path+'StaticAutoInstallPackages/');
LoadStringList(XMLConfig,fAllDefines,Path+'AllDefines/');
LoadStringList(XMLConfig,fStaticAutoInstallPackages,Path+'StaticAutoInstallPackages/');
// Defines to test.
if fAllDefines.Count = 0 then begin
fAllDefines.Add('Debug');
fAllDefines.Add('Verbose');
end;
fCurrentIndex:=ProfInd;
end;
@ -720,8 +768,8 @@ begin
XMLConfig.SetDeleteValue(Path+'RestartAfterBuild/Value',FRestartAfterBuild,true);
XMLConfig.SetDeleteValue(Path+'ConfirmBuild/Value',FConfirmBuild,true);
// Save auto install packages
SaveStringList(XMLConfig,fStaticAutoInstallPackages,
Path+'StaticAutoInstallPackages/');
SaveStringList(XMLConfig,fAllDefines,Path+'AllDefines/');
SaveStringList(XMLConfig,fStaticAutoInstallPackages,Path+'StaticAutoInstallPackages/');
end;
procedure TBuildLazarusProfiles.Move(CurIndex, NewIndex: Integer);
@ -814,7 +862,7 @@ begin
NewProfile:=TBuildLazarusProfile.Create(fProfsToManage,NameEdit.Text);
NewProfile.Assign(fProfsToManage.Current, False);
fProfsToManage.Add(NewProfile);
fProfsToManage.fCurrentIndex:=fProfsToManage.Count-1; // Select the new profile.
fProfsToManage.fCurrentIndex:=fProfsToManage.Count-1; // Select the new profile.
// Update ListBox
ProfilesListbox.Items.Add(NameEdit.Text);
ProfilesListbox.ItemIndex:=ProfilesListbox.Count-1;

View File

@ -322,7 +322,7 @@ resourcestring
lisMenuRemoveFromProject = 'Remove from Project ...';
lisMenuViewSource = '&View Source';
lisMenuProjectOptions = 'Project Options ...';
lisMenuBuild = 'Build';
lisBFBuild = 'Build';
lisBFRun = 'Run';
@ -399,9 +399,8 @@ resourcestring
lisMenuConvertDelphiProject = 'Convert Delphi project to Lazarus project ...';
lisMenuConvertDelphiPackage = 'Convert Delphi package to Lazarus package ...';
lisMenuConvertEncoding = 'Convert encoding of projects/packages ...';
lisMenuBuildLazarus = 'Build Lazarus';
lisMenuBuildLazarus = 'Build Lazarus with current profile';
lisMenuBuildLazarusProf = 'Build Lazarus with profile: %s';
lisMenuBuildLazarusAll = 'Build Lazarus with selected profiles';
lisMenuConfigureBuildLazarus = 'Configure "Build Lazarus" ...';
lisMenuGeneralOptions = 'Options ...';
@ -2783,7 +2782,7 @@ resourcestring
lisLazBuildWithStaticPackages = 'With packages';
lisLazBuildRestartAfterBuild = 'Restart after building the IDE';
lisLazBuildUpdateRevInc = 'Update revision.inc';
lisLazBuildSelected = 'Selected';
lisLazBuildAdvanced = 'Build Advanced';
lisLazBuildCommonSettings = 'Common Settings';
lisLazBuildConfirmBuild = 'Confirm before rebuilding Lazarus';
lisLazBuildOk = 'Ok';

View File

@ -323,7 +323,6 @@ type
procedure mnuToolConvertDelphiPackageClicked(Sender: TObject);
procedure mnuToolConvertEncodingClicked(Sender: TObject);
procedure mnuToolBuildLazarusClicked(Sender: TObject);
procedure mnuToolBuildLazarusAllClicked(Sender: TObject);
procedure mnuToolConfigBuildLazClicked(Sender: TObject);
procedure mnuCustomExtToolClick(Sender: TObject);
@ -870,7 +869,7 @@ type
function DoRunExternalTool(Index: integer): TModalResult;
function DoSaveBuildIDEConfigs(Flags: TBuildLazarusFlags): TModalResult; override;
function DoBuildLazarus(Flags: TBuildLazarusFlags): TModalResult; override;
function DoBuildLazarusAll(Flags: TBuildLazarusFlags): TModalResult;
function DoBuildLazarusAll(ProfileNames: TStringList): TModalResult;
function DoBuildFile: TModalResult;
function DoRunFile: TModalResult;
function DoConfigBuildFile: TModalResult;
@ -2505,7 +2504,6 @@ begin
itmToolConvertDelphiPackage.OnClick := @mnuToolConvertDelphiPackageClicked;
itmToolConvertEncoding.OnClick := @mnuToolConvertEncodingClicked;
itmToolBuildLazarus.OnClick := @mnuToolBuildLazarusClicked;
itmToolBuildLazarusAll.OnClick := @mnuToolBuildLazarusAllClicked;
itmToolConfigureBuildLazarus.OnClick := @mnuToolConfigBuildLazClicked;
// Set initial caption for Build Lazarus item. Will be changed in BuildLazDialog.
if Assigned(MiscellaneousOptions) then
@ -4240,11 +4238,6 @@ begin
DoBuildLazarus([]);
end;
procedure TMainIDE.mnuToolBuildLazarusAllClicked(Sender: TObject);
begin
DoBuildLazarusAll([]);
end;
procedure TMainIDE.mnuToolConfigBuildLazClicked(Sender: TObject);
var
CmdLineDefines: TDefineTemplate;
@ -4256,7 +4249,8 @@ begin
if DlgResult in [mrOk,mrYes,mrAll] then begin
MiscellaneousOptions.Save;
if DlgResult=mrAll then begin
DoBuildLazarusAll([]);
ShowMessage('Will let you build many profiles at one go. Under construction...');
// DoBuildLazarusAll(xxx);
end
else if DlgResult=mrYes then begin
LazSrcTemplate:=
@ -11516,12 +11510,12 @@ begin
Result:=mrOK;
end;
function TMainIDE.DoBuildLazarusAll(Flags: TBuildLazarusFlags): TModalResult;
function TMainIDE.DoBuildLazarusAll(ProfileNames: TStringList): TModalResult;
var
CmdLineDefines: TDefineTemplate;
LazSrcTemplate: TDefineTemplate;
LazSrcDirTemplate: TDefineTemplate;
i, RealCurInd: Integer;
i, ProfInd, RealCurInd: Integer;
MayNeedRestart, FoundProfToBuild: Boolean;
s: String;
begin
@ -11532,9 +11526,9 @@ begin
try
FoundProfToBuild:=False;
s:=sLineBreak+sLineBreak;
for i:=0 to BuildLazProfiles.Count-1 do
if BuildLazProfiles[i].Selected then begin
s:=s+BuildLazProfiles[i].Name+sLineBreak;
for i:=0 to ProfileNames.Count-1 do
if BuildLazProfiles.IndexByName(ProfileNames[i])<>-1 then begin
s:=s+ProfileNames[i]+sLineBreak;
FoundProfToBuild:=True;
end;
if not FoundProfToBuild then begin
@ -11545,10 +11539,12 @@ begin
if MessageDlg(Format(lisConfirmBuildAllProfiles, [s+sLineBreak]),
mtConfirmation, mbYesNo, 0)<>mrYes then
exit;
for i:=0 to BuildLazProfiles.Count-1 do begin
if BuildLazProfiles[i].Selected then begin
for i:=0 to ProfileNames.Count-1 do begin
ProfInd:=BuildLazProfiles.IndexByName(ProfileNames[i]);
if ProfInd<>-1 then begin
// Set current profile temporarily, used by the codetools functions.
BuildLazProfiles.CurrentIndex:=ProfInd;
// does not show message: IDEMessagesWindow.AddMsg('Building: '+BuildLazProfiles.Current.Name,'',-1);
BuildLazProfiles.CurrentIndex:=i; // Set current profile temporarily.
LazSrcTemplate:=
CodeToolBoss.DefineTree.FindDefineTemplateByName(StdDefTemplLazarusSources,true);
if Assigned(LazSrcTemplate) then begin

View File

@ -312,7 +312,6 @@ type
itmToolConvertEncoding: TIDEMenuCommand;
//itmBuildingLazarus: TIDEMenuSection;
itmToolBuildLazarus: TIDEMenuCommand;
itmToolBuildLazarusAll: TIDEMenuCommand;
itmToolConfigureBuildLazarus: TIDEMenuCommand;
// environment menu

View File

@ -748,7 +748,6 @@ begin
ParentMI:=itmBuildingLazarus;
CreateMenuItem(ParentMI,itmToolBuildLazarus,'itmToolBuildLazarus',lisMenuBuildLazarus,'menu_build_lazarus');
CreateMenuItem(ParentMI,itmToolBuildLazarusAll,'itmToolBuildLazarusAll',lisMenuBuildLazarusAll,'menu_build_all');
CreateMenuItem(ParentMI,itmToolConfigureBuildLazarus,'itmToolConfigureBuildLazarus',lisMenuConfigureBuildLazarus, 'menu_configure_build_lazarus');
end;
end;
@ -988,7 +987,6 @@ begin
itmToolConvertDelphiPackage.Command:=GetCommand(ecConvertDelphiPackage);
itmToolConvertEncoding.Command:=GetCommand(ecConvertEncoding);
itmToolBuildLazarus.Command:=GetCommand(ecBuildLazarus);
// itmToolBuildLazarusAll.Command:=GetCommand(ecBuildLazarusAll);
itmToolConfigureBuildLazarus.Command:=GetCommand(ecConfigBuildLazarus);
// environment menu