1 package org.codehaus.mojo.natives.msvc;
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27 import java.io.File;
28 import java.util.HashMap;
29 import java.util.Map;
30
31 import org.codehaus.mojo.natives.NativeBuildException;
32 import org.codehaus.mojo.natives.util.EnvUtil;
33
34
35
36
37
38 public class MSVC2005x86EnvFactory
39 extends AbstractMSVC2005EnvFactory
40 {
41
42 protected Map createEnvs()
43 throws NativeBuildException
44 {
45 File vsInstallDir =
46 new File( EnvUtil.getEnv( MSVS2005_INSTALL_ENV_KEY, MSVS2005_INSTALL_ENV_KEY, DEFAULT_MSVS2005_INSTALL_DIR ) );
47
48 if ( !vsInstallDir.isDirectory() )
49 {
50 throw new NativeBuildException( vsInstallDir.getPath() + " is not a directory." );
51 }
52
53 Map envs = new HashMap();
54
55 envs.put( "VSINSTALLDIR", vsInstallDir.getPath() );
56
57 File vcInstallDir = new File( vsInstallDir.getPath() + "/VC" );
58 envs.put( "VCINSTALLDIR", vcInstallDir.getPath() );
59
60 File frameworkDir = new File( getSystemRoot() + "/Microsoft.NET/Framework" );
61 envs.put( "FrameworkDir", frameworkDir.getPath() );
62
63 String frameworkVersion = "v2.0.50727";
64 envs.put( "FrameworkVersion", frameworkVersion );
65
66 File frameworkSDKDir = new File( vsInstallDir.getPath() + "/SDK/v2.0" );
67 envs.put( "FrameworkSDKDir", frameworkSDKDir.getPath() );
68
69 File devEnvDir = new File( vsInstallDir.getPath() + "/Common7/IDE" );
70 envs.put( "DevEnvDir", devEnvDir.getPath() );
71
72 File platformSDKDir = new File( vcInstallDir.getPath() + "/PlatformSDK" );
73
74
75 String currentPath = System.getProperty( "java.library.path" );
76
77 String newPath =
78 devEnvDir.getPath() + ";" + vcInstallDir.getPath() + "\\BIN;" + vcInstallDir.getPath()
79 + "\\Common7\\Tools;" + vcInstallDir.getPath() + "\\Common7\\Tools\\bin;" + platformSDKDir.getPath()
80 + "\\BIN;" + frameworkSDKDir.getPath() + "\\BIN;" + frameworkDir.getPath() + "\\" + frameworkVersion
81 + ";" + vcInstallDir.getPath() + "\\VCPackages;" + currentPath;
82
83 envs.put( "PATH", newPath );
84
85
86 String currentIncludePath = EnvUtil.getEnv( "INCLUDE" );
87
88 String newIncludePath =
89 vcInstallDir.getPath() + "\\ATLMFC\\INCLUDE;" + vcInstallDir.getPath() + "\\INCLUDE;"
90 + platformSDKDir.getPath() + "\\INCLUDE;" + frameworkSDKDir.getPath() + "\\INCLUDE;"
91 + currentIncludePath;
92
93 envs.put( "INCLUDE", newIncludePath );
94
95
96
97
98 String currentLibPath = EnvUtil.getEnv( "LIB" );
99
100 String newLibPath =
101 vcInstallDir.getPath() + "\\ATLMFC\\LIB;" + vcInstallDir.getPath() + "\\LIB;" + platformSDKDir.getPath()
102 + "\\LIB;" + frameworkSDKDir.getPath() + "\\LIB;" + currentLibPath;
103
104 envs.put( "LIB", newLibPath );
105
106
107
108
109
110 String currentLibPathPath =
111 frameworkDir.getPath() + "\\" + frameworkVersion + ";" + vcInstallDir.getPath() + "\\ATLMFC\\LIB";
112
113 envs.put( "LIBPATH", currentLibPathPath );
114
115
116 envs.put( "SystemRoot", getSystemRoot() );
117
118 return envs;
119
120 }
121
122 }