From 4a0827ddf72ccc01010ccb50e7387dc0845a6238 Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Wed, 3 May 2017 00:05:18 +0200 Subject: [PATCH] ce projects, add option to generate the linker opt for gui apps, close #132 --- docs/widgets_ce_project_editor.md | 1 + src/ce_dmdwrap.pas | 29 ++++++++++++++++++++++++----- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/docs/widgets_ce_project_editor.md b/docs/widgets_ce_project_editor.md index 71380edd..49f5b35f 100644 --- a/docs/widgets_ce_project_editor.md +++ b/docs/widgets_ce_project_editor.md @@ -99,6 +99,7 @@ These options are defined per-configuration. - **dmdOtherOptions**: Custom options, only for DMD. - **gdcOtherOptions**: Custom options, only for GDC. - **ldcOtherOptions**: Custom options, only for LDC. +- **guiApplication**: Under windows, use this option to hide the console if the target is a GUI application. Under Linux this option has no effect. Syntax for the custom / other options: diff --git a/src/ce_dmdwrap.pas b/src/ce_dmdwrap.pas index b431e294..6c61355e 100644 --- a/src/ce_dmdwrap.pas +++ b/src/ce_dmdwrap.pas @@ -239,16 +239,19 @@ type TOtherOpts = class(TOptsGroup) private fCov: boolean; + fGui: boolean; fCustom: TStringList; fDmdOthers: TstringList; fLdcOthers: TStringList; fGdcOthers: TStringList; - procedure setCov(const value: boolean); + procedure setCov(value: boolean); + procedure setGui(value: boolean); procedure setCustom(value: TStringList); procedure setDmdOtherOptions(value: TStringList); procedure setLdcOtherOptions(value: TStringList); procedure setGdcOtherOptions(value: TStringList); published + property guiApplication: boolean read fGui write setGui; property coverage: boolean read fCov write setCov default false; property customOptions: TStringList read fCustom write setCustom; property dmdOtherOptions: TStringList read fDmdOthers write setDmdOtherOptions; @@ -1169,6 +1172,7 @@ begin begin src := TOtherOpts(source); fCov := src.fCov; + fGUi := src.fGui; fCustom.Assign(src.fCustom); fDmdOthers.Assign(src.fDmdOthers); fLdcOthers.Assign(src.fLdcOthers); @@ -1186,13 +1190,22 @@ begin inherited; end; -procedure TOtherOpts.setCov(const value: boolean); +procedure TOtherOpts.setCov(value: boolean); begin - if fCov = value then exit; + if fCov = value then + exit; fCov := value; doChanged; end; +procedure TOtherOpts.setGui(value: boolean); +begin + if fGui = value then + exit; + fGui := value; + doChanged; +end; + procedure TOtherOpts.getOpts(list: TStrings; base: TOptsGroup = nil); var i: integer; @@ -1211,7 +1224,10 @@ begin str := '-' + str; list.AddText(fSymStringExpander.expand(str)); end; - if fCov then list.Add('-cov'); + if fCov then + list.Add('-cov'); + if fGui then + list.Add('-L/SUBSYSTEM:WINDOWS:5.0'); end else begin baseopt := TOtherOpts(base); @@ -1228,7 +1244,10 @@ begin str := '-' + str; list.AddText(fSymStringExpander.expand(str)); end; - if baseopt.fCov or fCov then list.Add('-cov'); + if baseopt.fCov or fCov then + list.Add('-cov'); + if baseopt.fGui or fGui then + list.Add('-L/SUBSYSTEM:WINDOWS:5.0'); end; end;