1 // Tesh configuration file for Windows.
2 // Register all environement variables needed by Tesh
3 // during its compilation and during the running of Tesh files.
6 // Test if the string s is in the array a.
7 function ArrayContains(a, s)
11 for(i = 0; i < a.length; i++)
18 // SimGrid configuration file for Windows.
19 // Register all environement variables needed for the compilation of SimGrid library
20 // and all the tesh suite, examples and test suites.
26 var SGBuildDir; // This build directory
37 var Args = WScript.Arguments;
39 // check the arguments to be sure it's right
42 WScript.Echo("Tesh Configuration.");
43 WScript.Echo("Configure the environment of Tesh (mini test shell)");
44 WScript.Echo("\n\tUsage: CScript TeshConfig.js <SGBuildDir> <TeshVersion>");
48 SGBuildDir = Args.Item(0);
49 TeshVersion = Args.Item(1);
51 var FileSystem = new ActiveXObject("Scripting.FileSystemObject");
53 // Check the directories specified as parameters of the script.
55 if(!FileSystem.FolderExists(SGBuildDir))
57 WScript.Echo("Not a directory `(" + SGBuildDir + ")'");
63 // Build the directories
65 TeshDir = SGBuildDir + "tools\\tesh" + TeshVersion;
66 TeshExampleDir = TeshDir + "\\examples";
67 TeshSuiteDir = SGBuildDir + "teshsuite";
68 TestSuiteDir = SGBuildDir + "testsuite";
69 ExampleDir = SGBuildDir + "examples";
70 SrcDir = ExampleDir + "\\msg";
73 Shell = WScript.CreateObject("Wscript.Shell");
74 UserEnv = Shell.Environment("USER");
76 WScript.Echo("Configuration of Tesh Library Compilation in progress...");
77 WScript.Echo("Build directory : " + SGBuildDir);
80 // Include Tesh in the Path
81 Path = UserEnv("PATH");
83 if(typeof(UserEnv("PATH")) != "undefined" && Path.length > 0)
85 var a = Path.split(";");
87 // Add the Visual C include directories
88 if(!ArrayContains(a, TeshDir))
89 Path = Path + TeshDir + ";";
96 Include = UserEnv("INCLUDE");
98 if(typeof(UserEnv("INCLUDE")) != "undefined" && Include.length > 0)
100 var a = Include.split(";");
102 // Add the Visual C include directories
103 if(!ArrayContains(a, TeshDir + "\\include"))
104 Include = Include + TeshDir + "\\include" + ";";
106 if(!ArrayContains(a, TeshDir + "\\w32\\include"))
107 Include = Include + TeshDir + "\\w32\\include" + ";";
111 Include = TeshDir + "\\include";
112 Include = Include + ";" + TeshDir + "\\w32\\include" + ";";
115 // Build environement of Tesh.
116 UserEnv("TESH") = "tesh";
117 UserEnv("TESH_DIR") = TeshDir;
118 UserEnv("TESHEXAMPLE_DIR") = TeshExampleDir;
119 UserEnv("TESHSUITE_DIR") = TeshSuiteDir;
120 UserEnv("TESTSUITE_DIR") = TestSuiteDir;
121 UserEnv("EXAMPLE_DIR") = ExampleDir;
122 UserEnv("SRCDIR") = SrcDir;
123 UserEnv("INCLUDE") = Include;
126 UserEnv("PATH") = Path;
129 WScript.Echo("Configuration successeded");