diff --git a/ide/compileroptions.pp b/ide/compileroptions.pp index 27f2661d61..a1a72c9006 100644 --- a/ide/compileroptions.pp +++ b/ide/compileroptions.pp @@ -358,7 +358,7 @@ procedure SaveXMLCompileReasons(const AConfig: TXMLConfig; const APath: String; implementation const - CompilerOptionsVersion = 2; + CompilerOptionsVersion = 3; Config_Filename = 'compileroptions.xml'; MaxParseStamp = $7fffffff; MinParseStamp = -$7fffffff; @@ -831,6 +831,22 @@ var CompilationGenerateCodeNames[cgcNormalCode])); end; end; + + procedure ReadSmartLinkUnit; + begin + if FileVersion<3 then + SmartLinkUnit := XMLConfigFile.GetValue(p+'UnitStyle/Value', 1)=2 + else + SmartLinkUnit := XMLConfigFile.GetValue(p+'SmartLinkUnit/Value', false); + end; + + procedure ReadLinkSmart; + begin + if FileVersion<3 then + LinkSmart := XMLConfigFile.GetValue(p+'LinkStyle/Value', 1)=3 + else + LinkSmart := XMLConfigFile.GetValue(p+'LinkSmart/Value', false); + end; begin { Load the compiler options from the XML file } @@ -870,7 +886,7 @@ begin { CodeGeneration } p:=Path+'CodeGeneration/'; - UnitStyle := XMLConfigFile.GetValue(p+'UnitStyle/Value', 1); + ReadSmartLinkUnit; IOChecks := XMLConfigFile.GetValue(p+'Checks/IOChecks/Value', false); RangeChecks := XMLConfigFile.GetValue(p+'Checks/RangeChecks/Value', false); OverflowChecks := XMLConfigFile.GetValue(p+'Checks/OverflowChecks/Value', false); @@ -895,7 +911,7 @@ begin UseValgrind := XMLConfigFile.GetValue(p+'Debugging/UseValgrind/Value', false); GenGProfCode := XMLConfigFile.GetValue(p+'Debugging/GenGProfCode/Value', false); StripSymbols := XMLConfigFile.GetValue(p+'Debugging/StripSymbols/Value', false); - LinkStyle := XMLConfigFile.GetValue(p+'LinkStyle/Value', 1); + ReadLinkSmart; PassLinkerOptions := XMLConfigFile.GetValue(p+'Options/PassLinkerOptions/Value', false); LinkerOptions := f(XMLConfigFile.GetValue(p+'Options/LinkerOptions/Value', '')); Win32GraphicApp := XMLConfigFile.GetValue(p+'Options/Win32/GraphicApplication/Value', false); @@ -1007,7 +1023,7 @@ begin { CodeGeneration } p:=Path+'CodeGeneration/'; - XMLConfigFile.SetDeleteValue(p+'UnitStyle/Value', UnitStyle,1); + XMLConfigFile.SetDeleteValue(p+'SmartLinkUnit/Value', SmartLinkUnit,false); XMLConfigFile.SetDeleteValue(p+'Checks/IOChecks/Value', IOChecks,false); XMLConfigFile.SetDeleteValue(p+'Checks/RangeChecks/Value', RangeChecks,false); XMLConfigFile.SetDeleteValue(p+'Checks/OverflowChecks/Value', OverflowChecks,false); @@ -1032,7 +1048,7 @@ begin XMLConfigFile.SetDeleteValue(p+'Debugging/UseValgrind/Value', UseValgrind,false); XMLConfigFile.SetDeleteValue(p+'Debugging/GenGProfCode/Value', GenGProfCode,false); XMLConfigFile.SetDeleteValue(p+'Debugging/StripSymbols/Value', StripSymbols,false); - XMLConfigFile.SetDeleteValue(p+'LinkStyle/Value', LinkStyle,1); + XMLConfigFile.SetDeleteValue(p+'LinkSmart/Value', LinkSmart,false); XMLConfigFile.SetDeleteValue(p+'Options/PassLinkerOptions/Value', PassLinkerOptions,false); XMLConfigFile.SetDeleteValue(p+'Options/LinkerOptions/Value', LinkerOptions,''); XMLConfigFile.SetDeleteValue(p+'Options/Win32/GraphicApplication/Value', Win32GraphicApp,false); @@ -1528,12 +1544,9 @@ Processor specific options: { ----------- Code Generation Tab --------------- } - { UnitStyle '' = Static 'D' = Dynamic 'X' = smart linked } - case (UnitStyle) of - 0: ; - 1: switches := switches + ' -CD'; - 2: switches := switches + ' -CX'; - end; + { UnitStyle '' = Static 'D' = Dynamic (not implemented) 'X' = smart linked } + if SmartLinkUnit then + switches := switches + ' -CX'; { Checks } tempsw := ''; @@ -1643,16 +1656,13 @@ Processor specific options: switches := switches + ' -Xs'; { Link Style - -XD = Link with dynamic libraries - -XS = Link with static libraries + -XD = Link with dynamic libraries, not implemented by FPC + -XS = Link with static libraries, default on non-win32 platforms -XX = Link smart } - if (not (ccloNoLinkerOpts in Flags)) then - case (LinkStyle) of - 1: switches := switches + ' -XD'; // dynamic - 2: switches := switches + ' -XS'; // static - 3: switches := switches + ' -XX -CX'; // smart - end; + + if (not (ccloNoLinkerOpts in Flags)) and LinkSmart then + switches := switches + ' -XX'; // additional Linker options if PassLinkerOptions and (not (ccloNoLinkerOpts in Flags)) then begin @@ -1894,7 +1904,7 @@ begin fGPCCompat := false; // code generation - fUnitStyle := 1; + fSmartLinkUnit := false; fIOChecks := false; fRangeChecks := false; fOverflowChecks := false; @@ -1916,7 +1926,7 @@ begin fUseValgrind := false; fGenGProfCode := false; fStripSymbols := false; - fLinkStyle := 1; + fLinkSmart := false; fPassLinkerOpt := false; LinkerOptions := ''; Win32GraphicApp := false; @@ -1994,7 +2004,7 @@ begin fGPCCompat := CompOpts.fGPCCompat; // Code Generation - fUnitStyle := CompOpts.fUnitStyle; + fSmartLinkUnit := CompOpts.SmartLinkUnit; fIOChecks := CompOpts.fIOChecks; fRangeChecks := CompOpts.fRangeChecks; fOverflowChecks := CompOpts.fOverflowChecks; @@ -2018,7 +2028,7 @@ begin fUseValgrind := CompOpts.fUseValgrind; fGenGProfCode := CompOpts.fGenGProfCode; fStripSymbols := CompOpts.fStripSymbols; - fLinkStyle := CompOpts.fLinkStyle; + fLinkSmart := CompOpts.fLinkSmart; fPassLinkerOpt := CompOpts.fPassLinkerOpt; LinkerOptions := CompOpts.fLinkerOptions; Win32GraphicApp := CompOpts.Win32GraphicApp; @@ -2085,7 +2095,7 @@ begin and (fGPCCompat = CompOpts.fGPCCompat) // code generation - and (fUnitStyle = CompOpts.fUnitStyle) + and (fSmartLinkUnit = CompOpts.SmartLinkUnit) and (fIOChecks = CompOpts.fIOChecks) and (fRangeChecks = CompOpts.fRangeChecks) and (fOverflowChecks = CompOpts.fOverflowChecks) @@ -2109,7 +2119,7 @@ begin and (fUseValgrind = CompOpts.fUseValgrind) and (fGenGProfCode = CompOpts.fGenGProfCode) and (fStripSymbols = CompOpts.fStripSymbols) - and (fLinkStyle = CompOpts.fLinkStyle) + and (fLinkSmart = CompOpts.fLinkSmart) and (fPassLinkerOpt = CompOpts.fPassLinkerOpt) and (fLinkerOptions = CompOpts.fLinkerOptions) and (FWin32GraphicApp = CompOpts.FWin32GraphicApp) diff --git a/ide/compileroptionsdlg.pp b/ide/compileroptionsdlg.pp index 202783e326..fc332c4587 100644 --- a/ide/compileroptionsdlg.pp +++ b/ide/compileroptionsdlg.pp @@ -97,7 +97,8 @@ type { Code Generation Controls } CodeGenPage: TPage; - grpUnitStyle: TRadioGroup; + grpSmartLinkUnit: TGroupBox; + chkSmartLinkUnit: TCheckBox; grpChecks: TGroupBox; chkChecksIO: TCheckBox; @@ -138,9 +139,7 @@ type chkSymbolsStrip: TCheckBox; grpLinkLibraries: TGroupBox; - radLibsLinkDynamic: TRadioButton; - radLibsLinkStatic: TRadioButton; - radLibsLinkSmart: TRadioButton; + chkLinkSmart: TCheckBox; grpOptions: TGroupBox; chkOptionsLinkOpt: TCheckBox; @@ -669,7 +668,7 @@ begin chkSymGPCCompat.Checked := Options.GPCCompat; // code generation - grpUnitStyle.ItemIndex:=Options.UnitStyle; + chkSmartLinkUnit.Checked := Options.SmartLinkUnit; chkChecksIO.Checked := Options.IOChecks; chkChecksRange.Checked := Options.RangeChecks; @@ -712,11 +711,7 @@ begin chkSymbolsStrip.Checked := Options.StripSymbols; chkSymbolsStrip.Enabled:=EnabledLinkerOpts; - case Options.LinkStyle of - 1: radLibsLinkDynamic.Checked := true; - 2: radLibsLinkStatic.Checked := true; - 3: radLibsLinkSmart.Checked := true; - end; + chkLinkSmart.Checked := Options.LinkSmart; grpLinkLibraries.Enabled:=EnabledLinkerOpts; chkOptionsLinkOpt.Checked := Options.PassLinkerOptions; @@ -895,7 +890,7 @@ begin Options.GPCCompat := chkSymGPCCompat.Checked; // code generation - Options.UnitStyle := grpUnitStyle.ItemIndex; + Options.SmartLinkUnit := chkSmartLinkUnit.Checked; Options.IOChecks := chkChecksIO.Checked; Options.RangeChecks := chkChecksRange.Checked; @@ -941,15 +936,7 @@ begin Options.PassLinkerOptions := chkOptionsLinkOpt.Checked; Options.LinkerOptions := edtOptionsLinkOpt.Text; Options.Win32GraphicApp := chkWin32GraphicApp.Checked; - - if (radLibsLinkDynamic.Checked) then - Options.LinkStyle := 1 - else if (radLibsLinkStatic.Checked) then - Options.LinkStyle := 2 - else if (radLibsLinkSmart.Checked) then - Options.LinkStyle := 3 - else - Options.LinkStyle := 1; + Options.LinkSmart := chkLinkSmart.Checked; // messages Options.ShowErrors := chkErrors.Checked; @@ -1341,8 +1328,8 @@ begin // Setup the Code Generation Tab CodeGenPage:=nbMain.Page[Page]; - grpUnitStyle := TRadioGroup.Create(Self); - with grpUnitStyle do + grpSmartLinkUnit := TGroupBox.Create(Self); + with grpSmartLinkUnit do begin Parent := CodeGenPage; Top := 5; @@ -1350,11 +1337,16 @@ begin Height := 80; Width := 150; Caption := dlgCOUnitStyle; - with Items do begin - Add(dlgStatic+' (none)'); - Add(dlgDynamic+' (-CD)'); - Add(dlgCOSmart+' (-CS)'); - end; + end; + + chkSmartLinkUnit := TCheckBox.Create(Self); + with chkSmartLinkUnit do + begin + Parent := grpSmartLinkUnit; + Caption := 'Smart Linking (-CX)'; + Top := 5; + Left := 5; + Width := Parent.ClientWidth-13; end; {------------------------------------------------------------} @@ -1363,7 +1355,7 @@ begin begin Parent := CodeGenPage; Top := 5; - Left := grpUnitStyle.Left + grpUnitStyle.Width + 10; + Left := grpSmartLinkUnit.Left + grpSmartLinkUnit.Width + 10; Height := 80; Width := 210; Caption := dlgCOChecks; @@ -1440,7 +1432,7 @@ begin with grpGenerate do begin Parent := CodeGenPage; - Top := grpUnitStyle.Top + grpUnitStyle.Height + 6; + Top := grpSmartLinkUnit.Top + grpSmartLinkUnit.Height + 6; Left := 10; Height := 90; Width := 150; @@ -1699,42 +1691,20 @@ begin Parent := LinkingPage; Top := grpDebugging.Top + grpDebugging.Height + 10; Left := 10; - Height := 91; + Height := 50; Width := (Self.ClientWidth-30) div 2; Caption := dlgLinkLibraries; end; - radLibsLinkDynamic := TRadioButton.Create(Self); - with radLibsLinkDynamic do + chkLinkSmart := TCheckBox.Create(Self); + with chkLinkSmart do begin Parent := grpLinkLibraries; - Caption := dlgLinkDinLibs+' (-XD)'; + Caption := dlgLinkSmart+' (-XX)'; Top := 6; Left := 8; Height := 22; - Width := Parent.Width-10; - end; - - radLibsLinkStatic := TRadioButton.Create(Self); - with radLibsLinkStatic do - begin - Parent := grpLinkLibraries; - Caption := dlgLinkStatLibs+' (-XS)'; - Top := 27; - Left := 8; - Height := 22; - Width := Parent.Width-10; - end; - - radLibsLinkSmart := TRadioButton.Create(Self); - with radLibsLinkSmart do - begin - Parent := grpLinkLibraries; - Caption := dlgLinkSmart+' (-XX -CX)'; - Top := 48; - Left := 8; - Height := 22; - Width := Parent.Width-10; + Width := Parent.ClientWidth-13; end; {------------------------------------------------------------} @@ -1754,10 +1724,10 @@ begin begin Parent := TargetSpecificsGrpBox; Caption := 'Win32 gui application (-WG)'; - Top := 5; + Top := 8; Left := 2; Height := 22; - Width := Parent.Width-10; + Width := Parent.Width-13; end; {------------------------------------------------------------} diff --git a/ideintf/projectintf.pas b/ideintf/projectintf.pas index 93773bb17b..45571b54a0 100644 --- a/ideintf/projectintf.pas +++ b/ideintf/projectintf.pas @@ -80,7 +80,7 @@ type fStaticKwd: Boolean; // Code generation: - fUnitStyle: Integer; + fSmartLinkUnit: Boolean; fIOChecks: Boolean; fRangeChecks: Boolean; fOverflowChecks: Boolean; @@ -104,7 +104,7 @@ type fUseValgrind: Boolean; fGenGProfCode: Boolean; fStripSymbols: Boolean; - fLinkStyle: Integer; + fLinkSmart: Boolean; fPassLinkerOpt: Boolean; fLinkerOptions: String; FWin32GraphicApp: boolean; @@ -184,7 +184,7 @@ type property StaticKeyword: Boolean read fStaticKwd write fStaticKwd; // code generation: - property UnitStyle: Integer read fUnitStyle write fUnitStyle; + property SmartLinkUnit: Boolean read fSmartLinkUnit write fSmartLinkUnit; property IOChecks: Boolean read fIOChecks write fIOChecks; property RangeChecks: Boolean read fRangeChecks write fRangeChecks; property OverflowChecks: Boolean read fOverflowChecks write fOverflowChecks; @@ -210,7 +210,7 @@ type property UseValgrind: Boolean read fUseValgrind write fUseValgrind; property GenGProfCode: Boolean read fGenGProfCode write fGenGProfCode; property StripSymbols: Boolean read fStripSymbols write fStripSymbols; - property LinkStyle: Integer read fLinkStyle write fLinkStyle; + property LinkSmart: Boolean read fLinkSmart write fLinkSmart; property PassLinkerOptions: Boolean read fPassLinkerOpt write fPassLinkerOpt; property LinkerOptions: String read fLinkerOptions write SetLinkerOptions; property Win32GraphicApp: boolean read FWin32GraphicApp write FWin32GraphicApp;