summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe George <joe@zeroc.com>2015-03-11 11:44:49 -0400
committerJoe George <joe@zeroc.com>2015-05-12 11:42:05 -0400
commitce1e44c01b5a7f271381cd8860e626b19d3e59d1 (patch)
treef91452122200a3881b6bd24f0c02aa044780be85
parentIce 3.4.2 Patch 1 (diff)
downloadice-ce1e44c01b5a7f271381cd8860e626b19d3e59d1.tar.bz2
ice-ce1e44c01b5a7f271381cd8860e626b19d3e59d1.tar.xz
ice-ce1e44c01b5a7f271381cd8860e626b19d3e59d1.zip
Ice 3.4.2 Patch 2
Fixes a bug in Ice-3.4.2 Visual Studio add-in, that affects Visual Studio C++ projects configured to build static libraries.
-rw-r--r--vsaddin/src/Builder.cs32
-rw-r--r--vsaddin/src/IceCppConfigurationDialog.cs77
-rw-r--r--vsaddin/src/Util.cs196
3 files changed, 246 insertions, 59 deletions
diff --git a/vsaddin/src/Builder.cs b/vsaddin/src/Builder.cs
index 27cfcb97a1f..0f5de5679b6 100644
--- a/vsaddin/src/Builder.cs
+++ b/vsaddin/src/Builder.cs
@@ -1125,15 +1125,39 @@ namespace Ice.VisualStudio
public bool buildCppProject(Project project, bool force)
{
- VCConfiguration configuration = Util.getActiveVCConfiguration(project);
+ 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)configuration.Tools).Item("VCCLCompilerTool"));
- VCLinkerTool linkerTool = (VCLinkerTool)(((IVCCollection)configuration.Tools).Item("VCLinkerTool"));
+ (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, linkerTool);
+ Util.checkCppRunTimeLibrary(this, project, compilerTool, linkerAdapter);
}
string sliceCompiler = getSliceCompilerPath(project);
return buildCppProject(project, project.ProjectItems, sliceCompiler, force);
diff --git a/vsaddin/src/IceCppConfigurationDialog.cs b/vsaddin/src/IceCppConfigurationDialog.cs
index 82363957479..9b9f763e297 100644
--- a/vsaddin/src/IceCppConfigurationDialog.cs
+++ b/vsaddin/src/IceCppConfigurationDialog.cs
@@ -17,6 +17,7 @@ using System.Text;
using System.Windows.Forms;
using System.Globalization;
using EnvDTE;
+using Microsoft.VisualStudio.VCProjectEngine;
namespace Ice.VisualStudio
{
@@ -43,6 +44,8 @@ namespace Ice.VisualStudio
{
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();
@@ -247,15 +250,15 @@ namespace Ice.VisualStudio
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;
+
+ 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)
@@ -659,34 +662,37 @@ namespace Ice.VisualStudio
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"))
+ if(!_staticLib)
{
- return true;
- }
- if(chkIceSSL.Checked != Util.hasIceCppLib(_project, "IceSSL"))
- {
- return true;
- }
- if(chkIceStorm.Checked != Util.hasIceCppLib(_project, "IceStorm"))
- {
- 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;
}
@@ -706,6 +712,7 @@ namespace Ice.VisualStudio
private bool _initialized;
private Project _project;
+ private bool _staticLib = false;
private bool _changed = false;
}
}
diff --git a/vsaddin/src/Util.cs b/vsaddin/src/Util.cs
index f33303dcaba..9f1e3b47b62 100644
--- a/vsaddin/src/Util.cs
+++ b/vsaddin/src/Util.cs
@@ -37,6 +37,91 @@ using System.Xml;
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<string>
{
public ComponentList()
@@ -602,7 +687,7 @@ namespace Ice.VisualStudio
return false;
}
- public static void addCppLib(VCLinkerTool tool, string component, bool debug)
+ public static void addCppLib(LinkerAdapter tool, string component, bool debug)
{
if(tool == null || String.IsNullOrEmpty(component))
{
@@ -636,7 +721,7 @@ namespace Ice.VisualStudio
}
}
- public static bool removeCppLib(VCLinkerTool tool, string component, bool debug)
+ public static bool removeCppLib(LinkerAdapter tool, string component, bool debug)
{
if(tool == null || String.IsNullOrEmpty(tool.AdditionalDependencies))
{
@@ -841,7 +926,7 @@ namespace Ice.VisualStudio
return;
}
- public static bool addIceCppLibraryDir(VCLinkerTool tool, Project project, bool x64)
+ public static bool addIceCppLibraryDir(LinkerAdapter tool, Project project, bool x64)
{
if(tool == null || project == null)
{
@@ -909,7 +994,7 @@ namespace Ice.VisualStudio
return changed;
}
- public static void removeIceCppLibraryDir(VCLinkerTool tool, string iceHome)
+ public static void removeIceCppLibraryDir(LinkerAdapter tool, string iceHome)
{
if(tool == null || String.IsNullOrEmpty(tool.AdditionalLibraryDirectories))
{
@@ -1811,10 +1896,19 @@ namespace Ice.VisualStudio
VCCLCompilerTool compilerTool =
(VCCLCompilerTool)(((IVCCollection)conf.Tools).Item("VCCLCompilerTool"));
- VCLinkerTool linkerTool = (VCLinkerTool)(((IVCCollection)conf.Tools).Item("VCLinkerTool"));
+ 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(linkerTool, iceHome);
+ Util.removeIceCppLibraryDir(linkerAdapter, iceHome);
Util.removeCppIncludes(compilerTool, iceHome, Util.getProjectOutputDirRaw(p));
//
@@ -2050,6 +2144,21 @@ namespace Ice.VisualStudio
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,7 +2184,18 @@ namespace Ice.VisualStudio
VCLinkerTool linkerTool = (VCLinkerTool)(((IVCCollection)conf.Tools).Item("VCLinkerTool"));
Util.addIceCppEnvironment((VCDebugSettings)conf.DebugSettings, project, x64);
- bool libChanged = Util.addIceCppLibraryDir(linkerTool, 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,11 +2219,20 @@ namespace Ice.VisualStudio
VCCLCompilerTool compilerTool =
(VCCLCompilerTool)(((IVCCollection)conf.Tools).Item("VCCLCompilerTool"));
- VCLinkerTool linkerTool = (VCLinkerTool)(((IVCCollection)conf.Tools).Item("VCLinkerTool"));
+ 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(linkerTool, "$(IceHome)");
+ Util.removeIceCppLibraryDir(linkerAdapter, "$(IceHome)");
Util.removeCppIncludes(compilerTool, "$(IceHome)", Util.getProjectOutputDirRaw(project));
Util.removeIcePropertySheet(conf);
}
@@ -2128,9 +2257,18 @@ namespace Ice.VisualStudio
}
VCCLCompilerTool compilerTool =
(VCCLCompilerTool)(((IVCCollection)conf.Tools).Item("VCCLCompilerTool"));
- VCLinkerTool linkerTool = (VCLinkerTool)(((IVCCollection)conf.Tools).Item("VCLinkerTool"));
+ 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 || linkerTool == null)
+ if(compilerTool == null || linkerAdapter == null)
{
continue;
}
@@ -2143,7 +2281,7 @@ namespace Ice.VisualStudio
{
continue;
}
- Util.addCppLib(linkerTool, component, debug);
+ Util.addCppLib(linkerAdapter, component, debug);
}
}
}
@@ -2172,9 +2310,18 @@ namespace Ice.VisualStudio
}
VCCLCompilerTool compilerTool =
(VCCLCompilerTool)(((IVCCollection)conf.Tools).Item("VCCLCompilerTool"));
- VCLinkerTool linkerTool = (VCLinkerTool)(((IVCCollection)conf.Tools).Item("VCLinkerTool"));
+ 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 || linkerTool == null)
+ if(compilerTool == null || linkerAdapter == null)
{
continue;
}
@@ -2197,7 +2344,7 @@ namespace Ice.VisualStudio
continue;
}
- if(Util.removeCppLib(linkerTool, s, debug) && !removed.Contains(s))
+ if(Util.removeCppLib(linkerAdapter, s, debug) && !removed.Contains(s))
{
removed.Add(s);
}
@@ -2253,9 +2400,18 @@ namespace Ice.VisualStudio
VCCLCompilerTool compilerTool =
(VCCLCompilerTool)(((IVCCollection)conf.Tools).Item("VCCLCompilerTool"));
- VCLinkerTool linkerTool = (VCLinkerTool)(((IVCCollection)conf.Tools).Item("VCLinkerTool"));
+ 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 || linkerTool == null)
+ if(compilerTool == null || linkerAdapter == null)
{
continue;
}
@@ -2278,7 +2434,7 @@ namespace Ice.VisualStudio
}
libName += ".lib";
- string additionalDependencies = linkerTool.AdditionalDependencies;
+ string additionalDependencies = linkerAdapter.AdditionalDependencies;
if(String.IsNullOrEmpty(additionalDependencies))
{
continue;
@@ -2346,7 +2502,7 @@ namespace Ice.VisualStudio
public static void verifyProjectSettings(Project project)
{
- if (isCppProject(project))
+ if(isCppProject(project))
{
addIceCppConfigurations(project); ;
}
@@ -3125,7 +3281,7 @@ namespace Ice.VisualStudio
}
static public bool checkCppRunTimeLibrary(Builder builder, Project project, VCCLCompilerTool compilerTool,
- VCLinkerTool linkerTool)
+ LinkerAdapter linkerTool)
{
//
// Check the project run time library for the active configuration.