mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-04-29 19:45:01 +02:00
Updated the Visual C++ build to support Windows 7 SDK.
This commit is contained in:
parent
f586166f35
commit
4f6745e045
2 changed files with 37 additions and 33 deletions
|
@ -8,7 +8,6 @@ import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscovere
|
||||||
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredScannerInfoSerializable;
|
import org.eclipse.cdt.make.core.scannerconfig.IDiscoveredPathManager.IDiscoveredScannerInfoSerializable;
|
||||||
import org.eclipse.core.resources.IProject;
|
import org.eclipse.core.resources.IProject;
|
||||||
import org.eclipse.core.runtime.IPath;
|
import org.eclipse.core.runtime.IPath;
|
||||||
import org.eclipse.core.runtime.Path;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Doug Schaefer
|
* @author Doug Schaefer
|
||||||
|
@ -21,17 +20,7 @@ public class WinDiscoveredPathInfo implements IDiscoveredPathInfo {
|
||||||
|
|
||||||
public WinDiscoveredPathInfo() {
|
public WinDiscoveredPathInfo() {
|
||||||
// Include paths
|
// Include paths
|
||||||
String sdkDir = WinEnvironmentVariableSupplier.getSDKDir();
|
paths = WinEnvironmentVariableSupplier.getIncludePath();
|
||||||
if (sdkDir != null) {
|
|
||||||
String vcDir = WinEnvironmentVariableSupplier.getVCDir();
|
|
||||||
paths = new IPath[] {
|
|
||||||
new Path(vcDir.concat("Include")),
|
|
||||||
new Path(vcDir.concat("Include\\Sys")),
|
|
||||||
new Path(sdkDir.concat("Include")),
|
|
||||||
new Path(sdkDir.concat("Include\\gl"))
|
|
||||||
};
|
|
||||||
} else
|
|
||||||
paths = new IPath[0];
|
|
||||||
|
|
||||||
symbols.put("_M_IX86", "600");
|
symbols.put("_M_IX86", "600");
|
||||||
symbols.put("_WIN32", "1");
|
symbols.put("_WIN32", "1");
|
||||||
|
|
|
@ -11,6 +11,8 @@ import org.eclipse.cdt.managedbuilder.envvar.IConfigurationEnvironmentVariableSu
|
||||||
import org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider;
|
import org.eclipse.cdt.managedbuilder.envvar.IEnvironmentVariableProvider;
|
||||||
import org.eclipse.cdt.managedbuilder.envvar.IProjectEnvironmentVariableSupplier;
|
import org.eclipse.cdt.managedbuilder.envvar.IProjectEnvironmentVariableSupplier;
|
||||||
import org.eclipse.cdt.utils.WindowsRegistry;
|
import org.eclipse.cdt.utils.WindowsRegistry;
|
||||||
|
import org.eclipse.core.runtime.IPath;
|
||||||
|
import org.eclipse.core.runtime.Path;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author DSchaefer
|
* @author DSchaefer
|
||||||
|
@ -19,7 +21,9 @@ import org.eclipse.cdt.utils.WindowsRegistry;
|
||||||
public class WinEnvironmentVariableSupplier
|
public class WinEnvironmentVariableSupplier
|
||||||
implements IConfigurationEnvironmentVariableSupplier, IProjectEnvironmentVariableSupplier {
|
implements IConfigurationEnvironmentVariableSupplier, IProjectEnvironmentVariableSupplier {
|
||||||
|
|
||||||
private Map<String, IBuildEnvironmentVariable> envvars;
|
private static Map<String, IBuildEnvironmentVariable> envvars;
|
||||||
|
private static String sdkDir;
|
||||||
|
private static String vcDir;
|
||||||
|
|
||||||
private static class WindowsBuildEnvironmentVariable implements IBuildEnvironmentVariable {
|
private static class WindowsBuildEnvironmentVariable implements IBuildEnvironmentVariable {
|
||||||
|
|
||||||
|
@ -51,63 +55,74 @@ public class WinEnvironmentVariableSupplier
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public WinEnvironmentVariableSupplier() {
|
||||||
|
initvars();
|
||||||
|
}
|
||||||
|
|
||||||
public IBuildEnvironmentVariable getVariable(String variableName,
|
public IBuildEnvironmentVariable getVariable(String variableName,
|
||||||
IManagedProject project, IEnvironmentVariableProvider provider) {
|
IManagedProject project, IEnvironmentVariableProvider provider) {
|
||||||
if (envvars == null)
|
|
||||||
initvars();
|
|
||||||
return envvars.get(variableName);
|
return envvars.get(variableName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IBuildEnvironmentVariable getVariable(String variableName,
|
public IBuildEnvironmentVariable getVariable(String variableName,
|
||||||
IConfiguration configuration, IEnvironmentVariableProvider provider) {
|
IConfiguration configuration, IEnvironmentVariableProvider provider) {
|
||||||
if (envvars == null)
|
|
||||||
initvars();
|
|
||||||
return envvars.get(variableName);
|
return envvars.get(variableName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IBuildEnvironmentVariable[] getVariables(IManagedProject project,
|
public IBuildEnvironmentVariable[] getVariables(IManagedProject project,
|
||||||
IEnvironmentVariableProvider provider) {
|
IEnvironmentVariableProvider provider) {
|
||||||
if (envvars == null)
|
|
||||||
initvars();
|
|
||||||
return envvars.values().toArray(new IBuildEnvironmentVariable[envvars.size()]);
|
return envvars.values().toArray(new IBuildEnvironmentVariable[envvars.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
public IBuildEnvironmentVariable[] getVariables(
|
public IBuildEnvironmentVariable[] getVariables(
|
||||||
IConfiguration configuration, IEnvironmentVariableProvider provider) {
|
IConfiguration configuration, IEnvironmentVariableProvider provider) {
|
||||||
if (envvars == null)
|
|
||||||
initvars();
|
|
||||||
return envvars.values().toArray(new IBuildEnvironmentVariable[envvars.size()]);
|
return envvars.values().toArray(new IBuildEnvironmentVariable[envvars.size()]);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addvar(IBuildEnvironmentVariable var) {
|
private static String getSDKDir() {
|
||||||
envvars.put(var.getName(), var);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String getSDKDir() {
|
|
||||||
WindowsRegistry reg = WindowsRegistry.getRegistry();
|
WindowsRegistry reg = WindowsRegistry.getRegistry();
|
||||||
return reg.getLocalMachineValue("SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v7.0", "InstallationFolder");
|
return reg.getLocalMachineValue("SOFTWARE\\Microsoft\\Microsoft SDKs\\Windows\\v7.0", "InstallationFolder");
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getVCDir() {
|
private static String getVCDir() {
|
||||||
WindowsRegistry reg = WindowsRegistry.getRegistry();
|
WindowsRegistry reg = WindowsRegistry.getRegistry();
|
||||||
return reg.getLocalMachineValue("SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VC7", "9.0");
|
return reg.getLocalMachineValue("SOFTWARE\\Microsoft\\VisualStudio\\SxS\\VC7", "9.0");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void initvars() {
|
public static IPath[] getIncludePath() {
|
||||||
|
// Include paths
|
||||||
|
if (sdkDir != null) {
|
||||||
|
return new IPath[] {
|
||||||
|
new Path(vcDir.concat("Include")),
|
||||||
|
new Path(sdkDir.concat("Include")),
|
||||||
|
new Path(sdkDir.concat("Include\\gl"))
|
||||||
|
};
|
||||||
|
} else
|
||||||
|
return new IPath[0];
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void addvar(IBuildEnvironmentVariable var) {
|
||||||
|
envvars.put(var.getName(), var);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static synchronized void initvars() {
|
||||||
|
if (envvars != null)
|
||||||
|
return;
|
||||||
envvars = new HashMap<String, IBuildEnvironmentVariable>();
|
envvars = new HashMap<String, IBuildEnvironmentVariable>();
|
||||||
|
|
||||||
// The SDK Location
|
// The SDK Location
|
||||||
String sdkDir = getSDKDir();
|
sdkDir = getSDKDir();
|
||||||
if (sdkDir == null)
|
if (sdkDir == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
String vcDir = getVCDir();
|
vcDir = getVCDir();
|
||||||
|
|
||||||
// INCLUDE
|
// INCLUDE
|
||||||
StringBuffer buff = new StringBuffer();
|
StringBuffer buff = new StringBuffer();
|
||||||
buff.append(vcDir).append("Include;");
|
IPath includePaths[] = getIncludePath();
|
||||||
buff.append(sdkDir).append("Include;");
|
for (IPath path : includePaths) {
|
||||||
buff.append(sdkDir).append("Include\\gl;");
|
buff.append(path.toOSString()).append(';');
|
||||||
|
}
|
||||||
addvar(new WindowsBuildEnvironmentVariable("INCLUDE", buff.toString(), IBuildEnvironmentVariable.ENVVAR_PREPEND));
|
addvar(new WindowsBuildEnvironmentVariable("INCLUDE", buff.toString(), IBuildEnvironmentVariable.ENVVAR_PREPEND));
|
||||||
|
|
||||||
// LIB
|
// LIB
|
||||||
|
|
Loading…
Add table
Reference in a new issue