mirror of https://gitlab.com/basile.b/dexed.git
options, added items to select favorite compiler to build a DUB project or a native project
- DUB, fully working - NativeProjects, need option translater
This commit is contained in:
parent
ae990b03ef
commit
0a98a267e4
|
@ -24,8 +24,10 @@ const
|
||||||
libExt = {$IFDEF WINDOWS} '.lib' {$ELSE} '.a' {$ENDIF};
|
libExt = {$IFDEF WINDOWS} '.lib' {$ELSE} '.a' {$ENDIF};
|
||||||
dynExt = {$IFDEF WINDOWS} '.dll' {$ENDIF} {$IFDEF LINUX}'.so'{$ENDIF} {$IFDEF DARWIN}'.dylib'{$ENDIF};
|
dynExt = {$IFDEF WINDOWS} '.dll' {$ENDIF} {$IFDEF LINUX}'.so'{$ENDIF} {$IFDEF DARWIN}'.dylib'{$ENDIF};
|
||||||
|
|
||||||
var
|
type
|
||||||
DCompiler: string = 'dmd';
|
|
||||||
|
TCECompiler = (dmd, gdc, ldc);
|
||||||
|
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
|
|
|
@ -86,8 +86,16 @@ type
|
||||||
// returns true if filename is a valid dub project. Only json format is supported.
|
// returns true if filename is a valid dub project. Only json format is supported.
|
||||||
function isValidDubProject(const filename: string): boolean;
|
function isValidDubProject(const filename: string): boolean;
|
||||||
|
|
||||||
|
function getDubCompiler: TCECompiler;
|
||||||
|
procedure setDubCompiler(value: TCECompiler);
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
var
|
||||||
|
|
||||||
|
DubCompiler: TCECompiler = dmd;
|
||||||
|
DubCompilerFilename: string = 'dmd';
|
||||||
|
|
||||||
const
|
const
|
||||||
|
|
||||||
DubBuiltTypeName: array[TDubBuildType] of string = ('plain', 'debug', 'release',
|
DubBuiltTypeName: array[TDubBuildType] of string = ('plain', 'debug', 'release',
|
||||||
|
@ -96,6 +104,7 @@ const
|
||||||
|
|
||||||
DubDefaultConfigName = '(default config)';
|
DubDefaultConfigName = '(default config)';
|
||||||
|
|
||||||
|
|
||||||
{$REGION Standard Comp/Obj -----------------------------------------------------}
|
{$REGION Standard Comp/Obj -----------------------------------------------------}
|
||||||
constructor TCEDubProject.create(aOwner: TComponent);
|
constructor TCEDubProject.create(aOwner: TComponent);
|
||||||
begin
|
begin
|
||||||
|
@ -250,6 +259,7 @@ begin
|
||||||
str.Add('--build=' + fBuildTypes.Strings[fBuiltTypeIx]);
|
str.Add('--build=' + fBuildTypes.Strings[fBuiltTypeIx]);
|
||||||
if (fConfigs.Count <> 1) and (fConfigs.Strings[0] <> DubDefaultConfigName) then
|
if (fConfigs.Count <> 1) and (fConfigs.Strings[0] <> DubDefaultConfigName) then
|
||||||
str.Add('--config=' + fConfigs.Strings[fConfigIx]);
|
str.Add('--config=' + fConfigs.Strings[fConfigIx]);
|
||||||
|
str.Add('--compiler=' + DubCompilerFilename);
|
||||||
result := str.Text;
|
result := str.Text;
|
||||||
finally
|
finally
|
||||||
str.Free;
|
str.Free;
|
||||||
|
@ -386,6 +396,7 @@ begin
|
||||||
dubproc.Parameters.Add('--build=' + fBuildTypes.Strings[fBuiltTypeIx]);
|
dubproc.Parameters.Add('--build=' + fBuildTypes.Strings[fBuiltTypeIx]);
|
||||||
if (fConfigs.Count <> 1) and (fConfigs.Strings[0] <> DubDefaultConfigName) then
|
if (fConfigs.Count <> 1) and (fConfigs.Strings[0] <> DubDefaultConfigName) then
|
||||||
dubproc.Parameters.Add('--config=' + fConfigs.Strings[fConfigIx]);
|
dubproc.Parameters.Add('--config=' + fConfigs.Strings[fConfigIx]);
|
||||||
|
dubProc.Parameters.Add('--compiler=' + DubCompilerFilename);
|
||||||
if run and (runArgs <> '') then
|
if run and (runArgs <> '') then
|
||||||
dubproc.Parameters.Add('--' + runArgs);
|
dubproc.Parameters.Add('--' + runArgs);
|
||||||
dubproc.Execute;
|
dubproc.Execute;
|
||||||
|
@ -767,6 +778,9 @@ begin
|
||||||
end;
|
end;
|
||||||
{$ENDREGION}
|
{$ENDREGION}
|
||||||
|
|
||||||
|
{$ENDREGION --------------------------------------------------------------------}
|
||||||
|
|
||||||
|
{$REGION Miscellaneous DUB free functions --------------------------------------}
|
||||||
function isValidDubProject(const filename: string): boolean;
|
function isValidDubProject(const filename: string): boolean;
|
||||||
var
|
var
|
||||||
maybe: TCEDubProject;
|
maybe: TCEDubProject;
|
||||||
|
@ -790,7 +804,29 @@ begin
|
||||||
EntitiesConnector.endUpdate;
|
EntitiesConnector.endUpdate;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
{$ENDREGION --------------------------------------------------------------------}
|
|
||||||
|
|
||||||
|
function getDubCompiler: TCECompiler;
|
||||||
|
begin
|
||||||
|
exit(DubCompiler);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure setDubCompiler(value: TCECompiler);
|
||||||
|
begin
|
||||||
|
case value of
|
||||||
|
dmd: DubCompilerFilename := exeFullName('dmd');
|
||||||
|
gdc: DubCompilerFilename := exeFullName('gdc');
|
||||||
|
ldc: DubCompilerFilename := exeFullName('ldc2');
|
||||||
|
end;
|
||||||
|
if (not fileExists(DubCompilerFilename)) or (DubCompilerFilename = '') then
|
||||||
|
begin
|
||||||
|
value := dmd;
|
||||||
|
DubCompilerFilename:= 'dmd';
|
||||||
|
end;
|
||||||
|
DubCompiler := value;
|
||||||
|
end;
|
||||||
|
{$ENDREGION}
|
||||||
|
|
||||||
|
initialization
|
||||||
|
setDubCompiler(dmd);
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
|
@ -1792,6 +1792,42 @@ object CEMainForm: TCEMainForm
|
||||||
end
|
end
|
||||||
object MenuItem71: TMenuItem
|
object MenuItem71: TMenuItem
|
||||||
Action = actFileSaveCopyAs
|
Action = actFileSaveCopyAs
|
||||||
|
Bitmap.Data = {
|
||||||
|
36040000424D3604000000000000360000002800000010000000100000000100
|
||||||
|
2000000000000004000064000000640000000000000000000000FFFFFF00FFFF
|
||||||
|
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFF
|
||||||
|
FF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF00FFFFFF000000002C0000
|
||||||
|
0033000000330000003300000033000000330000003300000033000000330000
|
||||||
|
00330000003300000033000000330000002C0000000000000000B3811AE1B781
|
||||||
|
14FFB57E10FFB57D0CFFB67C0BFFB67C0AFFB57C0AFFB67D0AFFB77D0BFFB77E
|
||||||
|
0BFFB77E0CFFB67F10FFB78114FFB3811AE1BB871E00BB871F00B78115FFFEE9
|
||||||
|
C7FFFBE4BDFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
|
||||||
|
FFFFFFFFFFFFFFE7BCFFFFEAC6FFB78115FFBB861D00BB871F00B67F12FFFBE9
|
||||||
|
CFFFD88500FFFFFFFFFF797B7FFFA2A4A5FFFFFCF3FF828180FF425C72FF385A
|
||||||
|
80FF3784DDFFEB8D00FFFFECCCFFB78011FFBB861C00BC871D00B67F12FFFAE4
|
||||||
|
C1FFDB8D0AFFFEFFFFFFFDF7EBFFFFF8EAFFFFF7E9FFFFFDEBFF507C9CFF7BA3
|
||||||
|
B5FF86D2FFFF1F60A2FFFFEBB6FFBE830DFFC0871600C2891600B68013FFF7DE
|
||||||
|
B5FFDC9317FFFFFFFFFF787879FF7A7979FFA4A2A1FFABA39FFF3AABF2FFA1ED
|
||||||
|
FFFF9ADEFEFF0998FFFF2366A9FFCA8604FF0000000971747E00B68014FFF5D9
|
||||||
|
AAFFDF9822FFFFFFFFFFF1E6D9FFF2E6D9FFF2E6D7FFF6E6D6FFCED9DBFF1D6F
|
||||||
|
C5FF39C4FFFF1DABFFFF7EA3C4FF7C7878FF3B3B3A5674767000B68114FFF4D4
|
||||||
|
A2FFE29F31FFE9E1E2FFFEFFFFFFFEFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFF
|
||||||
|
FFFF1B74D0FFACDBF4FF928782FFC1C0BAFF797B71FF00000033B68115FFF3D1
|
||||||
|
99FFE3A740FFE2A336FFE19F2EFFE19E2BFFE19E2BFFE29F2CFFE3A02CFFE8A3
|
||||||
|
2DFFF1A830FF817F83FFE9E9E8FF898B83FFAC7BA7FF9969CBFFB68115FFF3CE
|
||||||
|
93FFE5AB48FFEED7B6FFF5F3F7FFF5F1F4FFF7F3F6FFFBF8FAFFFCF8FAFFF9F6
|
||||||
|
F9FFF2D9B4FFEEAE40FF7A8185FFE0B1E4FFCB96C7FFAE7DCEFFB68116FFF3CB
|
||||||
|
8CFFE7AE4EFFF5F4F8FFF0E9E4FFF1E9E2FFF8EFE8FF8A847FFF88817EFFF8F0
|
||||||
|
EBFFF7F5F9FFEAAF4BFFF6CD7DFFBC87E4FFBE8ADAFFAC7BCF00B68116FFF1C8
|
||||||
|
87FFE8B258FFF6F5F7FFEEE2D9FFEFE3D9FFFFFAF5FF5C5752FF48423FFFFFFB
|
||||||
|
F7FFF7F6F8FFE9B257FFF2C880FFB68100FFBE8AEC00AB7BDF00B68116FFF2CA
|
||||||
|
85FFEBB962FFF8F8FBFFE9DCD1FFEBDDD1FFFFFFFCFF958B83FF4A443FFFFFFF
|
||||||
|
FFFFFAF9FCFFEBB962FFF2CA83FFB6810FFFBB860F00BC880D00B78218FFF6CC
|
||||||
|
89FFF2C274FFFFFFFFFFFEFDFCFFFFFEFCFFFFFEF9FF93887EFF4A433DFFFFFF
|
||||||
|
FFFFFFFFFFFFF2C274FFF6CC89FFB78217FFBB861C00BB871C00B9851CC5B781
|
||||||
|
16FFB37A06FFD6CFD1FFD4C9C3FFD4C9C1FFD8CCC5FFE3D7D02B4A433D00DFD4
|
||||||
|
CEFFD8D1D2FFB37A06FFB78116FFB9851CC5BB871F00BB871F00
|
||||||
|
}
|
||||||
end
|
end
|
||||||
object MenuItem62: TMenuItem
|
object MenuItem62: TMenuItem
|
||||||
Action = actFileHtmlExport
|
Action = actFileHtmlExport
|
||||||
|
|
|
@ -371,11 +371,17 @@ type
|
||||||
fReloadLastDocuments: boolean;
|
fReloadLastDocuments: boolean;
|
||||||
fMaxRecentProjs: integer;
|
fMaxRecentProjs: integer;
|
||||||
fMaxRecentDocs: integer;
|
fMaxRecentDocs: integer;
|
||||||
|
function getDubCompiler: TCECompiler;
|
||||||
|
function getNativeProjecCompiler: TCECompiler;
|
||||||
|
procedure setDubCompiler(value: TCECompiler);
|
||||||
|
procedure setNativeProjecCompiler(value: TCECompiler);
|
||||||
published
|
published
|
||||||
property floatingWidgetOnTop: boolean read fFloatingWidgetOnTop write fFloatingWidgetOnTop;
|
property floatingWidgetOnTop: boolean read fFloatingWidgetOnTop write fFloatingWidgetOnTop;
|
||||||
property reloadLastDocuments: boolean read fReloadLastDocuments write fReloadLastDocuments;
|
property reloadLastDocuments: boolean read fReloadLastDocuments write fReloadLastDocuments;
|
||||||
property maxRecentProjects: integer read fMaxRecentProjs write fMaxRecentProjs;
|
property maxRecentProjects: integer read fMaxRecentProjs write fMaxRecentProjs;
|
||||||
property maxRecentDocuments: integer read fMaxRecentDocs write fMaxRecentDocs;
|
property maxRecentDocuments: integer read fMaxRecentDocs write fMaxRecentDocs;
|
||||||
|
property dubCompiler: TCECompiler read getDubCompiler write setDubCompiler;
|
||||||
|
property nativeProjecCompiler: TCECompiler read getNativeProjecCompiler write setNativeProjecCompiler;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TCEApplicationOptions = class(TCEApplicationOptionsBase, ICEEditableOptions)
|
TCEApplicationOptions = class(TCEApplicationOptionsBase, ICEEditableOptions)
|
||||||
|
@ -411,6 +417,26 @@ begin
|
||||||
EntitiesConnector.addObserver(self);
|
EntitiesConnector.addObserver(self);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TCEApplicationOptionsBase.getDubCompiler: TCECompiler;
|
||||||
|
begin
|
||||||
|
exit(ce_dubproject.getDubCompiler);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TCEApplicationOptionsBase.getNativeProjecCompiler: TCECompiler;
|
||||||
|
begin
|
||||||
|
exit(ce_nativeproject.getNativeProjectCompiler);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEApplicationOptionsBase.setDubCompiler(value: TCECompiler);
|
||||||
|
begin
|
||||||
|
ce_dubproject.setDubCompiler(value);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEApplicationOptionsBase.setNativeProjecCompiler(value: TCECompiler);
|
||||||
|
begin
|
||||||
|
ce_nativeproject.setNativeProjectCompiler(value);
|
||||||
|
end;
|
||||||
|
|
||||||
destructor TCEApplicationOptions.Destroy;
|
destructor TCEApplicationOptions.Destroy;
|
||||||
begin
|
begin
|
||||||
EntitiesConnector.removeObserver(self);
|
EntitiesConnector.removeObserver(self);
|
||||||
|
@ -1691,7 +1717,7 @@ begin
|
||||||
//processOutputToStrings(proc, lst);
|
//processOutputToStrings(proc, lst);
|
||||||
if proc = fRunProc then for str in lst do
|
if proc = fRunProc then for str in lst do
|
||||||
fMsgs.message(str, fDoc, amcEdit, amkBub)
|
fMsgs.message(str, fDoc, amcEdit, amkBub)
|
||||||
else if proc.Executable = DCompiler then
|
else // dmd used to compile runnable
|
||||||
for str in lst do
|
for str in lst do
|
||||||
fMsgs.message(str, fDoc, amcEdit, amkAuto);
|
fMsgs.message(str, fDoc, amcEdit, amkAuto);
|
||||||
finally
|
finally
|
||||||
|
@ -1817,7 +1843,7 @@ begin
|
||||||
dmdproc.OnReadData := @asyncprocOutput;
|
dmdproc.OnReadData := @asyncprocOutput;
|
||||||
dmdproc.OnTerminate:= @asyncprocTerminate;
|
dmdproc.OnTerminate:= @asyncprocTerminate;
|
||||||
dmdproc.Options := [poUsePipes, poStderrToOutPut];
|
dmdproc.Options := [poUsePipes, poStderrToOutPut];
|
||||||
dmdproc.Executable := DCompiler;
|
dmdproc.Executable := 'dmd';
|
||||||
dmdproc.Parameters.Add(fDoc.fileName);
|
dmdproc.Parameters.Add(fDoc.fileName);
|
||||||
dmdproc.Parameters.Add('-J' + ExtractFilePath(fDoc.fileName));
|
dmdproc.Parameters.Add('-J' + ExtractFilePath(fDoc.fileName));
|
||||||
dmdproc.Parameters.AddText(fRunnableSw);
|
dmdproc.Parameters.AddText(fRunnableSw);
|
||||||
|
|
|
@ -115,11 +115,18 @@ type
|
||||||
// native project have no ext constraint, this function tells if filename is project
|
// native project have no ext constraint, this function tells if filename is project
|
||||||
function isValidNativeProject(const filename: string): boolean;
|
function isValidNativeProject(const filename: string): boolean;
|
||||||
|
|
||||||
|
function getNativeProjectCompiler: TCECompiler;
|
||||||
|
procedure setNativeProjectCompiler(value: TCECompiler);
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
uses
|
uses
|
||||||
controls, dialogs, ce_symstring, ce_libman, ce_dcd;
|
controls, dialogs, ce_symstring, ce_libman, ce_dcd;
|
||||||
|
|
||||||
|
var
|
||||||
|
NativeProjectCompilerFilename: string = 'dmd';
|
||||||
|
NativeProjectCompiler: TCECompiler;
|
||||||
|
|
||||||
constructor TCENativeProject.create(aOwner: TComponent);
|
constructor TCENativeProject.create(aOwner: TComponent);
|
||||||
begin
|
begin
|
||||||
inherited create(aOwner);
|
inherited create(aOwner);
|
||||||
|
@ -716,7 +723,7 @@ begin
|
||||||
// this doesn't work under linux, so the previous ChDir.
|
// this doesn't work under linux, so the previous ChDir.
|
||||||
if directoryExists(prjpath) then
|
if directoryExists(prjpath) then
|
||||||
compilproc.CurrentDirectory := prjpath;
|
compilproc.CurrentDirectory := prjpath;
|
||||||
compilproc.Executable := DCompiler;
|
compilproc.Executable := NativeProjectCompilerFilename;
|
||||||
compilproc.Options := compilproc.Options + [poStderrToOutPut, poUsePipes];
|
compilproc.Options := compilproc.Options + [poStderrToOutPut, poUsePipes];
|
||||||
compilproc.ShowWindow := swoHIDE;
|
compilproc.ShowWindow := swoHIDE;
|
||||||
getOpts(compilproc.Parameters);
|
getOpts(compilproc.Parameters);
|
||||||
|
@ -963,6 +970,29 @@ begin
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function getNativeProjectCompiler: TCECompiler;
|
||||||
|
begin
|
||||||
|
exit(NativeProjectCompiler);
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure setNativeProjectCompiler(value: TCECompiler);
|
||||||
|
begin
|
||||||
|
case value of
|
||||||
|
// TODO-cfeature: a dmd2gdc and a dmd2ldc2 option translater.
|
||||||
|
// maybe done in D using getOpt, as a tool: ceLdcOpt, ceGDCOpt
|
||||||
|
dmd: NativeProjectCompilerFilename := exeFullName('dmd');
|
||||||
|
gdc: NativeProjectCompilerFilename := ''; // need option translater dmd->gdc
|
||||||
|
ldc: NativeProjectCompilerFilename := ''; // need option translater dmd->ldc
|
||||||
|
end;
|
||||||
|
if (not fileExists(NativeProjectCompilerFilename))
|
||||||
|
or (NativeProjectCompilerFilename = '') then
|
||||||
|
begin
|
||||||
|
value := dmd;
|
||||||
|
NativeProjectCompilerFilename:= 'dmd';
|
||||||
|
end;
|
||||||
|
NativeProjectCompiler := value;
|
||||||
|
end;
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
RegisterClasses([TCENativeProject]);
|
RegisterClasses([TCENativeProject]);
|
||||||
end.
|
end.
|
||||||
|
|
Loading…
Reference in New Issue