mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-23 01:39:31 +02:00
IDE: create makefile for package: add Makefile.compiled file
git-svn-id: trunk@27834 -
This commit is contained in:
parent
ff76cafd07
commit
0e64f10a02
@ -112,13 +112,14 @@
|
||||
- make active
|
||||
- a popup menu on IDE palette to quickly switch the build mode
|
||||
- a diff tool to compare two build modes
|
||||
- Makefile:
|
||||
- create special Makefile.compiled file, which is copied after compile
|
||||
to be used by the IDE
|
||||
|
||||
ToDo:
|
||||
- create Makefile:
|
||||
- create a special .compiled file
|
||||
- makefile should delete the .compiled before compile
|
||||
- makefile should copy the .compiled after compile
|
||||
- a IDE created with make, without extra options should not recompile a
|
||||
- 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
|
||||
@ -127,8 +128,6 @@
|
||||
- make IDEIntf a package
|
||||
- make LCL a package
|
||||
- make FCL a package
|
||||
- code completion
|
||||
- keypress event
|
||||
- when adding/removing search path: do it for all build modes
|
||||
- add unit to project
|
||||
- remove unit from project
|
||||
@ -423,7 +422,8 @@ type
|
||||
ccloNoLinkerOpts, // exclude linker options
|
||||
ccloAddVerboseAll, // add -va
|
||||
ccloDoNotAppendOutFileOption, // do not add -o option
|
||||
ccloAbsolutePaths
|
||||
ccloAbsolutePaths,
|
||||
ccloNoMacroParams // no search paths, no linker options, no custom options
|
||||
);
|
||||
TCompilerCmdLineOptions = set of TCompilerCmdLineOption;
|
||||
|
||||
@ -536,7 +536,6 @@ type
|
||||
FDefaultMakeOptionsFlags: TCompilerCmdLineOptions;
|
||||
fInheritedOptions: TInheritedCompOptsParseTypesStrings;
|
||||
fInheritedOptParseStamps: integer;
|
||||
fOptionsString: String;
|
||||
FParsedOpts: TParsedCompilerOptions;
|
||||
FStorePathDelim: TPathDelimSwitch;
|
||||
FUseAsDefault: Boolean;
|
||||
@ -2615,23 +2614,27 @@ begin
|
||||
if TargetProcessor<>'' then
|
||||
Switches:=Switches+' -Op'+UpperCase(TargetProcessor);
|
||||
|
||||
{ Target OS
|
||||
if not (ccloNoMacroParams in Flags) then
|
||||
begin
|
||||
{ Target OS
|
||||
GO32V1 = DOS and version 1 of the DJ DELORIE extender (no longer maintained).
|
||||
GO32V2 = DOS and version 2 of the DJ DELORIE extender.
|
||||
LINUX = LINUX.
|
||||
OS2 = OS/2 (2.x) using the EMX extender.
|
||||
WIN32 = Windows 32 bit.
|
||||
... }
|
||||
{ Target OS }
|
||||
if (Globals<>nil) and (Globals.TargetOS<>'') then
|
||||
switches := switches + ' -T' + Globals.TargetOS
|
||||
else if (TargetOS<>'') then
|
||||
switches := switches + ' -T' + TargetOS;
|
||||
{ Target CPU }
|
||||
if (Globals<>nil) and (Globals.TargetCPU<>'') then
|
||||
switches := switches + ' -P' + Globals.TargetCPU
|
||||
else if (TargetCPU<>'') then
|
||||
switches := switches + ' -P' + TargetCPU;
|
||||
... }
|
||||
{ Target OS }
|
||||
if (Globals<>nil) and (Globals.TargetOS<>'') then
|
||||
switches := switches + ' -T' + Globals.TargetOS
|
||||
else if (TargetOS<>'') then
|
||||
switches := switches + ' -T' + TargetOS;
|
||||
{ Target CPU }
|
||||
if (Globals<>nil) and (Globals.TargetCPU<>'') then
|
||||
switches := switches + ' -P' + Globals.TargetCPU
|
||||
else if (TargetCPU<>'') then
|
||||
switches := switches + ' -P' + TargetCPU;
|
||||
end;
|
||||
|
||||
{ --------------- Linking Tab ------------------- }
|
||||
|
||||
{ Debugging }
|
||||
@ -2675,24 +2678,21 @@ begin
|
||||
if (not (ccloNoLinkerOpts in Flags)) and LinkSmart then
|
||||
switches := switches + ' -XX';
|
||||
|
||||
|
||||
// additional Linker options
|
||||
if PassLinkerOptions and (not (ccloNoLinkerOpts in Flags)) then begin
|
||||
if PassLinkerOptions and (not (ccloNoLinkerOpts in Flags))
|
||||
and (not (ccloNoMacroParams in Flags)) then begin
|
||||
CurLinkerOptions:=ParsedOpts.GetParsedValue(pcosLinkerOptions);
|
||||
if (CurLinkerOptions<>'') then
|
||||
switches := switches + ' ' + ConvertOptionsToCmdLine(' ','-k', CurLinkerOptions);
|
||||
end;
|
||||
|
||||
// inherited Linker options
|
||||
if (not (ccloNoLinkerOpts in Flags)) then begin
|
||||
// inherited Linker options
|
||||
InhLinkerOpts:=GetInheritedOption(icoLinkerOptions,
|
||||
not (ccloAbsolutePaths in Flags),coptParsed);
|
||||
if InhLinkerOpts<>'' then
|
||||
switches := switches + ' ' + ConvertOptionsToCmdLine(' ','-k', InhLinkerOpts);
|
||||
end;
|
||||
|
||||
// add Linker options for widgetset
|
||||
if not (ccloNoLinkerOpts in Flags) then
|
||||
begin
|
||||
|
||||
// add Linker options for widgetset
|
||||
LinkerAddition := LCLWidgetLinkerAddition[DirNameToLCLPlatform(GetEffectiveLCLWidgetType)];
|
||||
if LinkerAddition <> '' then
|
||||
switches := switches + ' ' + LinkerAddition;
|
||||
@ -2762,52 +2762,56 @@ begin
|
||||
switches := switches + ' -n';
|
||||
|
||||
{ Use Custom Config File @ = yes and path }
|
||||
if (CustomConfigFile) and (ConfigFilePath<>'') then begin
|
||||
if not (ccloNoMacroParams in Flags)
|
||||
and (CustomConfigFile) and (ConfigFilePath<>'') then begin
|
||||
switches := switches + ' ' + PrepareCmdLineOption('@' + ConfigFilePath);
|
||||
end;
|
||||
|
||||
{ ------------- Search Paths ---------------- }
|
||||
|
||||
// include path
|
||||
CurIncludePath:=GetIncludePath(not (ccloAbsolutePaths in Flags),
|
||||
coptParsed,false);
|
||||
if (CurIncludePath <> '') then
|
||||
switches := switches + ' ' + ConvertSearchPathToCmdLine('-Fi', CurIncludePath);
|
||||
|
||||
// library path
|
||||
if (not (ccloNoLinkerOpts in Flags)) then begin
|
||||
CurLibraryPath:=GetLibraryPath(not (ccloAbsolutePaths in Flags),
|
||||
if not (ccloNoMacroParams in Flags) then
|
||||
begin
|
||||
// include path
|
||||
CurIncludePath:=GetIncludePath(not (ccloAbsolutePaths in Flags),
|
||||
coptParsed,false);
|
||||
if (CurLibraryPath <> '') then
|
||||
switches := switches + ' ' + ConvertSearchPathToCmdLine('-Fl', CurLibraryPath);
|
||||
if (CurIncludePath <> '') then
|
||||
switches := switches + ' ' + ConvertSearchPathToCmdLine('-Fi', CurIncludePath);
|
||||
|
||||
// library path
|
||||
if (not (ccloNoLinkerOpts in Flags)) then begin
|
||||
CurLibraryPath:=GetLibraryPath(not (ccloAbsolutePaths in Flags),
|
||||
coptParsed,false);
|
||||
if (CurLibraryPath <> '') then
|
||||
switches := switches + ' ' + ConvertSearchPathToCmdLine('-Fl', CurLibraryPath);
|
||||
end;
|
||||
|
||||
// object path
|
||||
CurObjectPath:=GetObjectPath(not (ccloAbsolutePaths in Flags),
|
||||
coptParsed,false);
|
||||
if (CurObjectPath <> '') then
|
||||
switches := switches + ' ' + ConvertSearchPathToCmdLine('-Fo', CurObjectPath);
|
||||
|
||||
// unit path
|
||||
CurUnitPath:=GetUnitPath(not (ccloAbsolutePaths in Flags));
|
||||
//debugln('TBaseCompilerOptions.MakeOptionsString A ',dbgsName(Self),' CurUnitPath="',CurUnitPath,'"');
|
||||
// always add the current directory to the unit path, so that the compiler
|
||||
// checks for changed files in the directory
|
||||
CurUnitPath:=MergeSearchPaths(CurUnitPath,'.');
|
||||
switches := switches + ' ' + ConvertSearchPathToCmdLine('-Fu', CurUnitPath);
|
||||
|
||||
{ CompilerPath - Nothing needs to be done with this one }
|
||||
|
||||
{ Unit output directory }
|
||||
if (UnitOutputDirectory<>'') then begin
|
||||
CurOutputDir:=ParsedOpts.GetParsedValue(pcosOutputDir);
|
||||
if not (ccloAbsolutePaths in Flags) then
|
||||
CurOutputDir:=CreateRelativePath(CurOutputDir,BaseDirectory,true);
|
||||
end else
|
||||
CurOutputDir:='';
|
||||
if CurOutputDir<>'' then
|
||||
switches := switches + ' '+PrepareCmdLineOption('-FU'+CurOutputDir);
|
||||
end;
|
||||
|
||||
// object path
|
||||
CurObjectPath:=GetObjectPath(not (ccloAbsolutePaths in Flags),
|
||||
coptParsed,false);
|
||||
if (CurObjectPath <> '') then
|
||||
switches := switches + ' ' + ConvertSearchPathToCmdLine('-Fo', CurObjectPath);
|
||||
|
||||
// unit path
|
||||
CurUnitPath:=GetUnitPath(not (ccloAbsolutePaths in Flags));
|
||||
//debugln('TBaseCompilerOptions.MakeOptionsString A ',dbgsName(Self),' CurUnitPath="',CurUnitPath,'"');
|
||||
// always add the current directory to the unit path, so that the compiler
|
||||
// checks for changed files in the directory
|
||||
CurUnitPath:=MergeSearchPaths(CurUnitPath,'.');
|
||||
switches := switches + ' ' + ConvertSearchPathToCmdLine('-Fu', CurUnitPath);
|
||||
|
||||
{ CompilerPath - Nothing needs to be done with this one }
|
||||
|
||||
{ Unit output directory }
|
||||
if (UnitOutputDirectory<>'') then begin
|
||||
CurOutputDir:=ParsedOpts.GetParsedValue(pcosOutputDir);
|
||||
if not (ccloAbsolutePaths in Flags) then
|
||||
CurOutputDir:=CreateRelativePath(CurOutputDir,BaseDirectory,true);
|
||||
end else
|
||||
CurOutputDir:='';
|
||||
if CurOutputDir<>'' then
|
||||
switches := switches + ' '+PrepareCmdLineOption('-FU'+CurOutputDir);
|
||||
|
||||
{ TODO: Implement the following switches. They need to be added
|
||||
to the dialog. }
|
||||
{
|
||||
@ -2816,17 +2820,11 @@ begin
|
||||
oxxx = Object files
|
||||
rxxx = Compiler messages file
|
||||
}
|
||||
try
|
||||
t := GetIgnoredMsgsIndexes(CompilerMessages, ',');
|
||||
if t <> '' then
|
||||
switches := switches + ' ' + PrepareCmdLineOption('-vm'+t);
|
||||
if fUseMsgFile and FileExistsCached(MsgFileName)then
|
||||
switches := switches + ' ' + PrepareCmdLineOption('-Fr'+MsgFileName);
|
||||
except
|
||||
on E: Exception do begin
|
||||
DebugLn(['TBaseCompilerOptions.MakeOptionsString Error: ',E.Message]);
|
||||
end;
|
||||
end;
|
||||
t := GetIgnoredMsgsIndexes(CompilerMessages, ',');
|
||||
if t <> '' then
|
||||
switches := switches + ' ' + PrepareCmdLineOption('-vm'+t);
|
||||
if fUseMsgFile and FileExistsCached(MsgFileName)then
|
||||
switches := switches + ' ' + PrepareCmdLineOption('-Fr'+MsgFileName);
|
||||
|
||||
|
||||
{ ----------------------------------------------- }
|
||||
@ -2868,8 +2866,9 @@ begin
|
||||
}
|
||||
// append -o Option if neccessary
|
||||
//DebugLn(['TBaseCompilerOptions.MakeOptionsString ',DbgSName(Self),' ',ccloDoNotAppendOutFileOption in Flags,' TargetFilename="',TargetFilename,'" CurMainSrcFile="',CurMainSrcFile,'" CurOutputDir="',CurOutputDir,'"']);
|
||||
if (not (ccloDoNotAppendOutFileOption in Flags)) and
|
||||
((TargetFilename<>'') or (CurMainSrcFile<>'') or (CurOutputDir<>'')) then
|
||||
if (not (ccloDoNotAppendOutFileOption in Flags))
|
||||
and (not (ccloNoMacroParams in Flags))
|
||||
and ((TargetFilename<>'') or (CurMainSrcFile<>'') or (CurOutputDir<>'')) then
|
||||
begin
|
||||
NewTargetFilename := CreateTargetFilename(CurMainSrcFile);
|
||||
if (NewTargetFilename<>'') and
|
||||
@ -2896,13 +2895,14 @@ begin
|
||||
end;
|
||||
|
||||
// custom options
|
||||
CurCustomOptions:=GetCustomOptions(coptParsed);
|
||||
if CurCustomOptions<>'' then
|
||||
switches := switches+' '+CurCustomOptions;
|
||||
if not (ccloNoMacroParams in Flags) then
|
||||
begin
|
||||
CurCustomOptions:=GetCustomOptions(coptParsed);
|
||||
if CurCustomOptions<>'' then
|
||||
switches := switches+' '+CurCustomOptions;
|
||||
end;
|
||||
|
||||
|
||||
fOptionsString := switches;
|
||||
Result := fOptionsString;
|
||||
Result := switches;
|
||||
end;
|
||||
|
||||
function TBaseCompilerOptions.GetSyntaxOptionsString: string;
|
||||
@ -2974,8 +2974,6 @@ end;
|
||||
------------------------------------------------------------------------------}
|
||||
procedure TBaseCompilerOptions.Clear;
|
||||
begin
|
||||
fOptionsString := '';
|
||||
|
||||
// search paths
|
||||
IncludePath := '';
|
||||
Libraries := '';
|
||||
@ -3080,7 +3078,6 @@ begin
|
||||
exit;
|
||||
end;
|
||||
CompOpts:=TBaseCompilerOptions(Source);
|
||||
fOptionsString := CompOpts.fOptionsString;
|
||||
|
||||
// Target
|
||||
TargetFilename := CompOpts.TargetFilename;
|
||||
|
@ -92,6 +92,8 @@ type
|
||||
procedure UpdateShowSession;
|
||||
procedure SetShowSession(const AValue: boolean);
|
||||
procedure DoShowSession;
|
||||
procedure UpdateDialogCaption;
|
||||
function GetDialogCaption: string;
|
||||
public
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
@ -269,6 +271,10 @@ begin
|
||||
else
|
||||
ActivateMode(AProject.BuildModes[i-1]);
|
||||
end;
|
||||
if AProject.ActiveBuildMode=CurMode then begin
|
||||
debugln(['TBuildModesEditorFrame.BuildModeDeleteSpeedButtonClick activate failed']);
|
||||
exit;
|
||||
end;
|
||||
// delete mode
|
||||
AProject.BuildModes.Delete(i);
|
||||
FillBuildModesGrid;
|
||||
@ -456,6 +462,28 @@ begin
|
||||
Grid.EndUpdate(true);
|
||||
end;
|
||||
|
||||
procedure TBuildModesEditorFrame.UpdateDialogCaption;
|
||||
var
|
||||
Form: TCustomForm;
|
||||
begin
|
||||
Form:=GetParentForm(Self);
|
||||
if Form<>nil then
|
||||
Form.Caption:=GetDialogCaption;
|
||||
end;
|
||||
|
||||
function TBuildModesEditorFrame.GetDialogCaption: string;
|
||||
begin
|
||||
if AProject<>nil then
|
||||
begin
|
||||
Result := aProject.Title;
|
||||
if Result = '' then
|
||||
Result := ExtractFilenameOnly(aProject.ProjectInfoFile);
|
||||
Result:=Format(dlgProjectOptionsFor, [Result]);
|
||||
Result:=Result+', '+copy(AProject.ActiveBuildMode.GetCaption,1,12);
|
||||
end else
|
||||
Result:='TBuildModesEditorFrame.GetDialogCaption: no project';
|
||||
end;
|
||||
|
||||
function TBuildModesEditorFrame.GetAllBuildMacros: TStrings;
|
||||
|
||||
procedure Add(aBuildMacro: TLazBuildMacro);
|
||||
@ -535,6 +563,7 @@ var
|
||||
Values: TStringList;
|
||||
Value: string;
|
||||
begin
|
||||
if MacroValues=nil then exit;
|
||||
Grid:=BuildMacroValuesStringGrid;
|
||||
Values:=TStringList.Create;
|
||||
try
|
||||
@ -544,10 +573,11 @@ begin
|
||||
Value:=Grid.Cells[1,aRow];
|
||||
Values.Values[MacroName]:=Value;
|
||||
end;
|
||||
//debugln(['TBuildModesEditorFrame.Save ',Values.Text,' changed=',not MacroValues.Equals(Values)]);
|
||||
//debugln(['TBuildModesEditorFrame.Save changed=',not MacroValues.Equals(Values),' ',Values.Text]);
|
||||
if not MacroValues.Equals(Values) then begin
|
||||
// has changed
|
||||
MacroValues.Assign(Values);
|
||||
IncreaseBuildMacroChangeStamp;
|
||||
if UpdateControls then begin
|
||||
UpdateInheritedOptions;
|
||||
end;
|
||||
@ -656,12 +686,10 @@ constructor TBuildModesEditorFrame.Create(TheOwner: TComponent);
|
||||
begin
|
||||
inherited Create(TheOwner);
|
||||
FLoadShowSessionFromProject:=true;
|
||||
FMacroValues:=TProjectBuildMacros.Create;
|
||||
end;
|
||||
|
||||
destructor TBuildModesEditorFrame.Destroy;
|
||||
begin
|
||||
FreeAndNil(FMacroValues);
|
||||
inherited Destroy;
|
||||
end;
|
||||
|
||||
@ -701,6 +729,7 @@ begin
|
||||
if AOptions is TProjectCompilerOptions then begin
|
||||
PCOptions:=TProjectCompilerOptions(AOptions);
|
||||
FProject:=PCOptions.LazProject;
|
||||
FMacroValues:=FProject.ActiveBuildMode.MacroValues;
|
||||
|
||||
// modes
|
||||
UpdateShowSession;
|
||||
@ -710,20 +739,16 @@ begin
|
||||
// macros
|
||||
MacroValues.Assign(FProject.MacroValues);
|
||||
UpdateMacrosControls;
|
||||
|
||||
// options dialog
|
||||
UpdateDialogCaption;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TBuildModesEditorFrame.WriteSettings(AOptions: TAbstractIDEOptions);
|
||||
var
|
||||
PCOptions: TProjectCompilerOptions;
|
||||
begin
|
||||
if AOptions is TProjectCompilerOptions then begin
|
||||
PCOptions:=TProjectCompilerOptions(AOptions);
|
||||
SaveMacros(false);
|
||||
if not PCOptions.LazProject.MacroValues.Equals(MacroValues) then begin
|
||||
PCOptions.LazProject.MacroValues.Assign(MacroValues);
|
||||
IncreaseBuildMacroChangeStamp;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -14,7 +14,7 @@ inherited CompOptBuildMacrosFrame: TCompOptBuildMacrosFrame
|
||||
Width = 514
|
||||
Align = alTop
|
||||
Caption = 'MacrosGroupBox'
|
||||
ClientHeight = 222
|
||||
ClientHeight = 221
|
||||
ClientWidth = 506
|
||||
TabOrder = 0
|
||||
object BuildMacrosTreeView: TTreeView
|
||||
@ -25,12 +25,12 @@ inherited CompOptBuildMacrosFrame: TCompOptBuildMacrosFrame
|
||||
AnchorSideBottom.Control = MacrosGroupBox
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 0
|
||||
Height = 200
|
||||
Height = 199
|
||||
Top = 22
|
||||
Width = 227
|
||||
Anchors = [akTop, akLeft, akBottom]
|
||||
BorderSpacing.Right = 6
|
||||
DefaultItemHeight = 19
|
||||
DefaultItemHeight = 18
|
||||
RightClickSelect = True
|
||||
TabOrder = 0
|
||||
OnEdited = BuildMacrosTreeViewEdited
|
||||
@ -43,7 +43,7 @@ inherited CompOptBuildMacrosFrame: TCompOptBuildMacrosFrame
|
||||
AnchorSideBottom.Control = MacrosGroupBox
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 233
|
||||
Height = 222
|
||||
Height = 221
|
||||
Top = 0
|
||||
Width = 5
|
||||
Align = alNone
|
||||
@ -53,20 +53,20 @@ inherited CompOptBuildMacrosFrame: TCompOptBuildMacrosFrame
|
||||
AnchorSideLeft.Control = Splitter1
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
Left = 244
|
||||
Height = 222
|
||||
Height = 221
|
||||
Top = 0
|
||||
Width = 262
|
||||
Align = alRight
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
BorderSpacing.Left = 6
|
||||
Caption = 'BuildMacroSelectedGroupBox'
|
||||
ClientHeight = 201
|
||||
ClientHeight = 199
|
||||
ClientWidth = 254
|
||||
TabOrder = 2
|
||||
object BuildMacroDefaultLabel: TLabel
|
||||
Left = 6
|
||||
Height = 123
|
||||
Top = 72
|
||||
Height = 127
|
||||
Top = 66
|
||||
Width = 242
|
||||
Align = alClient
|
||||
AutoSize = False
|
||||
@ -78,7 +78,7 @@ inherited CompOptBuildMacrosFrame: TCompOptBuildMacrosFrame
|
||||
end
|
||||
object BuildMacroDescriptionLabel: TLabel
|
||||
Left = 6
|
||||
Height = 18
|
||||
Height = 17
|
||||
Top = 6
|
||||
Width = 242
|
||||
Align = alTop
|
||||
@ -90,8 +90,8 @@ inherited CompOptBuildMacrosFrame: TCompOptBuildMacrosFrame
|
||||
end
|
||||
object BuildMacroDescriptionEdit: TEdit
|
||||
Left = 6
|
||||
Height = 27
|
||||
Top = 24
|
||||
Height = 22
|
||||
Top = 23
|
||||
Width = 242
|
||||
Align = alTop
|
||||
BorderSpacing.Left = 6
|
||||
@ -107,7 +107,6 @@ inherited CompOptBuildMacrosFrame: TCompOptBuildMacrosFrame
|
||||
Height = 22
|
||||
Top = 0
|
||||
Width = 23
|
||||
Color = clBtnFace
|
||||
NumGlyphs = 0
|
||||
OnClick = BMAddMacroSpeedButtonClick
|
||||
ShowHint = True
|
||||
@ -122,7 +121,6 @@ inherited CompOptBuildMacrosFrame: TCompOptBuildMacrosFrame
|
||||
Top = 0
|
||||
Width = 23
|
||||
BorderSpacing.Left = 6
|
||||
Color = clBtnFace
|
||||
NumGlyphs = 0
|
||||
OnClick = BMAddMacroValueSpeedButtonClick
|
||||
ShowHint = True
|
||||
@ -137,7 +135,6 @@ inherited CompOptBuildMacrosFrame: TCompOptBuildMacrosFrame
|
||||
Top = 0
|
||||
Width = 23
|
||||
BorderSpacing.Left = 6
|
||||
Color = clBtnFace
|
||||
NumGlyphs = 0
|
||||
OnClick = BMDeleteSpeedButtonClick
|
||||
ShowHint = True
|
||||
@ -160,12 +157,12 @@ inherited CompOptBuildMacrosFrame: TCompOptBuildMacrosFrame
|
||||
Width = 514
|
||||
Align = alClient
|
||||
Caption = 'ConditionalsGroupBox'
|
||||
ClientHeight = 175
|
||||
ClientHeight = 174
|
||||
ClientWidth = 506
|
||||
TabOrder = 2
|
||||
inline CondSynEdit: TSynEdit
|
||||
Left = 0
|
||||
Height = 153
|
||||
Height = 159
|
||||
Top = 0
|
||||
Width = 506
|
||||
Align = alClient
|
||||
@ -176,7 +173,9 @@ inherited CompOptBuildMacrosFrame: TCompOptBuildMacrosFrame
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
TabOrder = 0
|
||||
Gutter.Width = 51
|
||||
OnKeyDown = CondSynEditKeyDown
|
||||
OnKeyPress = CondSynEditKeyPress
|
||||
Gutter.Width = 59
|
||||
Gutter.MouseActions = <
|
||||
item
|
||||
Shift = []
|
||||
@ -780,7 +779,7 @@ inherited CompOptBuildMacrosFrame: TCompOptBuildMacrosFrame
|
||||
Width = 24
|
||||
end
|
||||
object SynGutterLineNumber1: TSynGutterLineNumber
|
||||
Width = 11
|
||||
Width = 19
|
||||
MouseActions = <>
|
||||
MarkupInfo.Background = clBtnFace
|
||||
MarkupInfo.Foreground = clNone
|
||||
@ -882,13 +881,11 @@ inherited CompOptBuildMacrosFrame: TCompOptBuildMacrosFrame
|
||||
end>
|
||||
end
|
||||
end
|
||||
inline SynRightGutterPartList1: TSynRightGutterPartList
|
||||
end
|
||||
end
|
||||
object CondStatusbar: TStatusBar
|
||||
Left = 0
|
||||
Height = 22
|
||||
Top = 153
|
||||
Height = 15
|
||||
Top = 159
|
||||
Width = 506
|
||||
Panels = <
|
||||
item
|
||||
|
@ -29,7 +29,7 @@ unit Compiler_BuildMacro_Options;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, types, AVL_Tree, LCLProc, FileUtil, Controls, Forms,
|
||||
Classes, SysUtils, Math, types, AVL_Tree, LCLProc, FileUtil, Controls, Forms,
|
||||
StdCtrls, Grids, LCLType, Buttons, ExtCtrls, Dialogs, ComCtrls, Menus,
|
||||
AvgLvlTree, SynEdit, SynHighlighterPas, SynEditKeyCmds, SynCompletion,
|
||||
KeywordFuncLists, CodeToolsCfgScript, IDEImagesIntf, IDECommands, ProjectIntf,
|
||||
@ -74,6 +74,9 @@ type
|
||||
var AllowEdit: Boolean);
|
||||
procedure BuildMacrosTreeViewSelectionChanged(Sender: TObject);
|
||||
procedure CondSynEditChange(Sender: TObject);
|
||||
procedure CondSynEditKeyDown(Sender: TObject; var Key: Word;
|
||||
Shift: TShiftState);
|
||||
procedure CondSynEditKeyPress(Sender: TObject; var Key: char);
|
||||
procedure CondSynEditProcessCommand(Sender: TObject;
|
||||
var Command: TSynEditorCommand; var AChar: TUTF8Char; Data: pointer);
|
||||
procedure CondSynEditProcessUserCommand(Sender: TObject;
|
||||
@ -82,6 +85,15 @@ type
|
||||
Changes: TSynStatusChanges);
|
||||
procedure fSynCompletionCancel(Sender: TObject);
|
||||
procedure fSynCompletionExecute(Sender: TObject);
|
||||
procedure fSynCompletionKeyCompletePrefix(Sender: TObject);
|
||||
procedure fSynCompletionKeyDelete(Sender: TObject);
|
||||
procedure fSynCompletionKeyDown(Sender: TObject; var Key: Word;
|
||||
Shift: TShiftState);
|
||||
procedure fSynCompletionKeyNextChar(Sender: TObject);
|
||||
procedure fSynCompletionKeyPrevChar(Sender: TObject);
|
||||
procedure fSynCompletionSearchPosition(var Position: integer);
|
||||
procedure fSynCompletionUTF8KeyPress(Sender: TObject; var UTF8Key: TUTF8Char
|
||||
);
|
||||
procedure fSynCompletionValidate(Sender: TObject; KeyChar: TUTF8Char;
|
||||
Shift: TShiftState);
|
||||
procedure OnIdle(Sender: TObject; var Done: Boolean);
|
||||
@ -117,6 +129,7 @@ type
|
||||
procedure UpdateStatusBar;
|
||||
procedure StartCompletion;
|
||||
procedure UpdateCompletionValues;
|
||||
function GetCondCursorWord: string;
|
||||
public
|
||||
constructor Create(TheOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
@ -155,6 +168,17 @@ begin
|
||||
IdleConnected:=true;
|
||||
end;
|
||||
|
||||
procedure TCompOptBuildMacrosFrame.CondSynEditKeyDown(Sender: TObject;
|
||||
var Key: Word; Shift: TShiftState);
|
||||
begin
|
||||
end;
|
||||
|
||||
procedure TCompOptBuildMacrosFrame.CondSynEditKeyPress(Sender: TObject;
|
||||
var Key: char);
|
||||
begin
|
||||
//debugln(['TCompOptBuildMacrosFrame.CondSynEditKeyPress ',ord(Key)]);
|
||||
end;
|
||||
|
||||
procedure TCompOptBuildMacrosFrame.CondSynEditProcessCommand(Sender: TObject;
|
||||
var Command: TSynEditorCommand; var AChar: TUTF8Char; Data: pointer);
|
||||
begin
|
||||
@ -172,6 +196,11 @@ end;
|
||||
procedure TCompOptBuildMacrosFrame.CondSynEditStatusChange(Sender: TObject;
|
||||
Changes: TSynStatusChanges);
|
||||
begin
|
||||
if fSynCompletion.TheForm.Visible then
|
||||
begin
|
||||
//debugln(['TCompOptBuildMacrosFrame.CondSynEditStatusChange ']);
|
||||
fSynCompletion.CurrentString := GetCondCursorWord;
|
||||
end;
|
||||
UpdateStatusBar;
|
||||
end;
|
||||
|
||||
@ -188,6 +217,94 @@ begin
|
||||
//debugln(['TCompOptBuildMacrosFrame.fSynCompletionExecute ']);
|
||||
end;
|
||||
|
||||
procedure TCompOptBuildMacrosFrame.fSynCompletionKeyCompletePrefix(
|
||||
Sender: TObject);
|
||||
begin
|
||||
//debugln(['TCompOptBuildMacrosFrame.fSynCompletionKeyCompletePrefix ToDo']);
|
||||
end;
|
||||
|
||||
procedure TCompOptBuildMacrosFrame.fSynCompletionKeyDelete(Sender: TObject);
|
||||
begin
|
||||
//debugln(['TCompOptBuildMacrosFrame.fSynCompletionKeyDelete']);
|
||||
end;
|
||||
|
||||
procedure TCompOptBuildMacrosFrame.fSynCompletionKeyDown(Sender: TObject;
|
||||
var Key: Word; Shift: TShiftState);
|
||||
begin
|
||||
//debugln(['TCompOptBuildMacrosFrame.fSynCompletionKeyDown ']);
|
||||
if Key=VK_BACK then
|
||||
begin
|
||||
Key:=VK_UNKNOWN;
|
||||
if fSynCompletion.CurrentString<>'' then
|
||||
CondSynEdit.CommandProcessor(ecDeleteLastChar,#0,nil);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCompOptBuildMacrosFrame.fSynCompletionKeyNextChar(Sender: TObject);
|
||||
var
|
||||
XY: TPoint;
|
||||
StartX: integer;
|
||||
EndX: integer;
|
||||
Line: string;
|
||||
begin
|
||||
XY:=CondSynEdit.LogicalCaretXY;
|
||||
if XY.Y>CondSynEdit.Lines.Count then exit;
|
||||
CondSynEdit.GetWordBoundsAtRowCol(XY,StartX,EndX);
|
||||
if EndX<=XY.X then exit;
|
||||
Line := CondSynEdit.Lines[XY.Y - 1];
|
||||
inc(XY.X,UTF8CharacterLength(@Line[XY.X-1]));
|
||||
CondSynEdit.LogicalCaretXY:=XY;
|
||||
end;
|
||||
|
||||
procedure TCompOptBuildMacrosFrame.fSynCompletionKeyPrevChar(Sender: TObject);
|
||||
var
|
||||
XY: TPoint;
|
||||
StartX: integer;
|
||||
EndX: integer;
|
||||
Line: string;
|
||||
begin
|
||||
XY:=CondSynEdit.LogicalCaretXY;
|
||||
if XY.Y>CondSynEdit.Lines.Count then exit;
|
||||
CondSynEdit.GetWordBoundsAtRowCol(XY,StartX,EndX);
|
||||
if StartX>=XY.X then exit;
|
||||
Line := CondSynEdit.Lines[XY.Y - 1];
|
||||
XY.X:=UTF8FindNearestCharStart(PChar(Line),length(Line),XY.X-2)+1;
|
||||
CondSynEdit.LogicalCaretXY:=XY;
|
||||
end;
|
||||
|
||||
procedure TCompOptBuildMacrosFrame.fSynCompletionSearchPosition(
|
||||
var Position: integer);
|
||||
var
|
||||
sl: TStringList;
|
||||
Prefix: String;
|
||||
s: string;
|
||||
i: Integer;
|
||||
begin
|
||||
//debugln(['TCompOptBuildMacrosFrame.fSynCompletionSearchPosition "',fSynCompletion.CurrentString,'"']);
|
||||
Prefix:=fSynCompletion.CurrentString;
|
||||
sl:=TStringList.Create;
|
||||
try
|
||||
Position:=-1;
|
||||
for i:=0 to CompletionValues.Count-1 do
|
||||
begin
|
||||
s:=CompletionValues[i];
|
||||
if SysUtils.CompareText(Prefix,copy(s,1,length(Prefix)))<>0 then continue;
|
||||
if (Position<0) or (length(Prefix)=length(s)) then
|
||||
Position:=sl.Count;
|
||||
sl.AddObject(s,TObject(Pointer(i)));
|
||||
end;
|
||||
fSynCompletion.ItemList.Assign(sl);
|
||||
finally
|
||||
sl.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TCompOptBuildMacrosFrame.fSynCompletionUTF8KeyPress(Sender: TObject;
|
||||
var UTF8Key: TUTF8Char);
|
||||
begin
|
||||
//debugln(['TCompOptBuildMacrosFrame.fSynCompletionUTF8KeyPress ']);
|
||||
end;
|
||||
|
||||
procedure TCompOptBuildMacrosFrame.fSynCompletionValidate(Sender: TObject;
|
||||
KeyChar: TUTF8Char; Shift: TShiftState);
|
||||
var
|
||||
@ -200,20 +317,23 @@ var
|
||||
begin
|
||||
//debugln(['TCompOptBuildMacrosFrame.fSynCompletionValidate ']);
|
||||
i:=fSynCompletion.Position;
|
||||
if (i>=0) and (i<CompletionValues.Count) then begin
|
||||
s:=CompletionValues[i];
|
||||
p:=System.Pos(#9,s);
|
||||
if p>0 then s:=copy(s,1,p-1);
|
||||
TxtXY:=CondSynEdit.LogicalCaretXY;
|
||||
CondSynEdit.GetWordBoundsAtRowCol(TxtXY,TxtStartX,TxtEndX);
|
||||
CondSynEdit.BeginUndoBlock();
|
||||
CondSynEdit.BlockBegin:=Point(TxtStartX,TxtXY.Y);
|
||||
CondSynEdit.BlockEnd:=Point(TxtEndX,TxtXY.Y);
|
||||
CondSynEdit.SelText:=s;
|
||||
CondSynEdit.EndUndoBlock();
|
||||
FCompletionHistory.Insert(0,s);
|
||||
if FCompletionHistory.Count>100 then
|
||||
FCompletionHistory.Delete(FCompletionHistory.Count-1);
|
||||
if (i>=0) and (i<fSynCompletion.ItemList.Count) then begin
|
||||
i:=PtrUInt(fSynCompletion.ItemList.Objects[i]);
|
||||
if (i>=0) and (i<CompletionValues.Count) then begin
|
||||
s:=CompletionValues[i];
|
||||
p:=System.Pos(#9,s);
|
||||
if p>0 then s:=copy(s,1,p-1);
|
||||
TxtXY:=CondSynEdit.LogicalCaretXY;
|
||||
CondSynEdit.GetWordBoundsAtRowCol(TxtXY,TxtStartX,TxtEndX);
|
||||
CondSynEdit.BeginUndoBlock();
|
||||
CondSynEdit.BlockBegin:=Point(TxtStartX,TxtXY.Y);
|
||||
CondSynEdit.BlockEnd:=Point(TxtEndX,TxtXY.Y);
|
||||
CondSynEdit.SelText:=s;
|
||||
CondSynEdit.EndUndoBlock();
|
||||
FCompletionHistory.Insert(0,s);
|
||||
if FCompletionHistory.Count>100 then
|
||||
FCompletionHistory.Delete(FCompletionHistory.Count-1);
|
||||
end;
|
||||
end;
|
||||
|
||||
fSynCompletion.Deactivate;
|
||||
@ -653,6 +773,7 @@ begin
|
||||
// get row and column of word start at cursor
|
||||
LogXY:=CondSynEdit.LogicalCaretXY;
|
||||
CondSynEdit.GetWordBoundsAtRowCol(LogXY,LogStartX,LogEndX);
|
||||
LogEndX:=Min(LogEndX,LogXY.X);
|
||||
// convert text row,column to screen row,column
|
||||
ScreenXY:=CondSynEdit.PhysicalToLogicalPos(Point(LogStartX,LogXY.Y));
|
||||
// convert screen row,column to coordinates for the completion form
|
||||
@ -796,9 +917,33 @@ begin
|
||||
CompletionValues.Move(j,0);
|
||||
end;
|
||||
|
||||
// set index
|
||||
for i:=0 to CompletionValues.Count-1 do
|
||||
CompletionValues.Objects[i]:=TObject(Pointer(i));
|
||||
|
||||
//debugln(['TCompOptBuildMacrosFrame.UpdateCompletionValues ',CompletionValues.Text]);
|
||||
end;
|
||||
|
||||
function TCompOptBuildMacrosFrame.GetCondCursorWord: string;
|
||||
var
|
||||
XY: TPoint;
|
||||
StartX: integer;
|
||||
EndX: integer;
|
||||
Line: string;
|
||||
begin
|
||||
XY:=CondSynEdit.LogicalCaretXY;
|
||||
if (XY.Y>=1) and (XY.Y<=CondSynEdit.Lines.Count) then
|
||||
begin
|
||||
CondSynEdit.GetWordBoundsAtRowCol(XY,StartX,EndX);
|
||||
//debugln(['TCompOptBuildMacrosFrame.GetCondCursorWord ',StartX,' ',EndX,' ',XY.X]);
|
||||
EndX:=Min(EndX,XY.X);
|
||||
Line := CondSynEdit.Lines[XY.Y - 1];
|
||||
Result:= Copy(Line, StartX, EndX - StartX);
|
||||
end else
|
||||
Result:='';
|
||||
//debugln(['TCompOptBuildMacrosFrame.GetCondCursorWord "',Result,'"']);
|
||||
end;
|
||||
|
||||
procedure TCompOptBuildMacrosFrame.SaveItemProperties;
|
||||
var
|
||||
BuildMacro: TLazBuildMacro;
|
||||
@ -842,6 +987,13 @@ begin
|
||||
fSynCompletion.OnExecute:=@fSynCompletionExecute;
|
||||
fSynCompletion.OnCancel:=@fSynCompletionCancel;
|
||||
fSynCompletion.OnValidate:=@fSynCompletionValidate;
|
||||
fSynCompletion.OnSearchPosition:=@fSynCompletionSearchPosition;
|
||||
fSynCompletion.OnKeyCompletePrefix:=@fSynCompletionKeyCompletePrefix;
|
||||
fSynCompletion.OnUTF8KeyPress:=@fSynCompletionUTF8KeyPress;
|
||||
fSynCompletion.OnKeyNextChar:=@fSynCompletionKeyNextChar;
|
||||
fSynCompletion.OnKeyPrevChar:=@fSynCompletionKeyPrevChar;
|
||||
fSynCompletion.OnKeyDelete:=@fSynCompletionKeyDelete;
|
||||
fSynCompletion.OnKeyDown:=@fSynCompletionKeyDown;
|
||||
end;
|
||||
|
||||
destructor TCompOptBuildMacrosFrame.Destroy;
|
||||
|
@ -605,8 +605,8 @@ procedure TCompilerPathOptionsFrame.ReadSettings(AOptions: TAbstractIDEOptions);
|
||||
var
|
||||
LCLPlatform: TLCLPlatform;
|
||||
begin
|
||||
if FCompilerOpts = nil then
|
||||
FCompilerOpts := AOptions as TBaseCompilerOptions;
|
||||
if not (AOptions is TBaseCompilerOptions) then exit;
|
||||
FCompilerOpts := TBaseCompilerOptions(AOptions);
|
||||
|
||||
if AOptions is TProjectCompilerOptions then
|
||||
begin
|
||||
|
@ -54,6 +54,7 @@ type
|
||||
procedure CategoryTreeKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState);
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure HelpButtonClick(Sender: TObject);
|
||||
procedure IDEOptionsDialogKeyPress(Sender: TObject; var Key: char);
|
||||
procedure OkButtonClick(Sender: TObject);
|
||||
procedure CancelButtonClick(Sender: TObject);
|
||||
private
|
||||
@ -116,6 +117,8 @@ begin
|
||||
ButtonPanel.CancelButton.OnClick := @CancelButtonClick;
|
||||
ButtonPanel.HelpButton.Caption:= lisMenuHelp;
|
||||
ButtonPanel.HelpButton.OnClick := @HelpButtonClick;
|
||||
|
||||
OnKeyPress:=@IDEOptionsDialogKeyPress;
|
||||
end;
|
||||
|
||||
procedure TIDEOptionsDialog.HelpButtonClick(Sender: TObject);
|
||||
@ -126,6 +129,12 @@ begin
|
||||
ShowContextHelpForIDE(Self);
|
||||
end;
|
||||
|
||||
procedure TIDEOptionsDialog.IDEOptionsDialogKeyPress(Sender: TObject;
|
||||
var Key: char);
|
||||
begin
|
||||
debugln(['TIDEOptionsDialog.IDEOptionsDialogKeyPress ',ord(Key)]);
|
||||
end;
|
||||
|
||||
procedure TIDEOptionsDialog.CategoryTreeChange(Sender: TObject;
|
||||
Node: TTreeNode);
|
||||
var
|
||||
|
@ -4911,6 +4911,7 @@ resourcestring
|
||||
lisMoveOnePositionUp = 'Move "%s" one position up';
|
||||
lisMoveOnePositionDown = 'Move "%s" one position down';
|
||||
lisShowDifferencesBetweenModes = 'Show differences between modes ...';
|
||||
lisChangeBuildMode = 'Change build mode';
|
||||
|
||||
implementation
|
||||
|
||||
|
15
ide/main.pp
15
ide/main.pp
@ -341,7 +341,8 @@ type
|
||||
procedure OpenFilePopupMenuPopup(Sender: TObject);
|
||||
procedure mnuOpenFilePopupClick(Sender: TObject);
|
||||
procedure SetBuildModePopupMenuPopup(Sender: TObject);
|
||||
procedure mnuSetBuildModeClick(Sender: TObject);
|
||||
procedure mnuChgBuildModeClicked(Sender: TObject);
|
||||
procedure mnuSetBuildModeClick(Sender: TObject); // event for drop down items
|
||||
public
|
||||
// Global IDE events
|
||||
procedure OnProcessIDECommand(Sender: TObject; Command: word;
|
||||
@ -1797,6 +1798,7 @@ begin
|
||||
MainIDEBar.ViewUnitsSpeedBtn := CreateButton(MainIDEBar.tbViewDebug, 'ViewUnitsSpeedBtn' , 'menu_view_units' , @mnuViewUnitsClicked, lisHintViewUnits);
|
||||
MainIDEBar.ViewFormsSpeedBtn := CreateButton(MainIDEBar.tbViewDebug, 'ViewFormsSpeedBtn' , 'menu_view_forms' , @mnuViewFormsClicked, lisHintViewForms);
|
||||
MainIDEBar.tbDivider3 := CreateDivider(MainIDEBar.tbViewDebug);
|
||||
MainIDEBar.BuildModeSpeedButton:= CreateButton(MainIDEBar.tbViewDebug, 'BuildModeSpeedButton', 'menu_compiler_options' , @mnuChgBuildModeClicked, lisChangeBuildMode);
|
||||
MainIDEBar.RunSpeedButton := CreateButton(MainIDEBar.tbViewDebug, 'RunSpeedButton' , 'menu_run' , @mnuRunProjectClicked, lisHintRun);
|
||||
MainIDEBar.PauseSpeedButton := CreateButton(MainIDEBar.tbViewDebug, 'PauseSpeedButton' , 'menu_pause' , @mnuPauseProjectClicked, lisHintPause);
|
||||
MainIDEBar.StopSpeedButton := CreateButton(MainIDEBar.tbViewDebug, 'StopSpeedButton' , 'menu_stop' , @mnuStopProjectClicked, lisHintStop);
|
||||
@ -1810,7 +1812,8 @@ begin
|
||||
MainIDEBar.OpenFileSpeedBtn.DropDownMenu := MainIDEBar.OpenFilePopUpMenu;
|
||||
MainIDEBar.OpenFilePopupMenu.OnPopup := @OpenFilePopupMenuPopup;
|
||||
|
||||
MainIDEBar.RunSpeedButton.PopupMenu := MainIDEBar.SetBuildModePopupMenu;
|
||||
MainIDEBar.BuildModeSpeedButton.Style:=tbsDropDown;
|
||||
MainIDEBar.BuildModeSpeedButton.DropdownMenu:=MainIDEBar.SetBuildModePopupMenu;
|
||||
MainIDEBar.SetBuildModePopupMenu.OnPopup := @SetBuildModePopupMenuPopup;
|
||||
|
||||
MainIDEBar.PauseSpeedButton.Enabled := False;
|
||||
@ -3310,6 +3313,11 @@ begin
|
||||
aMenu.Items[aMenu.Items.Count - 1].Free;
|
||||
end;
|
||||
|
||||
procedure TMainIDE.mnuChgBuildModeClicked(Sender: TObject);
|
||||
begin
|
||||
DoOpenIDEOptions(TBuildModesEditorFrame, '', TAbstractIDEProjectOptions);
|
||||
end;
|
||||
|
||||
procedure TMainIDE.mnuSetBuildModeClick(Sender: TObject);
|
||||
var
|
||||
TheMenuItem: TMenuItem;
|
||||
@ -4362,6 +4370,7 @@ begin
|
||||
else
|
||||
Application.TaskBarBehavior := tbDefault;
|
||||
end else begin
|
||||
// restore
|
||||
IDEOptionsDialog.WriteAll(true);
|
||||
end;
|
||||
finally
|
||||
@ -7188,6 +7197,8 @@ begin
|
||||
if UpdateSaveAll then
|
||||
MainIDEBar.itmFileSaveAll.Enabled := MainIDEBar.itmProjectSave.Enabled;
|
||||
// toolbar buttons
|
||||
MainIDEBar.BuildModeSpeedButton.Visible:=(Project1<>nil)
|
||||
and (Project1.BuildModes.Count>1);
|
||||
MainIDEBar.SaveSpeedBtn.Enabled := MainIDEBar.itmFileSave.Enabled;
|
||||
if UpdateSaveAll then
|
||||
MainIDEBar.SaveAllSpeedBtn.Enabled := MainIDEBar.itmFileSaveAll.Enabled;
|
||||
|
@ -66,6 +66,7 @@ type
|
||||
ViewUnitsSpeedBtn : TToolButton;
|
||||
ViewFormsSpeedBtn : TToolButton;
|
||||
tbDivider3 : TToolButton;
|
||||
BuildModeSpeedButton : TToolButton;
|
||||
RunSpeedButton : TToolButton;
|
||||
SetBuildModePopupMenu: TPopupMenu;
|
||||
PauseSpeedButton : TToolButton;
|
||||
|
@ -6554,6 +6554,8 @@ var
|
||||
CurName: string;
|
||||
CurValue: string;
|
||||
begin
|
||||
Result:=false;
|
||||
if aValues.Count<>Count then exit;
|
||||
for i:=0 to aValues.Count-1 do begin
|
||||
CurName:=aValues.Names[i];
|
||||
CurValue:=aValues.ValueFromIndex[i];
|
||||
@ -6561,8 +6563,8 @@ begin
|
||||
if not IsDefined(CurName) then exit;
|
||||
if Values[CurName]<>CurValue then exit;
|
||||
end;
|
||||
Result:=true;
|
||||
//debugln(['TProjectBuildMacros.Equals END ',aValues.Count,' ',Count]);
|
||||
Result:=aValues.Count=Count;
|
||||
end;
|
||||
|
||||
function TProjectBuildMacros.CreateDiff(Other: TProjectBuildMacros;
|
||||
|
@ -291,7 +291,8 @@ type
|
||||
ShowAbort: boolean;
|
||||
Globals: TGlobalCompilerOptions = nil): TModalResult;
|
||||
function ConvertPackageRSTFiles(APackage: TLazPackage): TModalResult;
|
||||
function WriteMakeFile(APackage: TLazPackage): TModalResult;
|
||||
function WriteMakeFile(APackage: TLazPackage;
|
||||
Globals: TGlobalCompilerOptions): TModalResult;
|
||||
public
|
||||
// installed packages
|
||||
FirstAutoInstallDependency: TPkgDependency;
|
||||
@ -3171,7 +3172,7 @@ begin
|
||||
// create Makefile
|
||||
if ((pcfCreateMakefile in Flags)
|
||||
or (APackage.CompilerOptions.CreateMakefileOnBuild)) then begin
|
||||
Result:=WriteMakeFile(APackage);
|
||||
Result:=WriteMakeFile(APackage,Globals);
|
||||
if Result<>mrOk then begin
|
||||
DebugLn('TLazPackageGraph.CompilePackage DoWriteMakefile failed: ',APackage.IDAsString);
|
||||
exit;
|
||||
@ -3339,7 +3340,8 @@ begin
|
||||
Result:=mrOK;
|
||||
end;
|
||||
|
||||
function TLazPackageGraph.WriteMakeFile(APackage: TLazPackage): TModalResult;
|
||||
function TLazPackageGraph.WriteMakeFile(APackage: TLazPackage;
|
||||
Globals: TGlobalCompilerOptions): TModalResult;
|
||||
var
|
||||
PathDelimNeedsReplace: Boolean;
|
||||
|
||||
@ -3399,11 +3401,13 @@ var
|
||||
MainSrcFile: String;
|
||||
CustomOptions: String;
|
||||
IncPath: String;
|
||||
MakefileCompiledFilename: String;
|
||||
XMLConfig: TXMLConfig;
|
||||
OtherOptions: String;
|
||||
begin
|
||||
Result:=mrCancel;
|
||||
PathDelimNeedsReplace:=PathDelim<>'/';
|
||||
|
||||
MakefileFPCFilename:=AppendPathDelim(APackage.Directory)+'Makefile.fpc';
|
||||
if not DirectoryIsWritableCached(APackage.Directory) then begin
|
||||
// the Makefile.fpc is only needed for custom building
|
||||
// if the package directory is not writable, then the user does not want to
|
||||
@ -3413,6 +3417,8 @@ begin
|
||||
Result:=mrOk;
|
||||
exit;
|
||||
end;
|
||||
MakefileFPCFilename:=AppendPathDelim(APackage.Directory)+'Makefile.fpc';
|
||||
MakefileCompiledFilename:=AppendPathDelim(APackage.Directory)+'Makefile.compiled';
|
||||
|
||||
SrcFilename:=APackage.GetSrcFilename;
|
||||
MainUnitName:=lowercase(ExtractFileNameOnly((SrcFilename)));
|
||||
@ -3424,10 +3430,37 @@ begin
|
||||
coptParsedPlatformIndependent);
|
||||
CustomOptions:=APackage.CompilerOptions.GetCustomOptions(
|
||||
coptParsedPlatformIndependent);
|
||||
s:=APackage.CompilerOptions.GetSyntaxOptionsString;
|
||||
if s<>'' then
|
||||
CustomOptions:=CustomOptions+' '+s;
|
||||
// TODO: other options
|
||||
OtherOptions:=APackage.CompilerOptions.MakeOptionsString(Globals,
|
||||
[ccloDoNotAppendOutFileOption,ccloNoMacroParams]);
|
||||
|
||||
try
|
||||
XMLConfig:=TXMLConfig.CreateClean(MakefileCompiledFilename);
|
||||
try
|
||||
XMLConfig.SetValue('Makefile/Value',True);
|
||||
s:=OtherOptions;
|
||||
if UnitPath<>'' then
|
||||
s:=s+' -Fu'+UnitPath;
|
||||
if IncPath<>'' then
|
||||
s:=s+' -Fi'+IncPath;
|
||||
if CustomOptions<>'' then
|
||||
s:=s+' '+CustomOptions;
|
||||
//debugln(['TLazPackageGraph.WriteMakeFile IncPath="',IncPath,'" UnitPath="',UnitPath,'" Custom="',CustomOptions,'" Out="',UnitOutputPath,'"']);
|
||||
XMLConfig.SetValue('Params/Value',s);
|
||||
InvalidateFileStateCache;
|
||||
XMLConfig.Flush;
|
||||
finally
|
||||
XMLConfig.Free;
|
||||
end;
|
||||
except
|
||||
on E: Exception do begin
|
||||
Result:=IDEMessageDialog(lisPkgMangErrorWritingFile,
|
||||
Format(lisPkgMangUnableToWriteStateFileOfPackageError, ['"', MakefileCompiledFilename,
|
||||
'"', #13, APackage.IDAsString, #13, E.Message]),
|
||||
mtError,[mbCancel],'');
|
||||
exit;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
||||
//DebugLn('TPkgManager.DoWriteMakefile ',APackage.Name,' makefile UnitPath="',UnitPath,'"');
|
||||
UnitPath:=ConvertLazarusToMakefileSearchPath(UnitPath);
|
||||
@ -3437,7 +3470,12 @@ begin
|
||||
ChompPathDelim(UnitOutputPath));
|
||||
MainSrcFile:=CreateRelativePath(SrcFilename,APackage.Directory);
|
||||
CustomOptions:=ConvertLazarusOptionsToMakefileOptions(CustomOptions);
|
||||
|
||||
OtherOptions:=ConvertLazarusOptionsToMakefileOptions(OtherOptions);
|
||||
if CustomOptions<>'' then
|
||||
if OtherOptions<>'' then
|
||||
OtherOptions:=OtherOptions+' '+CustomOptions
|
||||
else
|
||||
OtherOptions:=CustomOptions;
|
||||
|
||||
e:=LineEnding;
|
||||
s:='';
|
||||
@ -3457,7 +3495,7 @@ begin
|
||||
s:=s+'unitdir='+UnitPath+e;
|
||||
if IncPath<>'' then
|
||||
s:=s+'includedir='+IncPath+e;
|
||||
s:=s+'options='+CustomOptions+e; // ToDo do the other options
|
||||
s:=s+'options='+OtherOptions+e; // ToDo do the other options
|
||||
s:=s+''+e;
|
||||
s:=s+'[target]'+e;
|
||||
s:=s+'units='+MainSrcFile+e;
|
||||
@ -3495,12 +3533,15 @@ begin
|
||||
|
||||
s:=s+''+e;
|
||||
s:=s+'[rules]'+e;
|
||||
s:=s+'.PHONY: cleartarget all'+e;
|
||||
s:=s+'.PHONY: cleartarget compiled all'+e;
|
||||
s:=s+''+e;
|
||||
s:=s+'cleartarget:'+e;
|
||||
s:=s+' -$(DEL) $(COMPILER_UNITTARGETDIR)/'+MainUnitName+'$(PPUEXT)'+e;
|
||||
s:=s+''+e;
|
||||
s:=s+'all: cleartarget $(COMPILER_UNITTARGETDIR) '+MainUnitName+'$(PPUEXT)'+e;
|
||||
s:=s+'compiled:'+e;
|
||||
s:=s+' $(COPY) Makefile.compiled $(COMPILER_UNITTARGETDIR)/'+APackage.Name+'.compiled'+e;
|
||||
s:=s+''+e;
|
||||
s:=s+'all: cleartarget $(COMPILER_UNITTARGETDIR) '+MainUnitName+'$(PPUEXT) compiled'+e;
|
||||
|
||||
//DebugLn('TPkgManager.DoWriteMakefile [',s,']');
|
||||
|
||||
@ -3510,9 +3551,10 @@ begin
|
||||
if CodeBuffer=nil then begin
|
||||
if not DirectoryIsWritableCached(ExtractFilePath(MakefileFPCFilename))
|
||||
then begin
|
||||
// the package source is read only => no problem
|
||||
// the package source is read only => ignore
|
||||
exit(mrOk);
|
||||
end;
|
||||
debugln(['TLazPackageGraph.WriteMakeFile unable to create file '+MakefileFPCFilename]);
|
||||
exit(mrCancel);
|
||||
end;
|
||||
end;
|
||||
|
Loading…
Reference in New Issue
Block a user