ChangeLog:
* configure.wsf (checkHeaders): Removed unused parameter
(configure): Try/catch'ed run of the sanity.exe while
checking run environment sanity
* data.js: Removed unused variable platformWin32Name
* generate.wsf: Added out the compiler configuration
variables to the log file
* makelog.wsf: Corrected the comment about CONFIG parameter
* msvc-7.0.config: Added variable PLATFORM
* msvc-8.0-x64.config: New configuration file for MSVC 8.0
(x64 platform)
* projectdef.js (setProperty): New function to assign value
to a property if it's exists
(projectCreateVCProject): Use PLATFORM compiler configuration
variable instead of hardcoded variable platformWin32Name; use
setProperty function with properties which are not supported
on some platforms; leave default value of the property
linker.TargetMachine (which is target dependent)
* projects.js (CreateProjectsDefs): Copy dll's after every
project rebuild
* runall.wsf: Added parameter CONFIG to the list of parameters
and usage example
* utilities.js: Added variable PLATFORM
(parseConfig): Renamed from getCompilerOpts, redesigned to use
regular expression
(PrintVars): New function to print compiler configuration
variables and their values to the text stream
(getWinDiffDifferences): code for determine the path to the
windiff utility moved from here ...
(getCompilerOpts): ... to here
* generate.bat: Added check to run 32-bit cscript.exe
on 64-bit Windows
Farid.
------------------------------------------------------------------------
Index: etc/config/windows/configure.wsf
===================================================================
--- etc/config/windows/configure.wsf (revision 465233)
+++ etc/config/windows/configure.wsf (working copy)
@@ -44,7 +44,7 @@
/ConfigurationName:@Configuration [/OutDir:@OutDir] [/OutFile:@OutFile]
[/SrcDir:@SrcDir] [/LogFile:@LogFile],
where
[EMAIL PROTECTED] is msvc-7.1 or icc-9.0,
[EMAIL PROTECTED] is the compiler configuration (msvc-7.1, icc-9.0 etc.)
@Configuration = 11s Debug Static | 11d Debug Dll , etc
@OutDir - output directory (default: script_directory\tests),
@OutFile - output file name (default: config.h),
@@ -234,7 +234,7 @@
checkArchitecture();
// headers and functions check
- checkHeaders(WScript.Arguments.Named("SolutionName"));
+ checkHeaders();
// compile .lib.cpp s
if (0 == compileLibs())
@@ -293,7 +293,12 @@
}
WScript.StdOut.Write("Checking if run environment is sane... ");
- ret = WshShell.Run(exeFullName, runWindowMode, true);
+ ret = 1;
+ try
+ {
+ ret = WshShell.Run(exeFullName, runWindowMode, true);
+ }
+ catch (e) {}
if (ret == 0)
{
WScript.StdOut.WriteLine(" ok");
@@ -398,7 +403,7 @@
}
// perform headers presence check
-function checkHeaders(currentCfg)
+function checkHeaders()
{
inc = fso.OpenTextFile(srcDir + "\\headers.inc", 1, false);
code = "";
Index: etc/config/windows/data.js
===================================================================
--- etc/config/windows/data.js (revision 465233)
+++ etc/config/windows/data.js (working copy)
@@ -35,9 +35,6 @@
this.out = out;
}
-// platform names
-var platformWin32Name = "Win32";
-
// configuration names
var confDebugStaticName = "11s Debug Static";
var confReleaseStaticName = "8s Optimized Static";
Index: etc/config/windows/generate.wsf
===================================================================
--- etc/config/windows/generate.wsf (revision 465233)
+++ etc/config/windows/generate.wsf (working copy)
@@ -45,7 +45,7 @@
[/BUILDTYPE:@BUILDTYPE] [/BUILDONLY:@BUILDONLY] [/COPYDLL:@COPYDLL]
[/LOCALES:@LOCALES] [/LOCALETESTS:@LOCALETESTS]
where
[EMAIL PROTECTED] is one of { msvc-7.0, msvc-7.1, msvc-8.0, msvcex-8.0,
icc-9.0, icc-9.1 },
[EMAIL PROTECTED] is the compiler configuration (msvc-7.1, icc-9.0, etc).
@TOPDIR is the root of the stdcxx source tree,
@BUILDDIR is the root of the build directory,
@COPYDLL is one of { yes, no }; when yes, the stdcxx DLL will be copied
@@ -114,6 +114,8 @@
// get solution object
InitVSObjects(currentCfg);
+
+ PrintVars(logStream);
var solutionName = currentCfg + ".sln";
Index: etc/config/windows/makelog.wsf
===================================================================
--- etc/config/windows/makelog.wsf (revision 465233)
+++ etc/config/windows/makelog.wsf (working copy)
@@ -39,7 +39,7 @@
where
@BUILDDIR is the build directory,
@BUILDTYPE is the build type (11d, 11s, etc).
[EMAIL PROTECTED] is the configuration (msvc-7.1, icc-9.0, etc).
[EMAIL PROTECTED] is the compiler configuration (msvc-7.1, icc-9.0, etc).
</usage>
</runtime>
<object id="fso" progid="Scripting.FileSystemObject"/>
Index: etc/config/windows/msvc-7.0.config
===================================================================
--- etc/config/windows/msvc-7.0.config (revision 465233)
+++ etc/config/windows/msvc-7.0.config (working copy)
@@ -44,6 +44,12 @@
// 1 for MS VisualStudio 2005 and MSVC 2005 Express Edition
NOSTCRT=0
+// target platform
+// Win32 for MS VisualStudio .NET and MS VisualStudio .NET 2003
+// and MSVC 2005 Express Edition
+// Win32 or x64 for MS VisualStudio 2005
+PLATFORM=Win32
+
// Version of the solution file format:
// 7.00 for MS VisualStudio .NET
// 8.00 for MS VisualStudio .NET 2003
Index: etc/config/windows/msvc-8.0-x64.config
===================================================================
--- etc/config/windows/msvc-8.0-x64.config (revision 0)
+++ etc/config/windows/msvc-8.0-x64.config (revision 0)
@@ -0,0 +1,2 @@
+#include msvc-8.0
+PLATFORM=x64
Property changes on: etc\config\windows\msvc-8.0-x64.config
___________________________________________________________________
Name: svn:keywords
+ Id
Name: svn:eol-style
+ native
Index: etc/config/windows/projectdef.js
===================================================================
--- etc/config/windows/projectdef.js (revision 465233)
+++ etc/config/windows/projectdef.js (working copy)
@@ -289,6 +289,18 @@
return ret;
}
+// assign value to a property if it's exists
+function setProperty(property, value)
+{
+ if ("undefined" != typeof(property))
+ {
+ property = value;
+ return true;
+ }
+
+ return false;
+}
+
// create VCProject object from ProjectDef
// engine - VCProjectEngine object
// report - callback function to report progress
@@ -310,7 +322,7 @@
VCProject.ProjectFile = PrjFile;
VCProject.ProjectGUID = createUUID();
- VCProject.AddPlatform(platformWin32Name);
+ VCProject.AddPlatform(PLATFORM);
for (var i = 0; i < confNames.length; ++i)
VCProject.AddConfiguration(confNames[i]);
@@ -371,8 +383,6 @@
compiler.AdditionalIncludeDirectories =
ReplaceMacros(this.Includes, allMacros);
- this.LnkOpts = null;
- this.LibOpts = null;
compiler.AdditionalOptions = CPPFLAGS + " " +
(null != this.CppOpts ? this.CppOpts : "");
if (null != this.PrepOpts)
@@ -380,7 +390,7 @@
compiler.DebugInformationFormat = debugEnabled;
compiler.SuppressStartupBanner = true;
compiler.WarningLevel = warningLevel_3;
- compiler.Detect64BitPortabilityProblems = false;
+ setProperty(compiler.Detect64BitPortabilityProblems, false);
if (null != this.Defines)
compiler.PreprocessorDefinitions =
processDefines(this.Defines, confInfo);
@@ -389,27 +399,21 @@
{
compiler.Optimization = optimizeDisabled;
compiler.MinimalRebuild = true;
- //compiler.SmallerTypeCheck = true;
- compiler.BasicRuntimeChecks = runtimeBasicCheckAll;
+ //setProperty(compiler.SmallerTypeCheck, true);
+ setProperty(compiler.BasicRuntimeChecks, runtimeBasicCheckAll);
compiler.BufferSecurityCheck = true;
}
else
{
if (typeApplication == conf.ConfigurationType)
{
- try
- {
- compiler.OptimizeForWindowsApplication = true;
- }
- catch (e)
- {
+ if (!setProperty(compiler.OptimizeForWindowsApplication,
true))
compiler.AdditionalOptions += " /GA";
- }
}
compiler.Optimization = optimizeMinSpace;
compiler.MinimalRebuild = false;
- compiler.SmallerTypeCheck = false;
- compiler.BasicRuntimeChecks = runtimeBasicCheckNone;
+ setProperty(compiler.SmallerTypeCheck, false);
+ setProperty(compiler.BasicRuntimeChecks,
runtimeBasicCheckNone);
compiler.BufferSecurityCheck = false;
}
@@ -450,7 +454,6 @@
linker.LinkIncremental = linkIncrementalNo;
linker.SuppressStartupBanner = true;
linker.GenerateDebugInformation = true;
- linker.TargetMachine = machineX86;
linker.AdditionalDependencies = "kernel32.lib user32.lib";
linker.IgnoreDefaultLibraryNames = "libcp.lib;libcpd.lib;" +
"libcpmt.lib;libcpmtd.lib;" +
Index: etc/config/windows/projects.js
===================================================================
--- etc/config/windows/projects.js (revision 465233)
+++ etc/config/windows/projects.js (working copy)
@@ -385,8 +385,10 @@
var libname = "stdlib%CONFIG%.dll";
var src = "\"$(SolutionDir)lib\\" + libname + "\"";
var dst = "\"$(OutDir)\\" + libname + "\"";
- var cmd = "if exist " + src + " if not exist " + dst +
- " copy /Y " + src + " " + dst;
+ var cmd = "if exist " + src + " (\r\n" +
+ "del " + dst + "\r\n" +
+ "copy /Y " + src + " " + dst + "\r\n" +
+ ")";
if (0 == command.length)
command = cmd;
else
@@ -398,8 +400,10 @@
var libname = "rwtest.dll";
var src = "\"$(SolutionDir)%CONFIG%\\tests\\" + libname + "\"";
var dst = "\"$(OutDir)\\" + libname + "\"";
- var cmd = "if exist " + src + " if not exist " + dst +
- " copy /Y " + src + " " + dst;
+ var cmd = "if exist " + src + " (\r\n" +
+ "del " + dst + "\r\n" +
+ "copy /Y " + src + " " + dst + "\r\n" +
+ ")";
if (0 == command.length)
command = cmd;
else
Index: etc/config/windows/runall.wsf
===================================================================
--- etc/config/windows/runall.wsf (revision 465233)
+++ etc/config/windows/runall.wsf (working copy)
@@ -30,6 +30,8 @@
name="INOUTDIR" required="true" type="string"/>
<named helpstring="The build type" name="BUILDTYPE"
required="true" type="string"/>
+ <named helpstring="The configuration" name="CONFIG"
+ required="true" type="string"/>
<named helpstring="The log file" name="LOGFILE"
required="false" type="string"/>
<named helpstring="The copy lib dll to exe option" name="COPYDLL"
@@ -40,11 +42,11 @@
required="false" type="string"/>
<example>
cscript runexamples.wsf /EXEDIR:"C:\stdcxx\build"
- /INOUTDIR:"C:\stdcxx\build" /BUILDTYPE:11d
+ /INOUTDIR:"C:\stdcxx\build" /BUILDTYPE:11d /CONFIG:msvc-7.1
</example>
<usage>
Usage: cscript runexamples.wsf /EXEDIR:@EXEDIR /INOUTDIR:@INOUTDIR
-/BUILDTYPE:@BUILDTYPE
+/BUILDTYPE:@BUILDTYPE /CONFIG:@CONFIG
[/LOGFILE:@LOGFILE] [/COPYDLL:@COPYDLL] [/LIBDIR:@LIBDIR]
[/COPYRWTESTDLL:@COPYRWTESTDLL]
where
@@ -52,6 +54,7 @@
@TOPDIR is the root directory with .in and .out files
required by executables,
@BUILDTYPE is the build type (11d, 11s, etc).
[EMAIL PROTECTED] is the compiler configuration (msvc-7.1, icc-9.0, etc).
@LOGFILE is the log file name.
@COPYDLL is the option for copy dll to executables
@LIBDIR is the library dll folder (specify when COPYDLL is true)
Index: etc/config/windows/utilities.js
===================================================================
--- etc/config/windows/utilities.js (revision 465233)
+++ etc/config/windows/utilities.js (working copy)
@@ -23,25 +23,26 @@
//
//////////////////////////////////////////////////////////////////////
-var VERSION = "";
+var VERSION = "7.1";
var DEVENV = "";
var DEVENVFLAGS = "";
var CPPFLAGS = "";
var LDFLAGS = "";
var CONVERT = false;
-var CXX = "";
-var LD = "";
-var AR = "";
-var SLNVER="";
+var CXX = "cl";
+var LD = "cl";
+var AR = "lib";
+var SLNVER="8.00";
var SLNCOMMENT="";
var UNICODELOG = false;
var NOSTCRT = false;
var WINDIFF = "";
var ICCCONVERT = "";
+var PLATFORM = "Win32";
// read and parse compiler configuration file
// config - name of the compiler configuration
-function getCompilerOpts(config)
+function parseConfig(config)
{
var scriptDir = getParentFolder(WScript.ScriptFullName);
var configFileName = scriptDir + "\\" + config + ".config";
@@ -60,70 +61,127 @@
WScript.Quit(3);
}
+ var rx = /^\s*([A-Z]+)\s*=\s*(\S.*)$/;
+
while (!configFile.AtEndOfStream)
{
var line = configFile.ReadLine();
- if (0 == line.indexOf("//"))
+
+ if (0 == line.length || 0 == line.indexOf("//"))
continue;
+
var inc = "#include ";
var pos = line.indexOf(inc);
if (0 == pos)
- getCompilerOpts(line.substr(pos + inc.length));
- var tokens = line.split("=");
- if (2 == tokens.length)
+ parseConfig(line.substr(pos + inc.length));
+
+ var arr = rx.exec(line);
+ if (null == arr || 0 == arr[2].length)
+ continue;
+
+ switch (arr[1])
{
- switch (tokens[0])
+ case "VERSION":
+ VERSION = arr[2];
+ break;
+ case "DEVENV":
+ DEVENV = arr[2];
+ break;
+ case "DEVENVFLAGS":
+ DEVENVFLAGS = arr[2];
+ break;
+ case "CPPFLAGS":
+ CPPFLAGS = arr[2];
+ break;
+ case "LDFLAGS":
+ LDFLAGS = arr[2];
+ break;
+ case "CONVERT":
+ CONVERT = parseInt(arr[2]) != 0;
+ break;
+ case "CXX":
+ CXX = arr[2];
+ break;
+ case "LD":
+ LD = arr[2];
+ break;
+ case "AR":
+ AR = arr[2];
+ break;
+ case "SLNVER":
+ SLNVER = arr[2];
+ break;
+ case "SLNCOMMENT":
+ SLNCOMMENT = arr[2];
+ break;
+ case "UNICODELOG":
+ UNICODELOG = parseInt(arr[2]) != 0;
+ break;
+ case "NOSTCRT":
+ NOSTCRT = parseInt(arr[2]) != 0;
+ break;
+ case "WINDIFF":
+ WINDIFF = arr[2];
+ break;
+ case "ICCCONVERT":
+ ICCCONVERT = arr[2];
+ break;
+ case "PLATFORM":
+ PLATFORM = arr[2];
+ break;
+ }
+ }
+}
+
+// init script variables for specified compiler configuration
+function getCompilerOpts(config)
+{
+ parseConfig(config);
+
+ if (0 == WINDIFF.length)
+ {
+ if (VERSION.length)
+ {
+ var ver = "";
+ if (0 <= VERSION.indexOf("."))
+ ver = VERSION.replace(".", "");
+ var path = WshShell.Environment.Item("VS" + ver + "COMNTOOLS");
+ if (path.length)
{
- case "VERSION":
- VERSION = tokens[1];
- break;
- case "DEVENV":
- DEVENV = tokens[1];
- break;
- case "DEVENVFLAGS":
- DEVENVFLAGS = tokens[1];
- break;
- case "CPPFLAGS":
- CPPFLAGS = tokens[1];
- break;
- case "LDFLAGS":
- LDFLAGS = tokens[1];
- break;
- case "CONVERT":
- CONVERT = (tokens[1] != "0");
- break;
- case "CXX":
- CXX = tokens[1];
- break;
- case "LD":
- LD = tokens[1];
- break;
- case "AR":
- AR = tokens[1];
- break;
- case "SLNVER":
- SLNVER = tokens[1];
- break;
- case "SLNCOMMENT":
- SLNCOMMENT = tokens[1];
- break;
- case "UNICODELOG":
- UNICODELOG = (tokens[1] != "0");
- break;
- case "NOSTCRT":
- NOSTCRT = (tokens[1] != "0");
- break;
- case "WINDIFF":
- WINDIFF = tokens[1];
- break;
- case "ICCCONVERT":
- ICCCONVERT = tokens[1];
- break;
+ WINDIFF = "\"" +
+ fso.BuildPath(path.replace(/\"/g, ""), "bin\\windiff") +
+ "\"";
}
}
+
+ if (0 == WINDIFF.length)
+ WINDIFF = "windiff";
}
}
+// out variables and their values to the stream
+function PrintVars(stream)
+{
+ stream.WriteLine("Variables:");
+ stream.WriteLine(" VERSION=" + VERSION);
+ stream.WriteLine(" DEVENV=" + DEVENV);
+ stream.WriteLine(" DEVENVFLAGS=" + DEVENVFLAGS);
+ stream.WriteLine(" CPPFLAGS=" + CPPFLAGS);
+ stream.WriteLine(" LDFLAGS=" + LDFLAGS);
+ stream.WriteLine(" CONVERT=" + CONVERT);
+ stream.WriteLine(" CXX=" + CXX);
+ stream.WriteLine(" LD=" + LD);
+ stream.WriteLine(" AR=" + AR);
+ stream.WriteLine(" SLNVER=" + SLNVER);
+ stream.WriteLine(" SLNCOMMENT=" + SLNCOMMENT);
+ stream.WriteLine(" UNICODELOG=" + UNICODELOG);
+ stream.WriteLine(" NOSTCRT=" + NOSTCRT);
+ stream.WriteLine(" WINDIFF=" + WINDIFF);
+ stream.WriteLine(" ICCCONVERT=" + ICCCONVERT);
+ stream.WriteLine(" PLATFORM=" + PLATFORM);
+ stream.WriteLine("");
+}
+
// returns parent folder for a path
function getParentFolder(path)
{
@@ -150,22 +208,6 @@
function getWinDiffDifferences(src1, src2, flags)
{
- if (WINDIFF == "")
- {
- if (VERSION == "")
- WINDIFF = "windiff";
- else
- {
- var ver = "";
- if (0 <= VERSION.indexOf("."))
- ver = VERSION.replace(".", "");
- WINDIFF = WshShell.Environment.Item("VS" + ver + "COMNTOOLS") +
- "\\bin\\windiff";
- if (WINDIFF[0] != "\"")
- WINDIFF = "\"" + WINDIFF + "\"";
- }
- }
-
try
{
// first create two temporary files
Index: generate.bat
===================================================================
--- generate.bat (revision 465232)
+++ generate.bat (working copy)
@@ -1,6 +1,11 @@
@echo off
+
+set exedir=
+
+if exist %SystemRoot%\SysWow64\cscript.exe set exedir=%SystemRoot%\SysWow64\
+
set ERRORLEVEL=0
-cscript /? > nul
+%exedir%cscript /? > nul
if %errorlevel% neq 0 (
echo "Windows scripting host is not installed. Please install it."
set ERRORLEVEL=1
@@ -12,7 +17,7 @@
set runfile=%~dp0\%scriptdir%\%rungen%
-cscript /nologo %runfile% %*
+%exedir%cscript /nologo %runfile% %*
if %errorlevel% neq 0 (
echo "Solution generation script failed."
set ERRORLEVEL=1