mirror of https://gitlab.com/basile.b/dexed.git
add a system allowing to change the D compiler used in all the compilation contexts
This commit is contained in:
parent
3ad97b3dc2
commit
b6759a1525
|
@ -24,6 +24,7 @@ The page exposes unsorted options. In the future some of them might be moved to
|
||||||
- **dscanUnittests**: If checked the content of the `unittest` blocks are analyzed when using the action __File/Verify with Dscanner__. Do not activate if the results of the static analysis tend to generate irrelevant messages in the tests.
|
- **dscanUnittests**: If checked the content of the `unittest` blocks are analyzed when using the action __File/Verify with Dscanner__. Do not activate if the results of the static analysis tend to generate irrelevant messages in the tests.
|
||||||
- **flatLook**: Doesn't draw the buttons shape unless they're hovered by the mouse.
|
- **flatLook**: Doesn't draw the buttons shape unless they're hovered by the mouse.
|
||||||
- **floatingWidgetOnTop**: Keeps the widgets that are not docked on top of the application window.
|
- **floatingWidgetOnTop**: Keeps the widgets that are not docked on top of the application window.
|
||||||
|
- **globalCompiler**: Sets the compiler used when _global_ is used elsewhere. This also to easily switch to a specific compiler when _global_ is selected in all the contexts (runnables, native, dub).
|
||||||
- **maxReventDocuments**: Sets how many entries can be stored in __File/Open recent file__.
|
- **maxReventDocuments**: Sets how many entries can be stored in __File/Open recent file__.
|
||||||
- **maxReventDocuments**: Sets how many entries can be stored in __Project/Open recent project__.
|
- **maxReventDocuments**: Sets how many entries can be stored in __Project/Open recent project__.
|
||||||
- **maxReventProjectsGroups**: Sets how many entries can be stored in __Projects group/Open recent group__.
|
- **maxReventProjectsGroups**: Sets how many entries can be stored in __Projects group/Open recent group__.
|
||||||
|
|
|
@ -25,7 +25,7 @@ Up to five D compilers can be defined.
|
||||||
The combo box at the top is used to select which are the paths passed to the [completion daemon](features_dcd).
|
The combo box at the top is used to select which are the paths passed to the [completion daemon](features_dcd).
|
||||||
If the completion daemon is launched by _Dexed_ then the change is applied directly after the validation, otherwise it has to be restarted manually.
|
If the completion daemon is launched by _Dexed_ then the change is applied directly after the validation, otherwise it has to be restarted manually.
|
||||||
|
|
||||||
In other options categories one of these compilers can be selected.
|
In other options categories one of these compilers or _global_ can be selected.
|
||||||
|
|
||||||
* Category _Application_, _nativeProjectCompiler_: defines the compiler used to compile a project that has the native format.
|
* Category _Application_, _nativeProjectCompiler_: defines the compiler used to compile a project that has the native format.
|
||||||
* Category [_Runnable modules_](features_runnables), _compiler_: defines the compiler used to compile a _runnable module_ or a DUB script.
|
* Category [_Runnable modules_](features_runnables), _compiler_: defines the compiler used to compile a _runnable module_ or a DUB script.
|
||||||
|
|
|
@ -48,6 +48,8 @@ type
|
||||||
procedure setUser2ExeName(const value: string);
|
procedure setUser2ExeName(const value: string);
|
||||||
procedure setUser2RuntimePath(const value: string);
|
procedure setUser2RuntimePath(const value: string);
|
||||||
procedure setUser2PhobosPath(const value: string);
|
procedure setUser2PhobosPath(const value: string);
|
||||||
|
private
|
||||||
|
procedure checkIfGlobalIsGlobal;
|
||||||
protected
|
protected
|
||||||
procedure afterLoad; override;
|
procedure afterLoad; override;
|
||||||
published
|
published
|
||||||
|
@ -154,6 +156,9 @@ type
|
||||||
destructor destroy; override;
|
destructor destroy; override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
var
|
||||||
|
globalCompiler: DCompiler;
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
{$R *.lfm}
|
{$R *.lfm}
|
||||||
|
|
||||||
|
@ -236,6 +241,15 @@ begin
|
||||||
inherited;
|
inherited;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCompilersPaths.checkIfGlobalIsGlobal;
|
||||||
|
begin
|
||||||
|
if globalCompiler = DCompiler.global then
|
||||||
|
begin
|
||||||
|
raise Exception.Create('global compiler should not be set the DCompiler.global');
|
||||||
|
globalCompiler := low(DCompiler);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TCompilersPaths.assign(source: TPersistent);
|
procedure TCompilersPaths.assign(source: TPersistent);
|
||||||
var
|
var
|
||||||
src: TCompilersPaths;
|
src: TCompilersPaths;
|
||||||
|
@ -521,6 +535,11 @@ begin
|
||||||
DCompiler.ldmd: exit(exeFullName('ldmd2' + exeExt).fileExists);
|
DCompiler.ldmd: exit(exeFullName('ldmd2' + exeExt).fileExists);
|
||||||
DCompiler.user1: exit(User1ExeName.fileExists);
|
DCompiler.user1: exit(User1ExeName.fileExists);
|
||||||
DCompiler.user2: exit(User2ExeName.fileExists);
|
DCompiler.user2: exit(User2ExeName.fileExists);
|
||||||
|
DCompiler.global:
|
||||||
|
begin
|
||||||
|
fPaths.checkIfGlobalIsGlobal;
|
||||||
|
exit(isCompilerValid(globalCompiler));
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -535,6 +554,11 @@ begin
|
||||||
DCompiler.ldmd: exit(exeFullName('ldmd2' + exeExt));
|
DCompiler.ldmd: exit(exeFullName('ldmd2' + exeExt));
|
||||||
DCompiler.user1: exit(User1ExeName);
|
DCompiler.user1: exit(User1ExeName);
|
||||||
DCompiler.user2: exit(User2ExeName);
|
DCompiler.user2: exit(User2ExeName);
|
||||||
|
DCompiler.global:
|
||||||
|
begin
|
||||||
|
checkIfGlobalIsGlobal;
|
||||||
|
exit(getCompilerPath(globalCompiler));
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -555,6 +579,8 @@ begin
|
||||||
begin tryAdd(User1RuntimePath); tryAdd(User1PhobosPath); end;
|
begin tryAdd(User1RuntimePath); tryAdd(User1PhobosPath); end;
|
||||||
DCompiler.user2:
|
DCompiler.user2:
|
||||||
begin tryAdd(User2RuntimePath); tryAdd(User2PhobosPath); end;
|
begin tryAdd(User2RuntimePath); tryAdd(User2PhobosPath); end;
|
||||||
|
DCompiler.global:
|
||||||
|
begin checkIfGlobalIsGlobal; getCompilerImports(globalCompiler, paths); end;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
{$ENDREGION}
|
{$ENDREGION}
|
||||||
|
|
|
@ -217,7 +217,7 @@ type
|
||||||
|
|
||||||
var
|
var
|
||||||
DubCompiler: DCompiler = dmd;
|
DubCompiler: DCompiler = dmd;
|
||||||
DubCompilerFilename: string = 'dmd';
|
DubCompilerFilename: string;
|
||||||
Lfm: ILifetimeManager = nil;
|
Lfm: ILifetimeManager = nil;
|
||||||
|
|
||||||
const
|
const
|
||||||
|
@ -895,6 +895,8 @@ begin
|
||||||
str.Add('--build=' + fBuildTypes[fBuiltTypeIx]);
|
str.Add('--build=' + fBuildTypes[fBuiltTypeIx]);
|
||||||
if (fConfigs.Count <> 1) and (fConfigs[0] <> DubDefaultConfigName) then
|
if (fConfigs.Count <> 1) and (fConfigs[0] <> DubDefaultConfigName) then
|
||||||
str.Add('--config=' + fConfigs[fConfigIx]);
|
str.Add('--config=' + fConfigs[fConfigIx]);
|
||||||
|
if DubCompilerFilename.isEmpty then
|
||||||
|
setDubCompiler(dubBuildOptions.compiler);
|
||||||
str.Add('--compiler=' + DubCompilerFilename);
|
str.Add('--compiler=' + DubCompilerFilename);
|
||||||
dubBuildOptions.getOpts(str);
|
dubBuildOptions.getOpts(str);
|
||||||
result := str.Text;
|
result := str.Text;
|
||||||
|
@ -1157,6 +1159,8 @@ begin
|
||||||
if (fConfigs.Count <> 1) and (fConfigs[0] <> DubDefaultConfigName) then
|
if (fConfigs.Count <> 1) and (fConfigs[0] <> DubDefaultConfigName) then
|
||||||
fDubProc.Parameters.Add('--config=' + fConfigs[fConfigIx]);
|
fDubProc.Parameters.Add('--config=' + fConfigs[fConfigIx]);
|
||||||
end;
|
end;
|
||||||
|
if DubCompilerFilename.isEmpty then
|
||||||
|
setDubCompiler(dubBuildOptions.compiler);
|
||||||
fDubProc.Parameters.Add('--compiler=' + DubCompilerFilename);
|
fDubProc.Parameters.Add('--compiler=' + DubCompilerFilename);
|
||||||
dubBuildOptions.getOpts(fDubProc.Parameters);
|
dubBuildOptions.getOpts(fDubProc.Parameters);
|
||||||
if (command <> dcBuild) and runArgs.isNotEmpty then
|
if (command <> dcBuild) and runArgs.isNotEmpty then
|
||||||
|
@ -1897,8 +1901,9 @@ end;
|
||||||
{$ENDREGION}
|
{$ENDREGION}
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
setDubCompiler(dmd);
|
// setDubCompiler(dmd);
|
||||||
dubBuildOptions:= TDubBuildOptions.create(nil);
|
dubBuildOptions:= TDubBuildOptions.create(nil);
|
||||||
|
DubCompilerFilename := '';
|
||||||
finalization
|
finalization
|
||||||
dubBuildOptions.free;
|
dubBuildOptions.free;
|
||||||
TDubLocalPackages.deinit;
|
TDubLocalPackages.deinit;
|
||||||
|
|
|
@ -379,7 +379,7 @@ type
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
DCompiler = (dmd, gdc, gdmd, ldc, ldmd, user1, user2);
|
DCompiler = (dmd, gdc, gdmd, ldc, ldmd, user1, user2, global);
|
||||||
|
|
||||||
(**
|
(**
|
||||||
* Single service provided by the options editor.
|
* Single service provided by the options editor.
|
||||||
|
@ -665,7 +665,7 @@ end;
|
||||||
function usingCompilerInfo(value: DCompiler): string;
|
function usingCompilerInfo(value: DCompiler): string;
|
||||||
const
|
const
|
||||||
c2id: array[DCompiler] of string = ('dmd', 'gdc', 'gdmd', 'ldc', 'ldmd',
|
c2id: array[DCompiler] of string = ('dmd', 'gdc', 'gdmd', 'ldc', 'ldmd',
|
||||||
'user1', 'user2');
|
'user1', 'user2', 'global');
|
||||||
begin
|
begin
|
||||||
result := format('using %s (%s)',
|
result := format('using %s (%s)',
|
||||||
[getCompilerSelector.getCompilerPath(value), c2id[value]]);
|
[getCompilerSelector.getCompilerPath(value), c2id[value]]);
|
||||||
|
|
|
@ -10,7 +10,7 @@ uses
|
||||||
Graphics, strutils, Dialogs, Menus, ActnList, ExtCtrls, process,
|
Graphics, strutils, Dialogs, Menus, ActnList, ExtCtrls, process,
|
||||||
{$IFDEF WINDOWS}Windows, {$ENDIF} XMLPropStorage, SynExportHTML,
|
{$IFDEF WINDOWS}Windows, {$ENDIF} XMLPropStorage, SynExportHTML,
|
||||||
fpjson, jsonscanner, LCLIntf,
|
fpjson, jsonscanner, LCLIntf,
|
||||||
u_common, u_ceproject, u_synmemo, u_writableComponent, u_simpleget,
|
u_common, u_ceproject, u_synmemo, u_writableComponent, u_simpleget, u_compilers,
|
||||||
u_widget, u_messages, u_interfaces, u_editor, u_projinspect, u_ceprojeditor,
|
u_widget, u_messages, u_interfaces, u_editor, u_projinspect, u_ceprojeditor,
|
||||||
u_search, u_miniexplorer, u_libman, u_libmaneditor, u_todolist, u_observer,
|
u_search, u_miniexplorer, u_libman, u_libmaneditor, u_todolist, u_observer,
|
||||||
u_toolseditor, u_procinput, u_optionseditor, u_symlist, u_mru, u_processes,
|
u_toolseditor, u_procinput, u_optionseditor, u_symlist, u_mru, u_processes,
|
||||||
|
@ -619,12 +619,14 @@ type
|
||||||
fShowBuildDuration: boolean;
|
fShowBuildDuration: boolean;
|
||||||
fToolBarScaling: TToolBarScaling;
|
fToolBarScaling: TToolBarScaling;
|
||||||
fAutoKillProcThreshold: dword;
|
fAutoKillProcThreshold: dword;
|
||||||
|
fGlobalCompiler: DCompiler;
|
||||||
function getConsoleProgram: string;
|
function getConsoleProgram: string;
|
||||||
procedure setConsoleProgram(const value: string);
|
procedure setConsoleProgram(const value: string);
|
||||||
function getAdditionalPATH: string;
|
function getAdditionalPATH: string;
|
||||||
procedure setAdditionalPATH(const value: string);
|
procedure setAdditionalPATH(const value: string);
|
||||||
function getNativeProjecCompiler: DCompiler;
|
function getNativeProjecCompiler: DCompiler;
|
||||||
procedure setNativeProjecCompiler(value: DCompiler);
|
procedure setNativeProjecCompiler(value: DCompiler);
|
||||||
|
procedure setGlobalCompiler(value: DCompiler);
|
||||||
procedure setSplitterScsrollSpeed(value: byte);
|
procedure setSplitterScsrollSpeed(value: byte);
|
||||||
published
|
published
|
||||||
property additionalPATH: string read getAdditionalPATH write setAdditionalPath;
|
property additionalPATH: string read getAdditionalPATH write setAdditionalPath;
|
||||||
|
@ -643,6 +645,7 @@ type
|
||||||
property flatLook: boolean read fFlatLook write fFlatLook;
|
property flatLook: boolean read fFlatLook write fFlatLook;
|
||||||
property splitterScrollSpeed: byte read fSplitterScrollSpeed write setSplitterScsrollSpeed;
|
property splitterScrollSpeed: byte read fSplitterScrollSpeed write setSplitterScsrollSpeed;
|
||||||
property showBuildDuration: boolean read fShowBuildDuration write fShowBuildDuration default false;
|
property showBuildDuration: boolean read fShowBuildDuration write fShowBuildDuration default false;
|
||||||
|
property globalCompiler: DCompiler read fGlobalCompiler write setGLobalCompiler;
|
||||||
// property toolBarScaling: TToolBarScaling read fToolBarScaling write fToolBarScaling stored false;
|
// property toolBarScaling: TToolBarScaling read fToolBarScaling write fToolBarScaling stored false;
|
||||||
// published for IEditableOptions but stored by DCD wrapper since it reloads before MainForm
|
// published for IEditableOptions but stored by DCD wrapper since it reloads before MainForm
|
||||||
property dcdPort: word read fDcdPort write fDcdPort stored false;
|
property dcdPort: word read fDcdPort write fDcdPort stored false;
|
||||||
|
@ -863,6 +866,14 @@ begin
|
||||||
u_ceproject.setCEProjectCompiler(value);
|
u_ceproject.setCEProjectCompiler(value);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TApplicationOptionsBase.setGlobalCompiler(value: DCompiler);
|
||||||
|
begin
|
||||||
|
if value = DCompiler.global then
|
||||||
|
value := low(DCompiler);
|
||||||
|
fGlobalCompiler := value;
|
||||||
|
u_compilers.globalCompiler := value;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TApplicationOptionsBase.setSplitterScsrollSpeed(value: byte);
|
procedure TApplicationOptionsBase.setSplitterScsrollSpeed(value: byte);
|
||||||
begin
|
begin
|
||||||
if value < 1 then
|
if value < 1 then
|
||||||
|
@ -3044,11 +3055,9 @@ begin
|
||||||
dmdproc.Options := [poUsePipes, poStderrToOutPut];
|
dmdproc.Options := [poUsePipes, poStderrToOutPut];
|
||||||
dmdproc.CurrentDirectory:=fDoc.fileName.extractFileDir;
|
dmdproc.CurrentDirectory:=fDoc.fileName.extractFileDir;
|
||||||
case fRunnablesOptions.compiler of
|
case fRunnablesOptions.compiler of
|
||||||
dmd: dmdProc.Executable := fCompilerSelector.getCompilerPath(dmd);
|
|
||||||
gdc, gdmd: dmdProc.Executable := fCompilerSelector.getCompilerPath(gdmd);
|
gdc, gdmd: dmdProc.Executable := fCompilerSelector.getCompilerPath(gdmd);
|
||||||
ldc, ldmd: dmdProc.Executable := fCompilerSelector.getCompilerPath(ldmd);
|
ldc, ldmd: dmdProc.Executable := fCompilerSelector.getCompilerPath(ldmd);
|
||||||
user1: dmdProc.Executable := fCompilerSelector.getCompilerPath(user1);
|
else dmdProc.Executable := fCompilerSelector.getCompilerPath(fRunnablesOptions.compiler);
|
||||||
user2: dmdProc.Executable := fCompilerSelector.getCompilerPath(user2);
|
|
||||||
end;
|
end;
|
||||||
dmdproc.Parameters.Add(fDoc.fileName);
|
dmdproc.Parameters.Add(fDoc.fileName);
|
||||||
if not asObj then
|
if not asObj then
|
||||||
|
|
Loading…
Reference in New Issue