libman,win, automatically adds phobos/druntime

This commit is contained in:
Basile Burg 2015-05-08 18:46:46 +02:00
parent acb75c6ec0
commit d6113bd021
1 changed files with 35 additions and 8 deletions

View File

@ -31,8 +31,6 @@ type
private private
fCol: TCollection; fCol: TCollection;
procedure setCol(const aValue: TCollection); procedure setCol(const aValue: TCollection);
protected
procedure afterLoad; override;
published published
property libraries: TCollection read fCol write setCol; property libraries: TCollection read fCol write setCol;
public public
@ -56,11 +54,45 @@ implementation
constructor TLibraryManager.create(aOwner: TComponent); constructor TLibraryManager.create(aOwner: TComponent);
var var
fName: string; fName: string;
{$IFDEF WINDOWS}
fDmdPath: string;
{$ENDIF}
begin begin
inherited; inherited;
fCol := TCollection.Create(TLibraryItem); fCol := TCollection.Create(TLibraryItem);
fname := getCoeditDocPath + libFname; fname := getCoeditDocPath + libFname;
if fileExists(fname) then loadFromFile(fname); if fileExists(fname) then
loadFromFile(fname);
if fCol.Count = 0 then
begin
{$IFDEF WINDOWS}
fDmdPath := ExeSearch('dmd.exe');
if FileExists(fDmdPath) then
begin
// add phobos
fname := ExtractFileDir(fDmdPath);
fname := ExtractFileDir(fname);
with TLibraryItem(fCol.Add) do begin
libAlias := 'phobos';
libFile := fname + '\lib\phobos.lib';
libSourcePath := ExtractFileDir(fname) + '\src\phobos';
end;
// add druntime (no lib - only for DCD)
fname := ExtractFileDir(fDmdPath);
fname := ExtractFileDir(fname);
with TLibraryItem(fCol.Add) do begin
libAlias := 'druntime';
libFile := '';
libSourcePath := ExtractFileDir(fname) + '\src\druntime\import';
end;
end;
{$ENDIF}
// TODO-cfeature: add linux paths for druntime/phobos
{$IFDEF LINUX}
{$ENDIF}
end;
updateDCD
end; end;
destructor TLibraryManager.destroy; destructor TLibraryManager.destroy;
@ -160,11 +192,6 @@ begin
end; end;
end; end;
procedure TLibraryManager.afterLoad;
begin
updateDCD;
end;
initialization initialization
registerClasses([TLibraryManager, TLibraryItem]); registerClasses([TLibraryManager, TLibraryItem]);
LibMan := TLibraryManager.create(nil); LibMan := TLibraryManager.create(nil);