mirror of https://gitlab.com/basile.b/dexed.git
CE projects, add list for specific DMD/LDC/GDC options
This commit is contained in:
parent
4be099408e
commit
d502757268
|
@ -239,16 +239,26 @@ type
|
|||
private
|
||||
fCov: boolean;
|
||||
fCustom: TStringList;
|
||||
fDmdOthers: TstringList;
|
||||
fLdcOthers: TStringList;
|
||||
fGdcOthers: TStringList;
|
||||
procedure setCov(const value: boolean);
|
||||
procedure setCustom(value: TStringList);
|
||||
procedure setDmdOtherOptions(value: TStringList);
|
||||
procedure setLdcOtherOptions(value: TStringList);
|
||||
procedure setGdcOtherOptions(value: TStringList);
|
||||
published
|
||||
property coverage: boolean read fCov write setCov default false;
|
||||
property customOptions: TStringList read fCustom write setCustom;
|
||||
property dmdOtherOptions: TStringList read fDmdOthers write setDmdOtherOptions;
|
||||
property ldcOtherOptions: TStringList read fLdcOthers write setLdcOtherOptions;
|
||||
property gdcOtherOptions: TStringList read fGdcOthers write setGdcOtherOptions;
|
||||
public
|
||||
constructor create; override;
|
||||
destructor destroy; override;
|
||||
procedure assign(source: TPersistent); override;
|
||||
procedure getOpts(list: TStrings; base: TOptsGroup = nil); override;
|
||||
procedure getCompilerSpecificOpts(list: TStrings; base: TOptsGroup = nil; compiler: TCECompiler = dmd);
|
||||
end;
|
||||
|
||||
(*****************************************************************************
|
||||
|
@ -1122,6 +1132,9 @@ constructor TOtherOpts.create;
|
|||
begin
|
||||
inherited;
|
||||
fCustom := TStringList.Create;
|
||||
fDmdOthers := TStringList.Create;
|
||||
fLdcOthers := TStringList.Create;
|
||||
fGdcOthers := TStringList.Create;
|
||||
end;
|
||||
|
||||
procedure TOtherOpts.assign(source: TPersistent);
|
||||
|
@ -1131,8 +1144,11 @@ begin
|
|||
if (source is TOtherOpts) then
|
||||
begin
|
||||
src := TOtherOpts(source);
|
||||
fCustom.Assign(src.fCustom);
|
||||
fCov := src.fCov;
|
||||
fCustom.Assign(src.fCustom);
|
||||
fDmdOthers.Assign(src.fDmdOthers);
|
||||
fLdcOthers.Assign(src.fLdcOthers);
|
||||
fGdcOthers.Assign(src.fGdcOthers);
|
||||
end
|
||||
else inherited;
|
||||
end;
|
||||
|
@ -1140,6 +1156,9 @@ end;
|
|||
destructor TOtherOpts.destroy;
|
||||
begin
|
||||
fCustom.Free;
|
||||
fDmdOthers.Free;
|
||||
fLdcOthers.Free;
|
||||
fGdcOthers.Free;
|
||||
inherited;
|
||||
end;
|
||||
|
||||
|
@ -1152,47 +1171,122 @@ end;
|
|||
|
||||
procedure TOtherOpts.getOpts(list: TStrings; base: TOptsGroup = nil);
|
||||
var
|
||||
str1, str2: string;
|
||||
i: integer;
|
||||
str: string;
|
||||
baseopt: TOtherOpts;
|
||||
rightList: TStringList;
|
||||
begin
|
||||
if base.isNil then
|
||||
begin
|
||||
for i := 0 to fCustom.Count-1 do
|
||||
begin
|
||||
for str1 in fCustom do if str1 <> '' then
|
||||
begin
|
||||
if isStringDisabled(str1) then
|
||||
str := fCustom[i];
|
||||
if str.isEmpty or isStringDisabled(str) then
|
||||
continue;
|
||||
if str1[1] <> '-' then
|
||||
str2 := '-' + str1
|
||||
else
|
||||
str2 := str1;
|
||||
list.AddText(fSymStringExpander.expand(str2));
|
||||
if str[1] <> '-' then
|
||||
str := '-' + str;
|
||||
list.AddText(fSymStringExpander.expand(str));
|
||||
end;
|
||||
if fCov then list.Add('-cov');
|
||||
end else
|
||||
begin
|
||||
baseopt := TOtherOpts(base);
|
||||
if fCustom.Count = 0 then rightList := baseopt.fCustom
|
||||
else rightList := fCustom;
|
||||
for str1 in rightList do if str1 <> '' then
|
||||
if fCustom.Count = 0 then
|
||||
rightList := baseopt.fCustom
|
||||
else
|
||||
rightList := fCustom;
|
||||
for i := 0 to rightList.Count-1 do
|
||||
begin
|
||||
if isStringDisabled(str1) then
|
||||
str := rightList[i];
|
||||
if str.isEmpty or isStringDisabled(str) then
|
||||
continue;
|
||||
if str1[1] <> '-' then
|
||||
str2 := '-' + str1
|
||||
else
|
||||
str2 := str1;
|
||||
list.AddText(fSymStringExpander.expand(str2));
|
||||
if str[1] <> '-' then
|
||||
str := '-' + str;
|
||||
list.AddText(fSymStringExpander.expand(str));
|
||||
end;
|
||||
if baseopt.fCov or fCov then list.Add('-cov');
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TOtherOpts.getCompilerSpecificOpts(list: TStrings; base:
|
||||
TOptsGroup = nil; compiler: TCECompiler = dmd);
|
||||
var
|
||||
i: integer;
|
||||
str: string;
|
||||
baseopt: TOtherOpts;
|
||||
lst: TStringList;
|
||||
begin
|
||||
if base.isNil then
|
||||
begin
|
||||
case compiler of
|
||||
TCECompiler.dmd: lst := fDmdOthers;
|
||||
TCECompiler.ldc: lst := fLdcOthers;
|
||||
TCECompiler.gdc: lst := fGdcOthers;
|
||||
end;
|
||||
for i := 0 to lst.Count-1 do
|
||||
begin
|
||||
str := lst[i];
|
||||
if str.isEmpty or isStringDisabled(str) then
|
||||
continue;
|
||||
if str[1] <> '-' then
|
||||
str := '-' + str;
|
||||
list.AddText(fSymStringExpander.expand(str));
|
||||
end;
|
||||
end else
|
||||
begin
|
||||
baseopt := TOtherOpts(base);
|
||||
case compiler of
|
||||
TCECompiler.dmd:
|
||||
if fDmdOthers.Count = 0 then
|
||||
lst := baseopt.fDmdOthers
|
||||
else
|
||||
lst := fDmdOthers;
|
||||
TCECompiler.ldc:
|
||||
if fLdcOthers.Count = 0 then
|
||||
lst := baseopt.fLdcOthers
|
||||
else
|
||||
lst := fLdcOthers;
|
||||
TCECompiler.gdc:
|
||||
if fGdcOthers.Count = 0 then
|
||||
lst := baseopt.fGdcOthers
|
||||
else
|
||||
lst := fGdcOthers;
|
||||
end;
|
||||
for i := 0 to lst.Count-1 do
|
||||
begin
|
||||
str := lst[i];
|
||||
if str.isEmpty or isStringDisabled(str) then
|
||||
continue;
|
||||
if str[1] <> '-' then
|
||||
str := '-' + str;
|
||||
list.AddText(fSymStringExpander.expand(str));
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TOtherOpts.setCustom(value: TStringList);
|
||||
begin
|
||||
fCustom.Assign(value);
|
||||
doChanged;
|
||||
end;
|
||||
|
||||
procedure TOtherOpts.setDmdOtherOptions(value: TStringList);
|
||||
begin
|
||||
fDmdOthers.Assign(value);
|
||||
doChanged;
|
||||
end;
|
||||
|
||||
procedure TOtherOpts.setLdcOtherOptions(value: TStringList);
|
||||
begin
|
||||
fLdcOthers.Assign(value);
|
||||
doChanged;
|
||||
end;
|
||||
|
||||
procedure TOtherOpts.setGdcOtherOptions(value: TStringList);
|
||||
begin
|
||||
fGdcOthers.Assign(value);
|
||||
doChanged;
|
||||
end;
|
||||
{$ENDREGION}
|
||||
|
||||
{$REGION TCustomProcOptions ----------------------------------------------------}
|
||||
|
@ -1368,7 +1462,7 @@ begin
|
|||
fPostProcOpt.assign(src.fPostProcOpt);
|
||||
fRunProjOpt.assign(src.fRunProjOpt);
|
||||
//
|
||||
// isBase / isOverriden not copied by purpose.
|
||||
// isBase / isOverriden not copied on purpose.
|
||||
end
|
||||
else inherited;
|
||||
end;
|
||||
|
|
|
@ -65,6 +65,8 @@ type
|
|||
// passes compilation message as "to be guessed"
|
||||
procedure compProcOutput(proc: TObject);
|
||||
procedure compProcTerminated(proc: TObject);
|
||||
function getObjectsDirectory: string; inline;
|
||||
procedure getUpToDateObjects(str: TStrings);
|
||||
protected
|
||||
procedure beforeLoad; override;
|
||||
procedure afterSave; override;
|
||||
|
@ -407,15 +409,17 @@ var
|
|||
i: Integer;
|
||||
exc: TStringList;
|
||||
libAliasesPtr: TStringList;
|
||||
conf: TCompilerConfiguration;
|
||||
str: string;
|
||||
begin
|
||||
if fConfIx = -1 then exit;
|
||||
exc := TStringList.Create;
|
||||
try
|
||||
conf := currentConfiguration;
|
||||
// prepares the exclusions
|
||||
for i := 0 to currentConfiguration.pathsOptions.exclusions.Count-1 do
|
||||
for i := 0 to conf.pathsOptions.exclusions.Count-1 do
|
||||
begin
|
||||
str := fSymStringExpander.expand(currentConfiguration.pathsOptions.exclusions[i]);
|
||||
str := fSymStringExpander.expand(conf.pathsOptions.exclusions[i]);
|
||||
exc.Add(str)
|
||||
end;
|
||||
// sources
|
||||
|
@ -448,18 +452,25 @@ begin
|
|||
{$IFDEF WINDOWS}
|
||||
// only link lib file if executable/shared lib
|
||||
// OS switch: read more @ http://forum.dlang.org/post/ooekdkwrefposmchekrp@forum.dlang.org
|
||||
if (currentConfiguration.outputOptions.binaryKind in [executable, sharedlib]) or
|
||||
currentConfiguration.outputOptions.alwaysLinkStaticLibs then
|
||||
if (conf.outputOptions.binaryKind in [executable, sharedlib]) or
|
||||
conf.outputOptions.alwaysLinkStaticLibs then
|
||||
{$ENDIF}
|
||||
LibMan.getLibFiles(libAliasesPtr, list);
|
||||
|
||||
// but always adds -I<path>
|
||||
LibMan.getLibSourcePath(libAliasesPtr, list);
|
||||
// config
|
||||
if currentConfiguration.isOverriddenConfiguration then
|
||||
currentConfiguration.getOpts(list, fBaseConfig)
|
||||
if conf.isOverriddenConfiguration then
|
||||
begin
|
||||
conf.getOpts(list, fBaseConfig);
|
||||
conf.otherOptions.getCompilerSpecificOpts(list, fBaseConfig.otherOptions,
|
||||
NativeProjectCompiler);
|
||||
end
|
||||
else
|
||||
currentConfiguration.getOpts(list);
|
||||
begin
|
||||
conf.getOpts(list);
|
||||
conf.otherOptions.getCompilerSpecificOpts(list, nil, NativeProjectCompiler);
|
||||
end;
|
||||
finally
|
||||
exc.Free;
|
||||
end;
|
||||
|
@ -771,6 +782,7 @@ begin
|
|||
fCompilProc.OnReadData:= @compProcOutput;
|
||||
fCompilProc.OnTerminate:= @compProcTerminated;
|
||||
getOpts(fCompilProc.Parameters);
|
||||
//getUpToDateObjects(fCompilProc.Parameters);
|
||||
if NativeProjectCompiler = gdc then
|
||||
fCompilProc.Parameters.Add('-gdc=gdc');
|
||||
fCompilProc.Execute;
|
||||
|
@ -904,6 +916,46 @@ begin
|
|||
result := true;
|
||||
end;
|
||||
|
||||
function TCENativeProject.getObjectsDirectory: string; inline;
|
||||
var
|
||||
cfg: TCompilerConfiguration;
|
||||
begin
|
||||
result := '';
|
||||
cfg := currentConfiguration;
|
||||
if (cfg.pathsOptions.objectDirectory <> '') and
|
||||
DirectoryExistsUTF8(cfg.pathsOptions.objectDirectory) then
|
||||
result := cfg.pathsOptions.objectDirectory;
|
||||
end;
|
||||
|
||||
procedure TCENativeProject.getUpToDateObjects(str: TStrings);
|
||||
var
|
||||
odr: string;
|
||||
src: string;
|
||||
obj: string;
|
||||
i: integer;
|
||||
begin
|
||||
odr := getObjectsDirectory;
|
||||
if odr.isEmpty then
|
||||
begin
|
||||
for i := 0 to fSrcs.Count-1 do
|
||||
begin
|
||||
src := sourceAbsolute(i);
|
||||
obj := stripFileExt(src) + objExt;
|
||||
if obj.fileExists and src.fileExists then
|
||||
begin
|
||||
if FileAgeUTF8(src) > FileAgeUTF8(obj) then
|
||||
DeleteFile(obj)
|
||||
else
|
||||
str.Add(obj);
|
||||
end;
|
||||
end;
|
||||
end
|
||||
else
|
||||
begin
|
||||
|
||||
end;
|
||||
end;
|
||||
|
||||
function TCENativeProject.outputFilename: string;
|
||||
begin
|
||||
exit(fOutputFilename);
|
||||
|
|
Loading…
Reference in New Issue