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.
|
||||
- **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.
|
||||
- **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 __Project/Open recent project__.
|
||||
- **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).
|
||||
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 [_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 setUser2RuntimePath(const value: string);
|
||||
procedure setUser2PhobosPath(const value: string);
|
||||
private
|
||||
procedure checkIfGlobalIsGlobal;
|
||||
protected
|
||||
procedure afterLoad; override;
|
||||
published
|
||||
|
@ -154,6 +156,9 @@ type
|
|||
destructor destroy; override;
|
||||
end;
|
||||
|
||||
var
|
||||
globalCompiler: DCompiler;
|
||||
|
||||
implementation
|
||||
{$R *.lfm}
|
||||
|
||||
|
@ -236,6 +241,15 @@ begin
|
|||
inherited;
|
||||
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);
|
||||
var
|
||||
src: TCompilersPaths;
|
||||
|
@ -521,6 +535,11 @@ begin
|
|||
DCompiler.ldmd: exit(exeFullName('ldmd2' + exeExt).fileExists);
|
||||
DCompiler.user1: exit(User1ExeName.fileExists);
|
||||
DCompiler.user2: exit(User2ExeName.fileExists);
|
||||
DCompiler.global:
|
||||
begin
|
||||
fPaths.checkIfGlobalIsGlobal;
|
||||
exit(isCompilerValid(globalCompiler));
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -535,6 +554,11 @@ begin
|
|||
DCompiler.ldmd: exit(exeFullName('ldmd2' + exeExt));
|
||||
DCompiler.user1: exit(User1ExeName);
|
||||
DCompiler.user2: exit(User2ExeName);
|
||||
DCompiler.global:
|
||||
begin
|
||||
checkIfGlobalIsGlobal;
|
||||
exit(getCompilerPath(globalCompiler));
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -555,6 +579,8 @@ begin
|
|||
begin tryAdd(User1RuntimePath); tryAdd(User1PhobosPath); end;
|
||||
DCompiler.user2:
|
||||
begin tryAdd(User2RuntimePath); tryAdd(User2PhobosPath); end;
|
||||
DCompiler.global:
|
||||
begin checkIfGlobalIsGlobal; getCompilerImports(globalCompiler, paths); end;
|
||||
end;
|
||||
end;
|
||||
{$ENDREGION}
|
||||
|
|
|
@ -217,7 +217,7 @@ type
|
|||
|
||||
var
|
||||
DubCompiler: DCompiler = dmd;
|
||||
DubCompilerFilename: string = 'dmd';
|
||||
DubCompilerFilename: string;
|
||||
Lfm: ILifetimeManager = nil;
|
||||
|
||||
const
|
||||
|
@ -895,6 +895,8 @@ begin
|
|||
str.Add('--build=' + fBuildTypes[fBuiltTypeIx]);
|
||||
if (fConfigs.Count <> 1) and (fConfigs[0] <> DubDefaultConfigName) then
|
||||
str.Add('--config=' + fConfigs[fConfigIx]);
|
||||
if DubCompilerFilename.isEmpty then
|
||||
setDubCompiler(dubBuildOptions.compiler);
|
||||
str.Add('--compiler=' + DubCompilerFilename);
|
||||
dubBuildOptions.getOpts(str);
|
||||
result := str.Text;
|
||||
|
@ -1157,6 +1159,8 @@ begin
|
|||
if (fConfigs.Count <> 1) and (fConfigs[0] <> DubDefaultConfigName) then
|
||||
fDubProc.Parameters.Add('--config=' + fConfigs[fConfigIx]);
|
||||
end;
|
||||
if DubCompilerFilename.isEmpty then
|
||||
setDubCompiler(dubBuildOptions.compiler);
|
||||
fDubProc.Parameters.Add('--compiler=' + DubCompilerFilename);
|
||||
dubBuildOptions.getOpts(fDubProc.Parameters);
|
||||
if (command <> dcBuild) and runArgs.isNotEmpty then
|
||||
|
@ -1897,8 +1901,9 @@ end;
|
|||
{$ENDREGION}
|
||||
|
||||
initialization
|
||||
setDubCompiler(dmd);
|
||||
// setDubCompiler(dmd);
|
||||
dubBuildOptions:= TDubBuildOptions.create(nil);
|
||||
DubCompilerFilename := '';
|
||||
finalization
|
||||
dubBuildOptions.free;
|
||||
TDubLocalPackages.deinit;
|
||||
|
|
|
@ -379,7 +379,7 @@ type
|
|||
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.
|
||||
|
@ -665,7 +665,7 @@ end;
|
|||
function usingCompilerInfo(value: DCompiler): string;
|
||||
const
|
||||
c2id: array[DCompiler] of string = ('dmd', 'gdc', 'gdmd', 'ldc', 'ldmd',
|
||||
'user1', 'user2');
|
||||
'user1', 'user2', 'global');
|
||||
begin
|
||||
result := format('using %s (%s)',
|
||||
[getCompilerSelector.getCompilerPath(value), c2id[value]]);
|
||||
|
|
|
@ -10,7 +10,7 @@ uses
|
|||
Graphics, strutils, Dialogs, Menus, ActnList, ExtCtrls, process,
|
||||
{$IFDEF WINDOWS}Windows, {$ENDIF} XMLPropStorage, SynExportHTML,
|
||||
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_search, u_miniexplorer, u_libman, u_libmaneditor, u_todolist, u_observer,
|
||||
u_toolseditor, u_procinput, u_optionseditor, u_symlist, u_mru, u_processes,
|
||||
|
@ -619,12 +619,14 @@ type
|
|||
fShowBuildDuration: boolean;
|
||||
fToolBarScaling: TToolBarScaling;
|
||||
fAutoKillProcThreshold: dword;
|
||||
fGlobalCompiler: DCompiler;
|
||||
function getConsoleProgram: string;
|
||||
procedure setConsoleProgram(const value: string);
|
||||
function getAdditionalPATH: string;
|
||||
procedure setAdditionalPATH(const value: string);
|
||||
function getNativeProjecCompiler: DCompiler;
|
||||
procedure setNativeProjecCompiler(value: DCompiler);
|
||||
procedure setGlobalCompiler(value: DCompiler);
|
||||
procedure setSplitterScsrollSpeed(value: byte);
|
||||
published
|
||||
property additionalPATH: string read getAdditionalPATH write setAdditionalPath;
|
||||
|
@ -643,6 +645,7 @@ type
|
|||
property flatLook: boolean read fFlatLook write fFlatLook;
|
||||
property splitterScrollSpeed: byte read fSplitterScrollSpeed write setSplitterScsrollSpeed;
|
||||
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;
|
||||
// published for IEditableOptions but stored by DCD wrapper since it reloads before MainForm
|
||||
property dcdPort: word read fDcdPort write fDcdPort stored false;
|
||||
|
@ -863,6 +866,14 @@ begin
|
|||
u_ceproject.setCEProjectCompiler(value);
|
||||
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);
|
||||
begin
|
||||
if value < 1 then
|
||||
|
@ -3044,11 +3055,9 @@ begin
|
|||
dmdproc.Options := [poUsePipes, poStderrToOutPut];
|
||||
dmdproc.CurrentDirectory:=fDoc.fileName.extractFileDir;
|
||||
case fRunnablesOptions.compiler of
|
||||
dmd: dmdProc.Executable := fCompilerSelector.getCompilerPath(dmd);
|
||||
gdc, gdmd: dmdProc.Executable := fCompilerSelector.getCompilerPath(gdmd);
|
||||
ldc, ldmd: dmdProc.Executable := fCompilerSelector.getCompilerPath(ldmd);
|
||||
user1: dmdProc.Executable := fCompilerSelector.getCompilerPath(user1);
|
||||
user2: dmdProc.Executable := fCompilerSelector.getCompilerPath(user2);
|
||||
else dmdProc.Executable := fCompilerSelector.getCompilerPath(fRunnablesOptions.compiler);
|
||||
end;
|
||||
dmdproc.Parameters.Add(fDoc.fileName);
|
||||
if not asObj then
|
||||
|
|
Loading…
Reference in New Issue