diff -c -N -r ../Ice-3.4.2/vsaddin/src/Builder.cs vsaddin/src/Builder.cs *** ../Ice-3.4.2/vsaddin/src/Builder.cs 2011-08-19 02:42:45.835003403 +0200 --- vsaddin/src/Builder.cs 2011-08-19 01:21:21.017002250 +0200 *************** *** 1125,1139 **** public bool buildCppProject(Project project, bool force) { ! VCConfiguration configuration = Util.getActiveVCConfiguration(project); ! VCCLCompilerTool compilerTool = ! (VCCLCompilerTool)(((IVCCollection)configuration.Tools).Item("VCCLCompilerTool")); ! VCLinkerTool linkerTool = (VCLinkerTool)(((IVCCollection)configuration.Tools).Item("VCLinkerTool")); if(!_opening) ! { ! Util.checkCppRunTimeLibrary(this, project, compilerTool, linkerTool); } string sliceCompiler = getSliceCompilerPath(project); return buildCppProject(project, project.ProjectItems, sliceCompiler, force); --- 1125,1163 ---- public bool buildCppProject(Project project, bool force) { ! VCConfiguration conf = Util.getActiveVCConfiguration(project); ! if(conf.ConfigurationType == ConfigurationTypes.typeGeneric || ! conf.ConfigurationType == ConfigurationTypes.typeUnknown) ! { ! string err = "Configuration Type: '" + conf.ConfigurationType.ToString() + "' not suported by Ice Visual Studio Add-in"; ! Util.write(project, Util.msgLevel.msgError, ! "------ Slice compilation failed: Project: " + Util.getTraceProjectName(project) + " ------\n\n" + ! err); ! MessageBox.Show(err, "Ice Visual Studio Add-in", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, ! (MessageBoxOptions)0); ! ! Connect.getBuilder().addError(project, "", TaskErrorCategory.Error, 0, 0, err); ! ! return false; ! } + VCCLCompilerTool compilerTool = + (VCCLCompilerTool)(((IVCCollection)conf.Tools).Item("VCCLCompilerTool")); + + bool staticLib = conf.ConfigurationType == Microsoft.VisualStudio.VCProjectEngine.ConfigurationTypes.typeStaticLibrary; + LinkerAdapter linkerAdapter; + if(staticLib) + { + linkerAdapter = new StaticLinkerAdapter((VCLibrarianTool)(((IVCCollection)conf.Tools).Item("VCLibrarianTool"))); + } + else + { + linkerAdapter = new DynamicLinkerAdapter((VCLinkerTool)(((IVCCollection)conf.Tools).Item("VCLinkerTool"))); + } if(!_opening) ! { ! Util.checkCppRunTimeLibrary(this, project, compilerTool, linkerAdapter); } string sliceCompiler = getSliceCompilerPath(project); return buildCppProject(project, project.ProjectItems, sliceCompiler, force); diff -c -N -r ../Ice-3.4.2/vsaddin/src/IceCppConfigurationDialog.cs vsaddin/src/IceCppConfigurationDialog.cs *** ../Ice-3.4.2/vsaddin/src/IceCppConfigurationDialog.cs 2011-06-15 21:44:00.000000000 +0200 --- vsaddin/src/IceCppConfigurationDialog.cs 2011-08-19 01:21:31.016002254 +0200 *************** *** 16,22 **** using System.Text; using System.Windows.Forms; using System.Globalization; ! using EnvDTE; namespace Ice.VisualStudio { --- 16,23 ---- using System.Text; using System.Windows.Forms; using System.Globalization; ! using EnvDTE; ! using Microsoft.VisualStudio.VCProjectEngine; namespace Ice.VisualStudio { *************** *** 41,48 **** if(_project != null) { ! this.Text = "Ice Configuration - Project: " + _project.Name; bool enabled = Util.isSliceBuilderEnabled(project); setEnabled(enabled); chkEnableBuilder.Checked = enabled; load(); --- 42,51 ---- if(_project != null) { ! this.Text = "Ice Configuration - Project: " + _project.Name; bool enabled = Util.isSliceBuilderEnabled(project); + VCConfiguration conf = Util.getActiveVCConfiguration(project); + _staticLib = conf.ConfigurationType == ConfigurationTypes.typeStaticLibrary; setEnabled(enabled); chkEnableBuilder.Checked = enabled; load(); *************** *** 246,261 **** comboBoxVerboseLevel.Enabled = enabled; includePathView.setEnabled(enabled); ! extraCompilerOptions.setEnabled(enabled); ! ! chkFreeze.Enabled = enabled; ! chkGlacier2.Enabled = enabled; ! chkIceBox.Enabled = enabled; ! chkIceGrid.Enabled = enabled; ! chkIcePatch2.Enabled = enabled; ! chkIceSSL.Enabled = enabled; ! chkIceStorm.Enabled = enabled; ! txtDllExportSymbol.Enabled = enabled; } private void formClosing(object sender, FormClosingEventArgs e) --- 249,264 ---- comboBoxVerboseLevel.Enabled = enabled; includePathView.setEnabled(enabled); ! extraCompilerOptions.setEnabled(enabled); ! txtDllExportSymbol.Enabled = enabled; ! ! chkFreeze.Enabled = _staticLib ? false : enabled; ! chkGlacier2.Enabled = _staticLib ? false : enabled; ! chkIceBox.Enabled = _staticLib ? false : enabled; ! chkIceGrid.Enabled = _staticLib ? false : enabled; ! chkIcePatch2.Enabled = _staticLib ? false : enabled; ! chkIceSSL.Enabled = _staticLib ? false : enabled; ! chkIceStorm.Enabled = _staticLib ? false : enabled; } private void formClosing(object sender, FormClosingEventArgs e) *************** *** 657,692 **** if(includePathView.hasUnsavedChanges()) { return true; ! } ! ! // Ice libraries ! if(chkFreeze.Checked != Util.hasIceCppLib(_project, "Freeze")) ! { ! return true; ! } ! if(chkGlacier2.Checked != Util.hasIceCppLib(_project, "Glacier2")) ! { ! return true; ! } ! if(chkIceBox.Checked != Util.hasIceCppLib(_project, "IceBox")) ! { ! return true; ! } ! if(chkIceGrid.Checked != Util.hasIceCppLib(_project, "IceGrid")) ! { ! return true; ! } ! if(chkIcePatch2.Checked != Util.hasIceCppLib(_project, "IcePatch2")) ! { ! return true; ! } ! if(chkIceSSL.Checked != Util.hasIceCppLib(_project, "IceSSL")) ! { ! return true; ! } ! if(chkIceStorm.Checked != Util.hasIceCppLib(_project, "IceStorm")) ! { ! return true; } return false; } --- 660,698 ---- if(includePathView.hasUnsavedChanges()) { return true; ! } ! ! if(!_staticLib) ! { ! // Ice libraries ! if(chkFreeze.Checked != Util.hasIceCppLib(_project, "Freeze")) ! { ! return true; ! } ! if(chkGlacier2.Checked != Util.hasIceCppLib(_project, "Glacier2")) ! { ! return true; ! } ! if(chkIceBox.Checked != Util.hasIceCppLib(_project, "IceBox")) ! { ! return true; ! } ! if(chkIceGrid.Checked != Util.hasIceCppLib(_project, "IceGrid")) ! { ! return true; ! } ! if(chkIcePatch2.Checked != Util.hasIceCppLib(_project, "IcePatch2")) ! { ! return true; ! } ! if(chkIceSSL.Checked != Util.hasIceCppLib(_project, "IceSSL")) ! { ! return true; ! } ! if(chkIceStorm.Checked != Util.hasIceCppLib(_project, "IceStorm")) ! { ! return true; ! } } return false; } *************** *** 705,711 **** } private bool _initialized; ! private Project _project; private bool _changed = false; } } --- 711,718 ---- } private bool _initialized; ! private Project _project; ! private bool _staticLib = false; private bool _changed = false; } } diff -c -N -r ../Ice-3.4.2/vsaddin/src/Util.cs vsaddin/src/Util.cs *** ../Ice-3.4.2/vsaddin/src/Util.cs 2011-08-19 02:42:45.836003403 +0200 --- vsaddin/src/Util.cs 2011-08-19 02:40:10.460003365 +0200 *************** *** 37,42 **** --- 37,127 ---- namespace Ice.VisualStudio { + public interface LinkerAdapter + { + String AdditionalDependencies + { + get; + set; + } + + String AdditionalLibraryDirectories + { + get; + set; + } + } + + public class DynamicLinkerAdapter : LinkerAdapter + { + public DynamicLinkerAdapter(VCLinkerTool linkerTool) + { + _linkerTool = linkerTool; + } + + public String AdditionalDependencies + { + get + { + return _linkerTool.AdditionalDependencies; + } + + set + { + _linkerTool.AdditionalDependencies = value; + } + } + + public String AdditionalLibraryDirectories + { + get + { + return _linkerTool.AdditionalLibraryDirectories; + } + + set + { + _linkerTool.AdditionalLibraryDirectories = value; + } + } + + private VCLinkerTool _linkerTool; + } + + public class StaticLinkerAdapter : LinkerAdapter + { + public StaticLinkerAdapter(VCLibrarianTool librarianTool) + { + _librarianTool = librarianTool; + } + + public String AdditionalDependencies + { + get + { + return ""; + } + + set + { + } + } + + public String AdditionalLibraryDirectories + { + get + { + return ""; + } + + set + { + } + } + + private VCLibrarianTool _librarianTool; + } + public class ComponentList : List { public ComponentList() *************** *** 602,608 **** return false; } ! public static void addCppLib(VCLinkerTool tool, string component, bool debug) { if(tool == null || String.IsNullOrEmpty(component)) { --- 687,693 ---- return false; } ! public static void addCppLib(LinkerAdapter tool, string component, bool debug) { if(tool == null || String.IsNullOrEmpty(component)) { *************** *** 636,642 **** } } ! public static bool removeCppLib(VCLinkerTool tool, string component, bool debug) { if(tool == null || String.IsNullOrEmpty(tool.AdditionalDependencies)) { --- 721,727 ---- } } ! public static bool removeCppLib(LinkerAdapter tool, string component, bool debug) { if(tool == null || String.IsNullOrEmpty(tool.AdditionalDependencies)) { *************** *** 841,847 **** return; } ! public static bool addIceCppLibraryDir(VCLinkerTool tool, Project project, bool x64) { if(tool == null || project == null) { --- 926,932 ---- return; } ! public static bool addIceCppLibraryDir(LinkerAdapter tool, Project project, bool x64) { if(tool == null || project == null) { *************** *** 909,915 **** return changed; } ! public static void removeIceCppLibraryDir(VCLinkerTool tool, string iceHome) { if(tool == null || String.IsNullOrEmpty(tool.AdditionalLibraryDirectories)) { --- 994,1000 ---- return changed; } ! public static void removeIceCppLibraryDir(LinkerAdapter tool, string iceHome) { if(tool == null || String.IsNullOrEmpty(tool.AdditionalLibraryDirectories)) { *************** *** 1811,1820 **** VCCLCompilerTool compilerTool = (VCCLCompilerTool)(((IVCCollection)conf.Tools).Item("VCCLCompilerTool")); ! VCLinkerTool linkerTool = (VCLinkerTool)(((IVCCollection)conf.Tools).Item("VCLinkerTool")); Util.removeIceCppEnvironment((VCDebugSettings)conf.DebugSettings, iceHome); ! Util.removeIceCppLibraryDir(linkerTool, iceHome); Util.removeCppIncludes(compilerTool, iceHome, Util.getProjectOutputDirRaw(p)); // --- 1896,1914 ---- VCCLCompilerTool compilerTool = (VCCLCompilerTool)(((IVCCollection)conf.Tools).Item("VCCLCompilerTool")); ! bool staticLib = conf.ConfigurationType == Microsoft.VisualStudio.VCProjectEngine.ConfigurationTypes.typeStaticLibrary; ! LinkerAdapter linkerAdapter; ! if(staticLib) ! { ! linkerAdapter = new StaticLinkerAdapter((VCLibrarianTool)(((IVCCollection)conf.Tools).Item("VCLibrarianTool"))); ! } ! else ! { ! linkerAdapter = new DynamicLinkerAdapter((VCLinkerTool)(((IVCCollection)conf.Tools).Item("VCLinkerTool"))); ! } Util.removeIceCppEnvironment((VCDebugSettings)conf.DebugSettings, iceHome); ! Util.removeIceCppLibraryDir(linkerAdapter, iceHome); Util.removeCppIncludes(compilerTool, iceHome, Util.getProjectOutputDirRaw(p)); // *************** *** 2050,2055 **** --- 2144,2164 ---- return false; } + if (conf.ConfigurationType == Microsoft.VisualStudio.VCProjectEngine.ConfigurationTypes.typeGeneric || + conf.ConfigurationType == Microsoft.VisualStudio.VCProjectEngine.ConfigurationTypes.typeUnknown) + { + string err = "Configuration Type: '" + conf.ConfigurationType.ToString() + "' not suported by Ice Visual Studio Add-in"; + Util.write(project, Util.msgLevel.msgError, + "------ Slice compilation failed: Project: " + Util.getTraceProjectName(project) + " ------\n\n" + + err); + MessageBox.Show(err, "Ice Visual Studio Add-in", MessageBoxButtons.OK, MessageBoxIcon.Error, MessageBoxDefaultButton.Button1, + (MessageBoxOptions)0); + + Connect.getBuilder().addError(project, "", TaskErrorCategory.Error, 0, 0, err); + + return false; + } + bool x64 = false; if(conf == null || String.IsNullOrEmpty(conf.Name)) *************** *** 2075,2081 **** VCLinkerTool linkerTool = (VCLinkerTool)(((IVCCollection)conf.Tools).Item("VCLinkerTool")); Util.addIceCppEnvironment((VCDebugSettings)conf.DebugSettings, project, x64); ! bool libChanged = Util.addIceCppLibraryDir(linkerTool, project, x64); bool includesChanged = Util.addCppIncludes(compilerTool, project); return libChanged | includesChanged; --- 2184,2201 ---- VCLinkerTool linkerTool = (VCLinkerTool)(((IVCCollection)conf.Tools).Item("VCLinkerTool")); Util.addIceCppEnvironment((VCDebugSettings)conf.DebugSettings, project, x64); ! bool staticLib = conf.ConfigurationType == Microsoft.VisualStudio.VCProjectEngine.ConfigurationTypes.typeStaticLibrary; ! LinkerAdapter linkerAdapter; ! if(staticLib) ! { ! linkerAdapter = new StaticLinkerAdapter((VCLibrarianTool)(((IVCCollection)conf.Tools).Item("VCLibrarianTool"))); ! } ! else ! { ! linkerAdapter = new DynamicLinkerAdapter((VCLinkerTool)(((IVCCollection)conf.Tools).Item("VCLinkerTool"))); ! } ! ! bool libChanged = Util.addIceCppLibraryDir(linkerAdapter, project, x64); bool includesChanged = Util.addCppIncludes(compilerTool, project); return libChanged | includesChanged; *************** *** 2099,2109 **** VCCLCompilerTool compilerTool = (VCCLCompilerTool)(((IVCCollection)conf.Tools).Item("VCCLCompilerTool")); ! VCLinkerTool linkerTool = (VCLinkerTool)(((IVCCollection)conf.Tools).Item("VCLinkerTool")); Util.removeIceCppEnvironment((VCDebugSettings)conf.DebugSettings, "$(IceHome)"); ! Util.removeIceCppLibraryDir(linkerTool, "$(IceHome)"); Util.removeCppIncludes(compilerTool, "$(IceHome)", Util.getProjectOutputDirRaw(project)); Util.removeIcePropertySheet(conf); } --- 2219,2238 ---- VCCLCompilerTool compilerTool = (VCCLCompilerTool)(((IVCCollection)conf.Tools).Item("VCCLCompilerTool")); ! bool staticLib = conf.ConfigurationType == Microsoft.VisualStudio.VCProjectEngine.ConfigurationTypes.typeStaticLibrary; ! LinkerAdapter linkerAdapter; ! if(staticLib) ! { ! linkerAdapter = new StaticLinkerAdapter((VCLibrarianTool)(((IVCCollection)conf.Tools).Item("VCLibrarianTool"))); ! } ! else ! { ! linkerAdapter = new DynamicLinkerAdapter((VCLinkerTool)(((IVCCollection)conf.Tools).Item("VCLinkerTool"))); ! } Util.removeIceCppEnvironment((VCDebugSettings)conf.DebugSettings, "$(IceHome)"); ! Util.removeIceCppLibraryDir(linkerAdapter, "$(IceHome)"); Util.removeCppIncludes(compilerTool, "$(IceHome)", Util.getProjectOutputDirRaw(project)); Util.removeIcePropertySheet(conf); } *************** *** 2128,2136 **** } VCCLCompilerTool compilerTool = (VCCLCompilerTool)(((IVCCollection)conf.Tools).Item("VCCLCompilerTool")); ! VCLinkerTool linkerTool = (VCLinkerTool)(((IVCCollection)conf.Tools).Item("VCLinkerTool")); ! if(compilerTool == null || linkerTool == null) { continue; } --- 2257,2274 ---- } VCCLCompilerTool compilerTool = (VCCLCompilerTool)(((IVCCollection)conf.Tools).Item("VCCLCompilerTool")); ! bool staticLib = conf.ConfigurationType == Microsoft.VisualStudio.VCProjectEngine.ConfigurationTypes.typeStaticLibrary; ! LinkerAdapter linkerAdapter; ! if(staticLib) ! { ! linkerAdapter = new StaticLinkerAdapter((VCLibrarianTool)(((IVCCollection)conf.Tools).Item("VCLibrarianTool"))); ! } ! else ! { ! linkerAdapter = new DynamicLinkerAdapter((VCLinkerTool)(((IVCCollection)conf.Tools).Item("VCLinkerTool"))); ! } ! if(compilerTool == null || linkerAdapter == null) { continue; } *************** *** 2143,2149 **** { continue; } ! Util.addCppLib(linkerTool, component, debug); } } } --- 2281,2287 ---- { continue; } ! Util.addCppLib(linkerAdapter, component, debug); } } } *************** *** 2172,2180 **** } VCCLCompilerTool compilerTool = (VCCLCompilerTool)(((IVCCollection)conf.Tools).Item("VCCLCompilerTool")); ! VCLinkerTool linkerTool = (VCLinkerTool)(((IVCCollection)conf.Tools).Item("VCLinkerTool")); ! if(compilerTool == null || linkerTool == null) { continue; } --- 2310,2327 ---- } VCCLCompilerTool compilerTool = (VCCLCompilerTool)(((IVCCollection)conf.Tools).Item("VCCLCompilerTool")); ! bool staticLib = conf.ConfigurationType == Microsoft.VisualStudio.VCProjectEngine.ConfigurationTypes.typeStaticLibrary; ! LinkerAdapter linkerAdapter; ! if(staticLib) ! { ! linkerAdapter = new StaticLinkerAdapter((VCLibrarianTool)(((IVCCollection)conf.Tools).Item("VCLibrarianTool"))); ! } ! else ! { ! linkerAdapter = new DynamicLinkerAdapter((VCLinkerTool)(((IVCCollection)conf.Tools).Item("VCLinkerTool"))); ! } ! if(compilerTool == null || linkerAdapter == null) { continue; } *************** *** 2197,2203 **** continue; } ! if(Util.removeCppLib(linkerTool, s, debug) && !removed.Contains(s)) { removed.Add(s); } --- 2344,2350 ---- continue; } ! if(Util.removeCppLib(linkerAdapter, s, debug) && !removed.Contains(s)) { removed.Add(s); } *************** *** 2253,2261 **** VCCLCompilerTool compilerTool = (VCCLCompilerTool)(((IVCCollection)conf.Tools).Item("VCCLCompilerTool")); ! VCLinkerTool linkerTool = (VCLinkerTool)(((IVCCollection)conf.Tools).Item("VCLinkerTool")); ! if(compilerTool == null || linkerTool == null) { continue; } --- 2400,2417 ---- VCCLCompilerTool compilerTool = (VCCLCompilerTool)(((IVCCollection)conf.Tools).Item("VCCLCompilerTool")); ! bool staticLib = conf.ConfigurationType == Microsoft.VisualStudio.VCProjectEngine.ConfigurationTypes.typeStaticLibrary; ! LinkerAdapter linkerAdapter; ! if(staticLib) ! { ! linkerAdapter = new StaticLinkerAdapter((VCLibrarianTool)(((IVCCollection)conf.Tools).Item("VCLibrarianTool"))); ! } ! else ! { ! linkerAdapter = new DynamicLinkerAdapter((VCLinkerTool)(((IVCCollection)conf.Tools).Item("VCLinkerTool"))); ! } ! if(compilerTool == null || linkerAdapter == null) { continue; } *************** *** 2278,2284 **** } libName += ".lib"; ! string additionalDependencies = linkerTool.AdditionalDependencies; if(String.IsNullOrEmpty(additionalDependencies)) { continue; --- 2434,2440 ---- } libName += ".lib"; ! string additionalDependencies = linkerAdapter.AdditionalDependencies; if(String.IsNullOrEmpty(additionalDependencies)) { continue; *************** *** 2346,2352 **** public static void verifyProjectSettings(Project project) { ! if (isCppProject(project)) { addIceCppConfigurations(project); ; } --- 2502,2508 ---- public static void verifyProjectSettings(Project project) { ! if(isCppProject(project)) { addIceCppConfigurations(project); ; } *************** *** 3125,3131 **** } static public bool checkCppRunTimeLibrary(Builder builder, Project project, VCCLCompilerTool compilerTool, ! VCLinkerTool linkerTool) { // // Check the project run time library for the active configuration. --- 3281,3287 ---- } static public bool checkCppRunTimeLibrary(Builder builder, Project project, VCCLCompilerTool compilerTool, ! LinkerAdapter linkerTool) { // // Check the project run time library for the active configuration.