I'm posting more polished patches.
Latest Changes:
- Bug #9534 is fixed.
- Improvements to Console Wizards
Console Wizard Improvements:
- Adds exception handling compiler flags for GCC, MSVC 2005 (MSVC 2003 not tested) and Borland C++ 5.5.1 compilers. (Earlier wizard script had a function, but the call was not being executed. The function have been improved and added appropriately to wizard)
- Adds appropriate Optimization compiler flags for GCC, MSVC 2005 (MSVC 2003 not tested) and Borland C++ 5.5.1 compilers. (Earlier wizard script had a function, but the call was not being executed. The function have been improved and added appropriately to wizard)
- Adds appropriate libraries for linking with MSVC 2005 and Borland C++ 5.5.1 compilers. (Linking with MSVC 2003 may face problem)
What it Broke?? :shock:
- The /NODEFAULTLIB:libcmt.lib flag has been added. I'm not sure whether this will work for MSVC 6 or MSVC 2003. This is necessary to compile app with MSVC 2005.
- Other compiler flags may break MSVC 6 and MSVC 2003 support (I'm not sure as I don't have them to test).
I'll make improvements to this patch after my upcoming exam..
Patches:
common_functions.patch (Patch #001657 submitted in Berlios)
--- C:/CB_20061121_rev3253_win32/share/CodeBlocks/templates/wizard/old_common_functions.script Tue Jul 25 21:05:04 2006
+++ C:/CB_20061121_rev3253_win32/share/CodeBlocks/templates/wizard/common_functions.script Sat Nov 25 02:01:18 2006
@@ -5,31 +5,44 @@
// Warnings On
function WarningsOn(base, compilerID)
{
- if (GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("msvc*")))
+ if (GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("msvc*")))
{
base.AddCompilerOption(_T("/W3"));
}
- else
+ else if (GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("gcc")))
{
// GCC options are used as fallback
base.AddCompilerOption(_T("-Wall"));
}
+ else if (GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("bcc")))
+ {
+ // Set option for genearting warnings with BCC
+ base.AddCompilerOption(_T("-w"));
+ }
}
// Debug symbols On
function DebugSymbolsOn(base, compilerID)
{
- if (GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("msvc*")))
+ if (GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("msvc*")))
{
base.AddCompilerOption(_T("/Zi"));
base.AddCompilerOption(_T("/D_DEBUG"));
base.AddLinkerOption(_T("/DEBUG"));
+ base.AddLinkerOption(_T("/NODEFAULTLIB:libcmt.lib"));
+ base.AddLinkLib(_T("libcmtd.lib"));
}
- else
+ else if (GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("gcc")))
{
// GCC options are used as fallback
base.AddCompilerOption(_T("-g"));
}
+ else if (GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("bcc")))
+ {
+ // BCC options for generating debug symbols
+ base.AddCompilerOption(_T("-v"));
+ base.AddLinkerOption(_T("-v"));
+ }
}
// Optimizations On
@@ -40,13 +53,19 @@
base.AddCompilerOption(_T("/Og"));
base.AddCompilerOption(_T("/Ox"));
base.AddCompilerOption(_T("/DNDEBUG"));
+ base.AddLinkLib(_T("libcmt.lib"));
}
- else
+ else if (GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("gcc")))
{
// GCC options are used as fallback
base.AddCompilerOption(_T("-O2"));
base.AddLinkerOption(_T("-s"));
}
+ else if (GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("bcc")))
+ {
+ // BCC options for optimizations
+ base.AddCompilerOption(_T("-O2"));
+ }
}
// C++ Exceptions On
@@ -56,11 +75,34 @@
{
base.AddCompilerOption(_T("/EHsc"));
}
- else
+ else if (GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("gcc")))
{
// GCC options are used as fallback
base.AddCompilerOption(_T("-fexceptions"));
}
+ else if (GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("bcc")))
+ {
+ // BCC options for exceptions. Not Tested
+ base.AddCompilerOption(_T("-x"));
+ }
+}
+
+//To include additional Libraries needed for linking
+function IncludeAdditionalLib(base, compilerID)
+{
+ if (GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("msvc*")))
+ {
+ //Add any library which is needed
+ }
+ else if (GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("gcc")))
+ {
+ //Add any library which is needed
+ }
+ else if (GetCompilerFactory().CompilerInheritsFrom(compilerID, _T("bcc")))
+ {
+ base.AddLinkLib(_T("cw32mt.lib"));
+ base.AddLinkLib(_T("import32.lib"));
+ }
}
function VerifyDirectory(dir_or_macro)
wizard.patch (Patch #001656 submitted in Berlios)
--- C:/CB_20061121_rev3253_win32/share/CodeBlocks/templates/wizard/console/old_wizard.script Sat Nov 25 01:15:26 2006
+++ C:/CB_20061121_rev3253_win32/share/CodeBlocks/templates/wizard/console/wizard.script Sat Nov 25 01:27:49 2006
@@ -97,13 +97,21 @@
// Debug build target
local target = project.GetBuildTarget(Wizard.GetDebugName());
if (!IsNull(target))
+ {
SetupTarget(target, true);
+ CppExceptionsOn(target, Wizard.GetCompilerID());
+ IncludeAdditionalLib(target, Wizard.GetCompilerID());
+ }
// Release build target
target = project.GetBuildTarget(Wizard.GetReleaseName());
if (!IsNull(target))
+ {
SetupTarget(target, false);
-
+ CppExceptionsOn(target, Wizard.GetCompilerID());
+ IncludeAdditionalLib(target, Wizard.GetCompilerID());
+ }
+
// all done!
return true;
}
@@ -124,12 +132,14 @@
if (is_debug)
{
// enable debugging symbols for this target
- DebugSymbolsOn(target, Wizard.GetTargetCompilerID());
+ //DebugSymbolsOn(target, Wizard.GetTargetCompilerID());
+ DebugSymbolsOn(target, Wizard.GetCompilerID());
}
else
{
// enable optimizations for this target
- OptimizationsOn(target, Wizard.GetTargetCompilerID());
+ //OptimizationsOn(target, Wizard.GetTargetCompilerID());
+ OptimizationsOn(target, Wizard.GetCompilerID());
}
// all done!
Results of Some Test Applications:
-------------- Build: Debug in TestBor ---------------
Compiling: main.cpp
main.cpp:
Linking console executable: .\TestBor.exe
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings
-------------- Build: Release in TestBor ---------------
Compiling: main.cpp
main.cpp:
Linking console executable: .\TestBor.exe
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings
-------------- Build: Debug in TestVC ---------------
main.c
Linking console executable: .\TestVC.exe
LINK : .\TestVC.exe not found or not built by the last incremental link; performing full link
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings
-------------- Build: Release in TestVC ---------------
cl : Command line warning D9035 : option 'Og' has been deprecated and will be removed in a future release
main.c
Linking console executable: .\TestVC.exe
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings
-------------- Build: Debug in TestVC ---------------
main.cpp
Linking console executable: .\TestVC.exe
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings
-------------- Build: Release in TestVC ---------------
cl : Command line warning D9035 : option 'Og' has been deprecated and will be removed in a future release
main.cpp
Linking console executable: .\TestVC.exe
Process terminated with status 0 (0 minutes, 0 seconds)
0 errors, 0 warnings
-------------- Build: Debug in TestGCC ---------------
Compiling: main.cpp
Linking console executable: .\TestGCC.exe
Process terminated with status 0 (0 minutes, 3 seconds)
0 errors, 0 warnings
-------------- Build: Release in TestGCC ---------------
Compiling: main.cpp
Linking console executable: .\TestGCC.exe
Process terminated with status 0 (0 minutes, 1 seconds)
0 errors, 0 warnings
You can see that all the test applications generated by the wizard compiled with GCC, MSVC 2005 and Borland C++ 5.5.1 without any error or warnings.
Please test it and post your feedback.
Regards,
Biplab Kumar Modak