Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Windows configuration of the environment of SimGrid and Tesh.
authorcherierm <cherierm@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 25 Jun 2008 07:55:40 +0000 (07:55 +0000)
committercherierm <cherierm@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Wed, 25 Jun 2008 07:55:40 +0000 (07:55 +0000)
Define all the environment variables used by VCBuild to build the Visual C projects of SimGrid and define some variables used by Tesh.

git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@5804 48e7efb5-ca39-0410-a469-dd3cf9ba447f

SimGridConfig.js [new file with mode: 0644]
TeshConfig.js [new file with mode: 0644]

diff --git a/SimGridConfig.js b/SimGridConfig.js
new file mode 100644 (file)
index 0000000..165a3f6
--- /dev/null
@@ -0,0 +1,190 @@
+// SimGrid configuration file for Windows.\r
+// Register all environement variables needed for the compilation of SimGrid library\r
+// and all the tesh suite, examples and test suites.\r
+\r
+\r
+// FIXME declare the include directory in the environment of the compilation.\r
+\r
+// Test if the string s is in the array a.\r
+function ArrayContains(a, s)\r
+{\r
+       var i = 0;\r
+       \r
+       for(i = 0; i < a.length; i++)\r
+               if(a[i] == s)\r
+                       return true;\r
+                        \r
+       return false;           \r
+}\r
+\r
+// SimGrid configuration file for Windows.\r
+// Register all environement variables needed for the compilation of SimGrid library\r
+// and all the tesh suite, examples and test suites.\r
+\r
+var Shell;\r
+var UserEnv;\r
+var FileSystem;\r
+\r
+\r
+var DebugLibraryPath;          // The path of the SimGrid debug library\r
+var ReleaseLibraryPath;                // The path of the SimGrid release library\r
+\r
+var Lib;                                       // The value of the environment variable LIB\r
+var Include;                           // The value of the environment variable INCLUDE\r
+var Libs;                                      // SimGrid library name (the value of the environment variable LIBS).\r
+\r
+\r
+var VCInstallDir;                      // Visual C install directory\r
+var SGBuildDir;                                // This build directory\r
+var JNIIncludeDir;                     // The path of the jni.h header\r
+\r
+var Args = WScript.Arguments;\r
+\r
+// check the arguments to be sure it's right\r
+if (Args.Count() < 3)\r
+{\r
+   WScript.Echo("SimGrid Configuration.");\r
+   WScript.Echo("Configure the environment of the compilation of SimGrid library");\r
+   WScript.Echo("\n\tUsage: CScript SimGridConfig.js <SGBuildDir> <VCInsallDir> <JNIIncludeDir>");\r
+   WScript.Quit(1);\r
+}\r
+\r
+SGBuildDir = Args.Item(0);\r
+VCInstallDir = Args.Item(1);\r
+JNIIncludeDir = Args.Item(2); \r
+\r
+var FileSystem = new ActiveXObject("Scripting.FileSystemObject");\r
+\r
+// Build the 2 paths of SimGrid library paths (debug and release)\r
+ReleaseLibraryPath = SGBuildDir + "\\build\\vc7\\simgrid\\Release";\r
+DebugLibraryPath = SGBuildDir + "\\build\\vc7\\simgrid\\Debug";\r
+\r
+// Check the directories specified as parameters of the script.\r
+\r
+if(!FileSystem.FolderExists(SGBuildDir))\r
+{\r
+       WScript.Echo("Not a directory `(" + SGBuildDir + ")'"); \r
+       WScript.Quit(2);\r
+}\r
+else if(!FileSystem.FolderExists(VCInstallDir))\r
+{\r
+       WScript.Echo("Not a directory `(" + VCInstallDir + ")'");       \r
+       WScript.Quit(3);\r
+}\r
+else if(!FileSystem.FolderExists(JNIIncludeDir))\r
+{\r
+       WScript.Echo("Not a directory `(" + JNIIncludeDir + ")'");      \r
+       WScript.Quit(5);\r
+}\r
+\r
+Shell = WScript.CreateObject("Wscript.Shell");\r
+UserEnv = Shell.Environment("USER");\r
+\r
+WScript.Echo("Configuration of SimGrig Library Compilation in progress...");\r
+WScript.Echo("Build directory : " + SGBuildDir);       \r
+WScript.Echo("Visual C install directory : " + VCInstallDir);\r
+WScript.Echo("Java Native Interface include directory : " + JNIIncludeDir);\r
+\r
+\r
+// Build the content of the environment variable LIB.\r
+Lib = UserEnv("LIB");\r
+\r
+if(typeof(UserEnv("LIB")) != "undefined" && Lib.length > 0)\r
+{\r
+       var a = Lib.split(";");\r
+       \r
+       if(!ArrayContains(a,DebugLibraryPath))\r
+               Lib = Lib + DebugLibraryPath + ";";;\r
+               \r
+        if(!ArrayContains(a,ReleaseLibraryPath))\r
+               Lib = Lib +  ReleaseLibraryPath + ";";\r
+               \r
+       if(!ArrayContains(a, VCInstallDir + "lib"))\r
+               Lib = Lib +  VCInstallDir + "lib" + ";";\r
+               \r
+       if(!ArrayContains(a, VCInstallDir + "PlatformSDK\\Lib"))\r
+               Lib = Lib +  VCInstallDir + "PlatformSDK\\Lib" + ";";   \r
+}\r
+else\r
+{\r
+       // SimGrid librairy paths\r
+        Lib = DebugLibraryPath + ";";\r
+        Lib = Lib + ReleaseLibraryPath + ";";\r
+        // Visual C library paths.\r
+        Lib = Lib + VCInstallDir + "lib" + ";";\r
+        Lib = Lib + VCInstallDir + "PlatformSDK\\Lib" + ";";\r
+               \r
+}\r
+\r
+// Build the content of the environment variable INCLUDE.\r
+Include = UserEnv("INCLUDE");\r
+\r
+if(typeof(UserEnv("INCLUDE")) != "undefined" && Include.length > 0)\r
+{\r
+       \r
+       var a = Include.split(";");\r
+       \r
+       // Add the Visual C include directories\r
+       if(!ArrayContains(a, VCInstallDir + "include"))\r
+               Include = Include + VCInstallDir + "include" + ";";\r
+               \r
+       if(!ArrayContains(a,VCInstallDir + "PlatformSDK\\include"))\r
+               Include = Include +  VCInstallDir + "PlatformSDK\\include" + ";";\r
+       \r
+       \r
+       // Add the SimGrid include directories\r
+       if(!ArrayContains(a,SGBuildDir + "src"))\r
+               Include = Include + SGBuildDir + "src" + ";";\r
+               \r
+       if(!ArrayContains(a,SGBuildDir + "include"))\r
+               Include = Include + SGBuildDir + "include" + ";";\r
+               \r
+       if(!ArrayContains(a,SGBuildDir + "src\\include"))\r
+               Include = Include + SGBuildDir + "src\\include" + ";";\r
+               \r
+       // Add the JNI include directories.\r
+       if(!ArrayContains(a,JNIIncludeDir))\r
+               Include = Include +  JNIIncludeDir + ";";\r
+               \r
+       if(!ArrayContains(a,JNIIncludeDir + "awin32"))\r
+               Include = Include + JNIIncludeDir + "win32" + ";";\r
+       \r
+}\r
+else\r
+{\r
+       // Visual C include directories\r
+       Include = VCInstallDir + "include" + ";";\r
+       Include = Include + VCInstallDir + "PlatformSDK\\include" + ";";\r
+       // SimGrid include directories.\r
+       Include = Include + SGBuildDir + "src" + ";";\r
+       Include = Include + SGBuildDir + "include" + ";" ;\r
+       Include = Include + SGBuildDir + "src\\include" + ";";\r
+       // JNI include directories.\r
+       Include = Include + JNIIncludeDir + ";";\r
+       Include = Include + JNIIncludeDir + "win32" + ";";\r
+        \r
+}\r
+\r
+// Build the content of the environment variable LIBS.\r
+Libs = UserEnv("LIBS");\r
+\r
+if(typeof(UserEnv("LIBS")) != "undefined" && Libs.length > 0)\r
+{\r
+       var a = Libs.split(";");\r
+       \r
+       if(!ArrayContains(a, "simgrid.lib"))\r
+               Libs = Libs + "simgrid.lib" + ";";\r
+}\r
+else\r
+{\r
+       Libs = "simgrid.lib" + ";";\r
+}\r
+\r
+// Update the environment variables.\r
+UserEnv("LIB") = Lib;\r
+UserEnv("INCLUDE") = Include;\r
+UserEnv("LIBS") = Libs;\r
+\r
+\r
+\r
+WScript.Echo("Configuration successeded");\r
diff --git a/TeshConfig.js b/TeshConfig.js
new file mode 100644 (file)
index 0000000..5011efa
--- /dev/null
@@ -0,0 +1,129 @@
+// Tesh configuration file for Windows.
+// Register all environement variables needed by Tesh
+// during its compilation and during the running of Tesh files.
+
+
+// Test if the string s is in the array a.
+function ArrayContains(a, s)
+{
+       var i = 0;
+       
+       for(i = 0; i < a.length; i++)
+               if(a[i] == s)
+                       return true;
+                        
+       return false;           
+}
+
+// SimGrid configuration file for Windows.
+// Register all environement variables needed for the compilation of SimGrid library
+// and all the tesh suite, examples and test suites.
+
+var Shell;
+var UserEnv;
+var FileSystem;
+
+var SGBuildDir;                                // This build directory
+var TeshDir;
+var TeshExampleDir;
+var TeshSuiteDir;
+var TestSuiteDir;
+var ExampleDir;
+var SrcDir;
+
+var Path;
+var Include;
+
+var Args = WScript.Arguments;
+
+// check the arguments to be sure it's right
+if (Args.Count() < 1)
+{
+   WScript.Echo("Tesh Configuration.");
+   WScript.Echo("Configure the environment of Tesh (mini test shell)");
+   WScript.Echo("\n\tUsage: CScript TeshConfig.js <SGBuildDir> <TeshVersion>");
+   WScript.Quit(1);
+}
+
+SGBuildDir = Args.Item(0);
+TeshVersion = Args.Item(1);
+
+var FileSystem = new ActiveXObject("Scripting.FileSystemObject");
+
+// Check the directories specified as parameters of the script.
+
+if(!FileSystem.FolderExists(SGBuildDir))
+{
+       WScript.Echo("Not a directory `(" + SGBuildDir + ")'"); 
+       WScript.Quit(2);
+}
+
+
+
+// Build the directories
+
+TeshDir = SGBuildDir + "tools\\tesh" + TeshVersion;
+TeshExampleDir = TeshDir + "\\examples";
+TeshSuiteDir = SGBuildDir + "teshsuite";
+TestSuiteDir = SGBuildDir + "testsuite";
+ExampleDir =  SGBuildDir + "examples";
+SrcDir = ExampleDir + "\\msg";
+
+
+Shell = WScript.CreateObject("Wscript.Shell");
+UserEnv = Shell.Environment("USER");
+
+WScript.Echo("Configuration of Tesh Library Compilation in progress...");
+WScript.Echo("Build directory : " + SGBuildDir);
+
+
+// Include Tesh in the Path
+Path = UserEnv("PATH");
+
+if(typeof(UserEnv("PATH")) != "undefined" && Path.length > 0)
+{
+       var a = Path.split(";");
+       
+       // Add the Visual C include directories
+       if(!ArrayContains(a, TeshDir))
+               Path = Path + TeshDir + ";";
+}
+else
+{
+       Path = TeshDir + ";";
+}
+
+Include = UserEnv("INCLUDE");
+
+if(typeof(UserEnv("INCLUDE")) != "undefined" && Include.length > 0)
+{
+       var a = Include.split(";");
+       
+       // Add the Visual C include directories
+       if(!ArrayContains(a, TeshDir + "\\include"))
+               Include = Include + TeshDir + "\\include" + ";";
+               
+       if(!ArrayContains(a, TeshDir + "\\w32\\include"))
+               Include = Include + TeshDir + "\\w32\\include" + ";";
+}
+else
+{
+       Include = TeshDir + "\\include";
+       Include = Include + ";" + TeshDir + "\\w32\\include" + ";";
+}
+
+// Build environement of Tesh.
+UserEnv("tesh") = "tesh";
+UserEnv("tesh_dir") = TeshDir;
+UserEnv("teshexample_dir") = TeshExampleDir;
+UserEnv("teshsuite_dir") = TeshSuiteDir;
+UserEnv("testsuite_dir") = TestSuiteDir;
+UserEnv("example_dir") = ExampleDir;
+UserEnv("srcdir") = SrcDir;
+UserEnv("INCLUDE") = Include;
+
+
+UserEnv("PATH") = Path;
+
+
+WScript.Echo("Configuration successeded");