File: delphitool.pas

package info (click to toggle)
lazarus 4.4%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 276,332 kB
  • sloc: pascal: 2,343,449; xml: 508,730; makefile: 353,085; cpp: 93,608; sh: 3,387; java: 609; perl: 297; sql: 222; ansic: 137
file content (614 lines) | stat: -rw-r--r-- 16,999 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
unit delphitool;

{$mode objfpc}{$H+}
{$modeswitch typehelpers}

interface

uses
  Classes, SysUtils, System.UITypes, dialogs,
  ProjectIntf, CompOptsIntf, IDEExternToolIntf, MacroDefIntf, MacroIntf, RegExpr,
  strdelphitool;


Const
  SubToolDelphiPriority = SubToolFPCPriority-10;

type

  { TWinePathConverter }

  TWinePathConverter = Class
  Private
    FMap : TStrings;
  Protected
    Procedure FillMap; virtual;
  Public
    Constructor Create;
    Destructor Destroy; override;
    Function UnixToWindows(Const aFileName : String) : String; virtual;
    function WindowsToUnix(Const aFileName : String) : String; virtual;
  end;

  { TDelphiCompilerParser }

  TDelphiCompilerParser = class(TExtToolParser)
  private
  protected
    FRegExprFilenameLineIDMsg: TRegExpr;
    FRegExprFilenameLineUrgencyIDMsg: TRegExpr;
    FConverter : TWinePathConverter;
    Function CreateConverter : TWinePathConverter;
  public
    constructor Create(AOwner: TComponent); override;
    destructor Destroy; override;
    procedure ReadLine(Line: string; OutputIndex: integer; IsStdErr: boolean;
      var Handled: boolean); override; // (worker thread)
    class function DefaultSubTool: string; override;
    class function GetParserName: string; override;
    class function GetLocalizedParserName: string; override;
    class function Priority: integer; override;
  end;
  TDelphiCompilerParserClass = class of TDelphiCompilerParser;

  { TDelphiTool }

  TDelphiMacro = (dmCompiler,dmConfigFileName,dmAdditionalArgs,dmCompileCommand);
  TDelphiTool = class
  private
    class var _instance: TDelphiTool;
  Private
    FMacros : Array[TDelphiMacro] of TTransferMacro;
  Protected
    function GetCompileCommand(const s: string; const {%H-}Data: PtrInt; var {%H-}Abort: boolean): string; virtual;
    function GetCompilerArgs(const s: string; const {%H-}Data: PtrInt; var {%H-}Abort: boolean): string; virtual;
    function GetCompilerPath(const s: string; const {%H-}Data: PtrInt; var Abort: boolean): string; virtual;
    function GetConfigPath(const s: string; const {%H-}Data: PtrInt; var Abort: boolean): string; virtual;
    function OnProjectBuilding(Sender: TObject): TModalResult; virtual;
    function FPCToDelphiOpts(Opts: TLazCompilerOptions; aDelphiOpts: TStrings): Integer; virtual;
    function GenerateConfigFilename(const aFilename: String): Boolean; virtual;
  Public
    Destructor Destroy; override;
    Class Constructor Init;
    Class Destructor Done;
    Procedure Hook; virtual;
    Procedure UnHook; virtual;
    Function NeedsDelphi: boolean;
    Function UsesDelphiMacros(s: string): boolean;
    Function GetParsedCompilerFilename : String;
    Function GetCurrentConfigFileName(PrependAt: Boolean = true) : String;
    Function GetCompilerArguments: string;
    Function GetCompileCommand: string;
    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
  {$IFDEF UNIX} baseunix, {$ENDIF}
  LazIDEIntf, LazLoggerBase, LazUtilities,  delphioptions, fileutil, lazfileutils;

{ TWinePathConverter }

{$IFDEF UNIX}
procedure TWinePathConverter.FillMap;

Var
  DriveLink,DevicesDir : String;
  drive : Char;

begin

  DevicesDir:=GetUserDir+'.wine/dosdevices/';
  if not DirectoryExists(DevicesDir,True) then
    exit;
  for drive:='a' to 'z' do
    begin
    DriveLink:=DevicesDir+Drive+':';
    if DirectoryExists(DriveLink) then
      FMap.Add(Drive+':='+IncludeTrailingPathDelimiter(fpReadLink(DriveLink)));
    end;
end;
{$ELSE}
procedure TWinePathConverter.FillMap;
begin
  // Do nothing
end;
{$ENDIF}

constructor TWinePathConverter.Create;
begin
  FMap:=TStringList.Create;
end;

destructor TWinePathConverter.Destroy;
begin
  FreeAndNil(FMap);
  inherited Destroy;
end;

function TWinePathConverter.UnixToWindows(const aFileName: String): String;

  function FileBelowDir(const aBaseDir,aDestFile : String) : Boolean;

  Var
    relPath : String;

  begin
    relPath:=ExtractRelativePath(aBaseDir,aDestFile);
    Result:=Copy(relPath,1,3)<>'../';
  end;


Var
  relPath,Drive,DriveDir,CurDrive,CurDir : String;
  i : Integer;

begin
  if FMap.Count=0 then
    FillMap;
  CurDrive:='';
  CurDir:='';
  for I:=0 to FMap.Count-1 do
    begin
    FMap.GetNameValue(I,Drive,DriveDir);
    if FileBelowDir(DriveDir,aFileName) then
      begin
      if (CurDir='') or (FileBelowDir(CurDir,DriveDir)) then
        begin
        // first or more specific
        CurDrive:=Drive;
        CurDir:=DriveDir
        end;
      end;
    end;
  if CurDrive<>'' then
    begin
    relPath:=ExtractRelativePath(DriveDir,aFileName);
    Result:=UpperCase(CurDrive)+StringReplace(relPath,'/','\',[rfReplaceAll]);
    end
  else
    Result:=StringReplace(relPath,'/','\',[rfReplaceAll]);
end;

function TWinePathConverter.WindowsToUnix(const aFileName: String): String;

var
  S : String;

begin
  Result:='';
  if aFileName='' then exit;
  if (Length(aFileName)<2) or (aFileName[2]<>':') then
    Exit(aFileName);
  if FMap.Count=0 then
    FillMap;
  S:=LowerCase(aFileName[1]+':');
  S:=FMap.Values[S];
  if S<>'' then
    Result:=S+SetDirSeparators(Copy(aFileName,4))
  else
    Result:=SetDirSeparators(aFileName);
  Result:=StringReplace(Result,'\','/',[rfReplaceAll]);
end;

{ TDelphiCompilerParser }

function TDelphiCompilerParser.CreateConverter: TWinePathConverter;
begin
  Result:=TWinePathConverter.Create;
end;

constructor TDelphiCompilerParser.Create(AOwner: TComponent);
begin
  inherited Create(AOwner);
  FConverter:=CreateConverter;

  // filename(linenumber): E2003 Undeclared identifier: 'foo'
  FRegExprFilenameLineIDMsg:=TRegExpr.Create;
  FRegExprFilenameLineIDMsg.ModifierStr:='I';
  FRegExprFilenameLineIDMsg.Expression:='^(.*)\(([0-9]+)\): ([HNWEF])([0-9]+) (.*)$';

  // filename(linenumber): Fatal: F2613 Unit 'Unit3' not found.
  FRegExprFilenameLineUrgencyIDMsg:=TRegExpr.Create;
  FRegExprFilenameLineUrgencyIDMsg.ModifierStr:='I';
  FRegExprFilenameLineUrgencyIDMsg.Expression:='^(.*)\(([0-9]+)\) ([a-zA-Z]+): ([HNWEF])([0-9]+) (.*)$';
end;

destructor TDelphiCompilerParser.Destroy;
begin
  FreeAndNil(FRegExprFilenameLineIDMsg);
  FreeAndNil(FRegExprFilenameLineUrgencyIDMsg);
  FreeAndNil(FConverter);
  inherited Destroy;
end;

procedure TDelphiCompilerParser.ReadLine(Line: string; OutputIndex: integer;
  IsStdErr: boolean; var Handled: boolean);

  procedure Add(const aFilename, LineNoStr, UrgencyLetter, IDStr, MsgStr: String);
  var
    MsgLine: TMessageLine;
  begin
    MsgLine:=CreateMsgLine(OutputIndex);
    case UrgencyLetter of
    'H': MsgLine.Urgency:=mluHint;
    'N': MsgLine.Urgency:=mluNote;
    'W': MsgLine.Urgency:=mluWarning;
    'E': MsgLine.Urgency:=mluError;
    'F': MsgLine.Urgency:=mluFatal;
    else MsgLine.Urgency:=mluImportant;
    end;
    if DelphiToolOptions.ConvertPathsToUnix then
      MsgLine.Filename:=FConverter.WindowsToUnix(aFilename)
    else
      MsgLine.Filename:=aFilename;
    MsgLine.Line:=StrToIntDef(LineNoStr,0);
    MsgLine.MsgID:=StrToIntDef(IDStr,0);
    MsgLine.Msg:=MsgStr;
    if IsStdErr then
      MsgLine.Flags:=MsgLine.Flags+[mlfStdErr];
    AddMsgLine(MsgLine);
  end;

  procedure AddFilenameLineIDMsg;
  var
    RE: TRegExpr;
    aFilename, LineNoStr, UrgencyLetter, IDStr, MsgStr: String;
  begin
    RE:=FRegExprFilenameLineIDMsg;
    aFilename:=RE.Match[1];
    LineNoStr:=RE.Match[2];
    UrgencyLetter:=RE.Match[3];
    IDStr:=RE.Match[4];
    MsgStr:=RE.Match[5];
    Add(aFilename,LineNoStr,UrgencyLetter,IDStr,MsgStr);
  end;

  procedure AddFilenameLineUrgencyIDMsg;
  var
    RE: TRegExpr;
    aFilename, LineNoStr, UrgencyLetter, IDStr, MsgStr: String;
  begin
    RE:=FRegExprFilenameLineUrgencyIDMsg;
    aFilename:=RE.Match[1];
    LineNoStr:=RE.Match[2];
    //UrgencyStr:=RE.Match[3];
    UrgencyLetter:=RE.Match[4];
    IDStr:=RE.Match[5];
    MsgStr:=RE.Match[6];
    Add(aFilename,LineNoStr,UrgencyLetter,IDStr,MsgStr);
  end;

  procedure AddOtherLine;
  var
    MsgLine: TMessageLine;
  begin
    MsgLine:=CreateMsgLine(OutputIndex);
    MsgLine.MsgID:=0;
    MsgLine.SubTool:=SSubToolDelphi;
    if MsgLine.Msg<>'' then
      MsgLine.Urgency:=mluImportant
    else
      MsgLine.Urgency:=mluVerbose2;
    if IsStdErr then
      MsgLine.Flags:=MsgLine.Flags+[mlfStdErr];
    AddMsgLine(MsgLine);
  end;

begin
  FRegExprFilenameLineIDMsg.InputString:=Line;
  if FRegExprFilenameLineIDMsg.ExecPos(1) then
  begin
    AddFilenameLineIDMsg;
    exit;
  end;

  FRegExprFilenameLineUrgencyIDMsg.InputString:=Line;
  if FRegExprFilenameLineUrgencyIDMsg.ExecPos(1) then
  begin
    AddFilenameLineUrgencyIDMsg;
    exit;
  end;

  AddOtherLine;

  Handled:=true;
end;

class function TDelphiCompilerParser.DefaultSubTool: string;
begin
  Result:=SDelphiToolName;
end;

class function TDelphiCompilerParser.GetParserName: string;
begin
  Result:=SDelphiParserName;
end;

class function TDelphiCompilerParser.GetLocalizedParserName: string;
begin
  Result:=SDelphiLocalizedParserName;
end;

class function TDelphiCompilerParser.Priority: integer;
begin
  Result:=SubToolDelphiPriority;
end;

{ TDelphiTool }

function TDelphiTool.GetCompilerPath(const s: string; const Data: PtrInt;
  var Abort: boolean): string;
begin
  Abort:=False;
  if (s<>'') and (ConsoleVerbosity>=0) then
    debugln(['Hint: (lazarus) [TDelphiTool.GetCompilerPath] ignoring macro DCC parameter "',s,'"']);
  Result:=GetParsedCompilerFilename;
  if Result='' then
    Result:='dcc32.exe'; // always return something to get nicer error messages
  //debugln(['macro DCC parameter: "',Result,'"']);
end;

function TDelphiTool.GetCompileCommand(const s: string; const Data: PtrInt;
  var Abort: boolean): string;
begin
  if (s<>'') and (ConsoleVerbosity>=0) then
    debugln(['Hint: (lazarus) [TDelphiTool.GetCompilerPath] ignoring macro DELPHICOMPILE parameter "',s,'"']);
  Result:=GetCompileCommand();
  // debugln(['macro DELPHICOMPILE parameter: "',Result,'"']);
end;

function TDelphiTool.GetCompilerArgs(const s: string; const Data: PtrInt;
  var Abort: boolean): string;
begin
  if (s<>'') and (ConsoleVerbosity>=0) then
    debugln(['Hint: (lazarus) [TDelphiTool.GetCompilerPath] ignoring macro DCCARGS parameter "',s,'"']);
  Result:=GetCompilerArguments;
  // debugln(['macro DCCARGS parameter: "',Result,'"']);
end;

function TDelphiTool.GetConfigPath(const s: string; const Data: PtrInt;
  var Abort: boolean): string;
begin
  Abort:=False;
  if (s<>'') and (ConsoleVerbosity>=0) then
    debugln(['Hint: (lazarus) [TDelphiTool.GetConfigPath] ignoring macro DCCCONFIG parameter "',s,'"']);
  Result:=GetCurrentConfigFilename;
end;

destructor TDelphiTool.Destroy;
begin
  inherited Destroy;
end;

class constructor TDelphiTool.Init;
begin
  _instance:=TDelphiTool.Create;
end;

class destructor TDelphiTool.Done;
begin
  FreeAndNil(_instance);
end;

function TDelphiTool.FPCToDelphiOpts(Opts : TLazCompilerOptions; aDelphiOpts: TStrings) : Integer;

  Procedure AddFlag(SetFlag : Boolean; const FlagName : String);

  begin
    aDelphiOpts.Add('-$'+FlagName+PlusMinus[SetFlag]);
    Inc(Result);
  end;

  procedure AddOption(DoAdd : Boolean; const Option : String);

  begin
    if DoAdd then
      begin
      aDelphiOpts.Add('-'+Option);
      Inc(Result);
      end;
  end;

  procedure AddOption(aValue : String; const FlagName : String);

  begin
    IDEMacros.SubstituteMacros(aValue);
    AddOption(aValue<>'',FlagName+aValue);
  end;

begin
  // Options
  AddOption(Opts.GetUnitPath(False,coptParsed,True),'U');
  AddOPtion(Opts.GetIncludePath(False,coptParsed,True),'I');
  AddOption(Opts.GenerateDebugInfo,'V');
  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');
  AddOption(Opts.TargetFileExt,'TX');
  // Flags
  AddFlag(Opts.RangeChecks,'R');
  AddFlag(Opts.IOChecks,'I');
  AddFlag(Opts.IncludeAssertionCode,'C');
  AddFlag(Opts.UseAnsiStrings,'H');
  AddFlag(Opts.OptimizationLevel>0,'O');
  AddFlag(Opts.OverflowChecks,'Q');
  AddFlag(Opts.GenerateDebugInfo,'L');
  AddFlag(Opts.GenerateDebugInfo,'W');
  AddFlag(Opts.GenerateDebugInfo,'Y');
  // We can maybe check for -Sy in custom options ?
end;

function TDelphiTool.GenerateConfigFilename(const aFilename : String) : Boolean;

var
  Opts : TLazCompilerOptions;
  BuildID: String;
  Idx : Integer;
  L : TStrings;

begin
  debugln(['Generating delphi project configuration file: "',aFileName,'"']);
  BuildID:=LazarusIDE.ActiveProject.ActiveBuildModeID;
  Idx:=LazarusIDE.ActiveProject.LazBuildModes.IndexOf(BuildID);
  if Idx<0 then
    Idx:=0;
  Opts:=LazarusIDE.ActiveProject.LazBuildModes.BuildModes[Idx].LazCompilerOptions;
  L:=TstringList.Create;
  try
    Result:=FPCToDelphiOpts(Opts,L)>0;
    L.SaveToFile(aFileName);
    debugln(['Generated delphi project configuration file: "',aFileName,'"']);
  finally
    L.Free;
  end;
end;

function TDelphiTool.OnProjectBuilding(Sender: TObject): TModalResult;

begin
  Result:=mrOK;
  if NeedsDelphi then begin
    FMacros[dmCompiler].LazbuildValue:=GetCompileCommand();
    FMacros[dmConfigFileName].LazbuildValue:=GetCurrentConfigFileName;
    FMacros[dmCompileCommand].LazbuildValue:=GetCompileCommand;
    FMacros[dmAdditionalArgs].LazbuildValue:=GetCompilerArguments;
    if Assigned(LazarusIDE.ActiveProject) and LazarusIDE.ActiveProject.GenerateDelphiConfigFile then
      GenerateConfigFilename(GetCurrentConfigFileName(False));
  end;
end;

procedure TDelphiTool.Hook;
begin
  FMacros[dmCompiler]:=IDEMacros.Add('DCC', '', SDelphiCompilerFileNameCaption, @GetCompilerPath, [tmfLazbuild]);
  FMacros[dmConfigFileName]:=IDEMacros.Add('DCCCONFIG', '', SDelphiCompilerConfigFileName, @GetConfigPath, [tmfLazbuild]);
  FMacros[dmCompileCommand]:=IDEMacros.Add('DELPHICOMPILE', '', SDelphiCompileCommand, @GetCompileCommand, [tmfLazbuild]);
  FMacros[dmAdditionalArgs]:=IDEMacros.Add('DCCARGS', '', SDelphiCompilerArgs, @GetCompilerArgs, [tmfLazbuild]);
  LazarusIDE.AddHandlerOnProjectBuilding(@OnProjectBuilding);
end;

procedure TDelphiTool.UnHook;
begin
  //
end;

function TDelphiTool.NeedsDelphi: boolean;
var
  Prj: TLazProject;
  CompOpts: TLazCompilerOptions;
begin
  Result:=false;
  Prj:=LazarusIDE.ActiveProject;
  if Prj=nil then exit;
  if Prj.GenerateDelphiConfigFile then
    exit(true);
  CompOpts:=Prj.LazCompilerOptions;
  if UsesDelphiMacros(CompOpts.CompilerPath)
      or UsesDelphiMacros(CompOpts.ExecuteBefore.Command)
      or UsesDelphiMacros(CompOpts.ExecuteAfter.Command) then
    exit(true);
end;

function TDelphiTool.UsesDelphiMacros(s: string): boolean;
begin
  s:=uppercase(s);
  Result:=(Pos('$(DCC)',s)>0)
     or (Pos('$(DCCARGS)',s)>0)
     or (Pos('$(DCCCONFIG)',s)>0)
     or (Pos('$(DELPHICOMPILE)',s)>0);
end;

function TDelphiTool.GetParsedCompilerFilename: String;

begin
  Result:=DelphiToolOptions.CompilerFileName;
  IDEMacros.SubstituteMacros(Result);
  if not FilenameIsAbsolute(Result) then
    Result:=FindDefaultExecutablePath(Result);
end;

function TDelphiTool.GetCurrentConfigFileName(PrependAt: Boolean = True): String;
begin
  if Assigned(LazarusIDE.ActiveProject) and LazarusIDE.ActiveProject.GenerateDelphiConfigFile then
    begin
    Result:=ChangeFileExt(LazarusIDE.ActiveProject.ProjectInfoFile,DelphiOptions.DefaultConfigExtension);
    if PrependAt then
      Result:='@'+Result;
    end
  else
    Result:='';
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;


function TDelphiTool.GetCompileCommand: string;

begin
  Result:='$(DCC) $(DCCARGS) $(DCCCONFIG)';
  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
  if AValue<>'' then
    CustomData[pKeyAdditionalOptions]:=aValue
  else
    CustomData.Remove(pKeyAdditionalOptions);
end;

procedure TLazProjectDelphiOptions.SetDCF(AValue: Boolean);
begin
  if AValue then
    CustomData[pKeyGenConfigFile]:=IntToStr(Ord(aValue))
  else
    CustomData.Remove(pKeyGenConfigFile);
end;


end.