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 MSVC2005AMD64EnvFactory
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
61 File frameworkDir = new File( getSystemRoot() + "/Microsoft.NET/Framework64" );
62 envs.put( "FrameworkDir", frameworkDir.getPath() );
63
64 String frameworkVersion = "v2.0.50727";
65 envs.put( "FrameworkVersion", frameworkVersion );
66
67 File frameworkSDKDir = new File( vsInstallDir.getPath() + "/SDK/v2.0 64bit" );
68 envs.put( "FrameworkSDKDir", frameworkSDKDir.getPath() );
69
70 File devEnvDir = new File( vsInstallDir.getPath() + "/Common7/IDE" );
71 envs.put( "DevEnvDir", devEnvDir.getPath() );
72
73 File platformSDKDir = new File( vcInstallDir.getPath() + "/PlatformSDK" );
74
75
76 String currentPath = System.getProperty( "java.library.path" );
77
78 String newPath =
79 vcInstallDir.getPath() + "\\BIN\\amd64;" + platformSDKDir.getPath() + "\\BIN\\WIN64\\AMD64;"
80 + platformSDKDir.getPath() + "\\BIN;" + frameworkDir.getPath() + "\\" + frameworkVersion + ";"
81 + vcInstallDir.getPath() + "\\VCPackages;" + devEnvDir.getPath() + ";" + vcInstallDir.getPath()
82 + "\\Common7\\Tools;" + vcInstallDir.getPath() + "\\Common7\\Tools\\Bin;" + vcInstallDir.getPath()
83 + "\\SDK\\v2.0\\bin;" + currentPath;
84
85 envs.put( "PATH", newPath );
86
87
88 String currentIncludePath = EnvUtil.getEnv( "INCLUDE" );
89
90 String newIncludePath =
91 vcInstallDir.getPath() + "\\ATLMFC\\INCLUDE;" + vcInstallDir.getPath() + "\\INCLUDE;"
92 + platformSDKDir.getPath() + "\\INCLUDE;" + vcInstallDir.getPath() + "\\SDK\\v2.0\\include;"
93 + currentIncludePath;
94
95 envs.put( "INCLUDE", newIncludePath );
96
97
98
99
100 String currentLibPath = EnvUtil.getEnv( "LIB" );
101
102 String newLibPath =
103 vcInstallDir.getPath() + "\\ATLMFC\\LIB\\AMD64;" + vcInstallDir.getPath() + "\\LIB\\AMD64;"
104 + platformSDKDir.getPath() + "\\LIB\\AMD64;" + vsInstallDir.getPath() + "\\SDK\\v2.0\\LIB\\AMD64;"
105 + currentLibPath;
106
107 envs.put( "LIB", newLibPath );
108
109
110
111
112
113 String currentLibPathPath = EnvUtil.getEnv( "LIBPATH" );
114
115 String newLibPathPath = vcInstallDir.getPath() + "\\ATLMFC\\LIB\\AMD64" + currentLibPathPath;
116
117 envs.put( "LIBPATH", newLibPathPath );
118
119 return envs;
120
121 }
122
123 }