1 // SimGrid configuration file for Windows.
\r
2 // Register all environement variables needed for the compilation of SimGrid library
\r
3 // and all the tesh suite, examples and test suites.
\r
6 // FIXME declare the include directory in the environment of the compilation.
\r
8 // Test if the string s is in the array a.
\r
9 function ArrayContains(a, s)
\r
13 for(i = 0; i < a.length; i++)
\r
20 // SimGrid configuration file for Windows.
\r
21 // Register all environement variables needed for the compilation of SimGrid library
\r
22 // and all the tesh suite, examples and test suites.
\r
29 var DebugLibraryPath; // The path of the SimGrid debug library
\r
30 var ReleaseLibraryPath; // The path of the SimGrid release library
\r
32 var Lib; // The value of the environment variable LIB
\r
33 var Include; // The value of the environment variable INCLUDE
\r
34 var Libs; // SimGrid library name (the value of the environment variable LIBS).
\r
37 var VCInstallDir; // Visual C install directory
\r
38 var SGBuildDir; // This build directory
\r
39 var JNIIncludeDir; // The path of the jni.h header
\r
41 var Args = WScript.Arguments;
\r
43 // check the arguments to be sure it's right
\r
44 if (Args.Count() < 3)
\r
46 WScript.Echo("SimGrid Configuration.");
\r
47 WScript.Echo("Configure the environment of the compilation of SimGrid library");
\r
48 WScript.Echo("\n\tUsage: CScript SimGridConfig.js <SGBuildDir> <VCInsallDir> <JNIIncludeDir>");
\r
52 SGBuildDir = Args.Item(0);
\r
53 VCInstallDir = Args.Item(1);
\r
54 JNIIncludeDir = Args.Item(2);
\r
56 var FileSystem = new ActiveXObject("Scripting.FileSystemObject");
\r
58 // Build the 2 paths of SimGrid library paths (debug and release)
\r
59 ReleaseLibraryPath = SGBuildDir + "build\\vc7\\simgrid\\Release";
\r
60 DebugLibraryPath = SGBuildDir + "build\\vc7\\simgrid\\Debug";
\r
62 // Check the directories specified as parameters of the script.
\r
64 if(!FileSystem.FolderExists(SGBuildDir))
\r
66 WScript.Echo("Not a directory `(" + SGBuildDir + ")'");
\r
69 else if(!FileSystem.FolderExists(VCInstallDir))
\r
71 WScript.Echo("Not a directory `(" + VCInstallDir + ")'");
\r
74 else if(!FileSystem.FolderExists(JNIIncludeDir))
\r
76 WScript.Echo("Not a directory `(" + JNIIncludeDir + ")'");
\r
80 Shell = WScript.CreateObject("Wscript.Shell");
\r
81 UserEnv = Shell.Environment("USER");
\r
83 WScript.Echo("Configuration of SimGrig Library Compilation in progress...");
\r
84 WScript.Echo("Build directory : " + SGBuildDir);
\r
85 WScript.Echo("Visual C install directory : " + VCInstallDir);
\r
86 WScript.Echo("Java Native Interface include directory : " + JNIIncludeDir);
\r
89 // Build the content of the environment variable LIB.
\r
90 Lib = UserEnv("LIB");
\r
92 if(typeof(UserEnv("LIB")) != "undefined" && Lib.length > 0)
\r
94 var a = Lib.split(";");
\r
96 if(!ArrayContains(a,DebugLibraryPath))
\r
97 Lib = Lib + DebugLibraryPath + ";";;
\r
99 if(!ArrayContains(a,ReleaseLibraryPath))
\r
100 Lib = Lib + ReleaseLibraryPath + ";";
\r
102 if(!ArrayContains(a, VCInstallDir + "lib"))
\r
103 Lib = Lib + VCInstallDir + "lib" + ";";
\r
105 if(!ArrayContains(a, VCInstallDir + "PlatformSDK\\Lib"))
\r
106 Lib = Lib + VCInstallDir + "PlatformSDK\\Lib" + ";";
\r
110 // SimGrid librairy paths
\r
111 Lib = DebugLibraryPath + ";";
\r
112 Lib = Lib + ReleaseLibraryPath + ";";
\r
113 // Visual C library paths.
\r
114 Lib = Lib + VCInstallDir + "lib" + ";";
\r
115 Lib = Lib + VCInstallDir + "PlatformSDK\\Lib" + ";";
\r
119 // Build the content of the environment variable INCLUDE.
\r
120 Include = UserEnv("INCLUDE");
\r
122 if(typeof(UserEnv("INCLUDE")) != "undefined" && Include.length > 0)
\r
125 var a = Include.split(";");
\r
127 // Add the Visual C include directories
\r
128 if(!ArrayContains(a, VCInstallDir + "include"))
\r
129 Include = Include + VCInstallDir + "include" + ";";
\r
131 if(!ArrayContains(a,VCInstallDir + "PlatformSDK\\include"))
\r
132 Include = Include + VCInstallDir + "PlatformSDK\\include" + ";";
\r
135 // Add the SimGrid include directories
\r
136 if(!ArrayContains(a,SGBuildDir + "src"))
\r
137 Include = Include + SGBuildDir + "src" + ";";
\r
139 if(!ArrayContains(a,SGBuildDir + "include"))
\r
140 Include = Include + SGBuildDir + "include" + ";";
\r
142 if(!ArrayContains(a,SGBuildDir + "src\\include"))
\r
143 Include = Include + SGBuildDir + "src\\include" + ";";
\r
145 // Add the JNI include directories.
\r
146 if(!ArrayContains(a,JNIIncludeDir))
\r
147 Include = Include + JNIIncludeDir + ";";
\r
149 if(!ArrayContains(a,JNIIncludeDir + "awin32"))
\r
150 Include = Include + JNIIncludeDir + "win32" + ";";
\r
155 // Visual C include directories
\r
156 Include = VCInstallDir + "include" + ";";
\r
157 Include = Include + VCInstallDir + "PlatformSDK\\include" + ";";
\r
158 // SimGrid include directories.
\r
159 Include = Include + SGBuildDir + "src" + ";";
\r
160 Include = Include + SGBuildDir + "include" + ";" ;
\r
161 Include = Include + SGBuildDir + "src\\include" + ";";
\r
162 // JNI include directories.
\r
163 Include = Include + JNIIncludeDir + ";";
\r
164 Include = Include + JNIIncludeDir + "win32" + ";";
\r
168 // Build the content of the environment variable LIBS.
\r
169 Libs = UserEnv("LIBS");
\r
171 if(typeof(UserEnv("LIBS")) != "undefined" && Libs.length > 0)
\r
173 var a = Libs.split(";");
\r
175 if(!ArrayContains(a, "simgrid.lib"))
\r
176 Libs = Libs + "simgrid.lib" + ";";
\r
180 Libs = "simgrid.lib" + ";";
\r
183 // Update the environment variables.
\r
184 UserEnv("LIB") = Lib;
\r
185 UserEnv("INCLUDE") = Include;
\r
186 UserEnv("LIBS") = Libs;
\r
190 WScript.Echo("Configuration successeded");
\r