Author: faridz
Date: Tue Sep 11 07:25:19 2007
New Revision: 574613
URL: http://svn.apache.org/viewvc?rev=574613&view=rev
Log:
2007-09-11 Farid Zaripov <[EMAIL PROTECTED]>
STDCXX-517
* generate.wsf: Detect values for CONFIG and BUILDDIR
parameters if they are not specified in command line.
* projectdef.js (InitVSObjects): return value indicating
the success or failure of the initialization.
* utilities.js (getCompilerOpts): Set variables to initial
state before parsing .config file.
README: Updated text on CONFIG and BUILDDIR parameters of
the generate.bat script.
Modified:
incubator/stdcxx/trunk/README
incubator/stdcxx/trunk/etc/config/windows/generate.wsf
incubator/stdcxx/trunk/etc/config/windows/projectdef.js
incubator/stdcxx/trunk/etc/config/windows/utilities.js
Modified: incubator/stdcxx/trunk/README
URL:
http://svn.apache.org/viewvc/incubator/stdcxx/trunk/README?rev=574613&r1=574612&r2=574613&view=diff
==============================================================================
--- incubator/stdcxx/trunk/README (original)
+++ incubator/stdcxx/trunk/README Tue Sep 11 07:25:19 2007
@@ -503,17 +503,22 @@
> DIR /D # this is ${TOPDIR}
GNUmakefile etc generate.bat include src
- o > .\generate.bat /BUILDDIR:<builddir> /CONFIG:<config>
+ o > .\generate.bat [/BUILDDIR:<builddir>] [/CONFIG:<config>]
<builddir> is the pathname of the build directory where to create
the solution and projects; the directory will be
created (as will all its required subdirectories)
- this is a required argument
+
+ The <builddir> argument is optional. When not
+ specified a current directory is assumed.
+
<config> name (not pathname) of a config file containing
compiler options; the available configuration files
are:
icc-9.0.config - for Intel C++ 9.0
icc-9.1.config - for Intel C++ 9.1
+ icc-10.0.config - for Intel C++ 10.0
+ icc-10.0-x64.config - for Intel C++ 10.0 (x64 platform)
msvc-7.0.config - for Microsoft Visual C++ .NET
msvc-7.1.config - for Microsoft Visual C++ .NET 2003
msvc-8.0.config - for Microsoft Visual C++ .NET 2005
@@ -521,7 +526,10 @@
2005 (x64 platform)
msvcex-8.0.config - for Microsoft Visual C++ Express
2005
- this is a required argument
+
+ The <config> argument is optional. When not
+ specified a the suitable config file will be selected
+ automatically.
o Example:
> generate.bat /BUILDDIR:C:\stdcxx /CONFIG:msvc-7.1
Modified: incubator/stdcxx/trunk/etc/config/windows/generate.wsf
URL:
http://svn.apache.org/viewvc/incubator/stdcxx/trunk/etc/config/windows/generate.wsf?rev=574613&r1=574612&r2=574613&view=diff
==============================================================================
--- incubator/stdcxx/trunk/etc/config/windows/generate.wsf (original)
+++ incubator/stdcxx/trunk/etc/config/windows/generate.wsf Tue Sep 11 07:25:19
2007
@@ -25,11 +25,11 @@
Generates solution file for a specified environment
</description>
<named helpstring="Name of the compiler configuration"
- name="CONFIG" required="true" type="string"/>
+ name="CONFIG" required="false" type="string"/>
<named helpstring="Top directory of stdcxx sources tree"
name="TOPDIR" required="false" type="string"/>
<named helpstring="Output directory for modules"
- name="BUILDDIR" required="true" type="string"/>
+ name="BUILDDIR" required="false" type="string"/>
<named helpstring="Copy dll to exe option"
name="COPYDLL" required="false" type="string"/>
<named helpstring="Generate locales projects"
@@ -40,8 +40,8 @@
/BUILDDIR:"C:\stdcxx\build" /CONFIG:msvc-7.1
</example>
<usage>
-Usage: cscript generate.wsf /CONFIG:@CONFIG
-/BUILDDIR:@BUILDDIR [/TOPDIR:@TOPDIR] [/COPYDLL:@COPYDLL]
+Usage: cscript generate.wsf [/CONFIG:@CONFIG]
+[/BUILDDIR:@BUILDDIR] [/TOPDIR:@TOPDIR] [/COPYDLL:@COPYDLL]
[/LOCALES:@LOCALES] [/LOCALETESTS:@LOCALETESTS]
where
@CONFIG is the compiler configuration (msvc-7.1, icc-9.0, etc).
@@ -108,7 +108,7 @@
{
Echo("Solution generation script");
Echo("Checking arguments...");
-
+
readAndCheckArguments();
createBuildDirs();
@@ -116,6 +116,10 @@
outDir += "\\" + currentCfg;
Echo("Checking consistence...");
+ // get solution object
+ if (null == VCProjectEngine && !InitVSObjects(currentCfg))
+ WScript.Quit(3);
+
logFile = currentCfg + logFile;
logStream = fso.CreateTextFile(outDir + "\\" + logFile, true, false);
@@ -124,9 +128,6 @@
new Macro("%SRCDIR%", srcDir),
new Macro("%BUILDDIR%", outDir));
- // get solution object
- InitVSObjects(currentCfg);
-
PrintVars(logStream);
PrintVars(WScript.StdOut);
@@ -228,23 +229,48 @@
// performs checking of the script parameters
function readAndCheckArguments()
{
- if (!WScript.Arguments.Named.Exists("CONFIG"))
+ if (WScript.Arguments.Named.Exists("CONFIG"))
+ currentCfg = WScript.Arguments.Named("CONFIG");
+ else
{
- WScript.StdErr.WriteLine(
- "Generate: Missing required argument.");
- WScript.Arguments.ShowUsage();
- WScript.Quit(2);
+ // try to deduce it
+ // ICC cannot be used without VisualStudio installed
+ // so we check only for MSVC
+ Echo("CONFIG parameter not specified, trying to detect it...");
+ var cfgs = new Array("msvc-8.0", "msvc-7.1", "msvc-7.0");
+ for (var i = 0; i < cfgs.length; ++i)
+ {
+ var curCfg = cfgs[i];
+ Echo("Trying " + curCfg + "...");
+
+ if (InitVSObjects(curCfg))
+ {
+ Echo("Succeeded. Using CONFIG=" + curCfg + ".");
+ currentCfg = curCfg;
+ break;
+ }
+
+ Echo(curCfg + " checking failed.");
+ }
}
-
- if (!WScript.Arguments.Named.Exists("BUILDDIR"))
+
+ if ("" == currentCfg)
{
- WScript.StdErr.WriteLine(
- "Generate: Missing required argument BUILDDIR.");
- WScript.Arguments.ShowUsage();
+ WScript.StdErr.WriteLine("No suitable config file detected.");
WScript.Quit(2);
}
- currentCfg = WScript.Arguments.Named("CONFIG");
+ if (WScript.Arguments.Named.Exists("BUILDDIR"))
+ {
+ outDir = WScript.Arguments.Named("BUILDDIR");
+ outDir = fso.GetAbsolutePathName (outDir);
+ }
+ else
+ {
+ // use current directory
+ outDir = WshShell.CurrentDirectory;
+ Echo("BUILDDIR parameter not specified, using BUILDDIR=" + outDir);
+ }
if (WScript.Arguments.Named.Exists("TOPDIR"))
{
@@ -264,6 +290,7 @@
}
srcDir = myDir.substr(0, dirIndex);
+ Echo("TOPDIR parameter not specified, using TOPDIR=" + srcDir);
}
if (srcDir != "")
@@ -277,12 +304,6 @@
}
outDir = srcDir;
- }
-
- if (WScript.Arguments.Named.Exists("BUILDDIR"))
- {
- outDir = WScript.Arguments.Named("BUILDDIR");
- outDir = fso.GetAbsolutePathName (outDir);
}
if (WScript.Arguments.Named.Exists("COPYDLL"))
Modified: incubator/stdcxx/trunk/etc/config/windows/projectdef.js
URL:
http://svn.apache.org/viewvc/incubator/stdcxx/trunk/etc/config/windows/projectdef.js?rev=574613&r1=574612&r2=574613&view=diff
==============================================================================
--- incubator/stdcxx/trunk/etc/config/windows/projectdef.js (original)
+++ incubator/stdcxx/trunk/etc/config/windows/projectdef.js Tue Sep 11 07:25:19
2007
@@ -124,8 +124,10 @@
catch (e)
{
WScript.StdErr.WriteLine("Unable to create VCProjectEngine object: " +
e.message);
- WScript.Quit(3);
+ return false;
}
+
+ return true;
}
//------------------------------------------------
Modified: incubator/stdcxx/trunk/etc/config/windows/utilities.js
URL:
http://svn.apache.org/viewvc/incubator/stdcxx/trunk/etc/config/windows/utilities.js?rev=574613&r1=574612&r2=574613&view=diff
==============================================================================
--- incubator/stdcxx/trunk/etc/config/windows/utilities.js (original)
+++ incubator/stdcxx/trunk/etc/config/windows/utilities.js Tue Sep 11 07:25:19
2007
@@ -23,23 +23,23 @@
//
//////////////////////////////////////////////////////////////////////
-var VERSION = "7.1";
+var VERSION = "";
var DEVENV = "";
var DEVENVFLAGS = "";
var CPPFLAGS = "";
var LDFLAGS = "";
var CONVERT = false;
-var CXX = "cl";
-var LD = "cl";
-var AR = "lib";
-var AS = "ml";
-var SLNVER="8.00";
+var CXX = "";
+var LD = "";
+var AR = "";
+var AS = "";
+var SLNVER="";
var SLNCOMMENT="";
var UNICODELOG = false;
var NOSTCRT = false;
var WINDIFF = "";
var ICCCONVERT = "";
-var PLATFORM = "Win32";
+var PLATFORM = "";
var CLVARSBAT = "";
// timeout for exec utility in seconds
@@ -179,6 +179,26 @@
// init script variables for specified compiler configuration
function getCompilerOpts(config)
{
+ // set vars to initial state
+ VERSION = "";
+ DEVENV = "";
+ DEVENVFLAGS = "";
+ CPPFLAGS = "";
+ LDFLAGS = "";
+ CONVERT = false;
+ CXX = "";
+ LD = "";
+ AR = "";
+ AS = "";
+ SLNVER="";
+ SLNCOMMENT="";
+ UNICODELOG = false;
+ NOSTCRT = false;
+ WINDIFF = "";
+ ICCCONVERT = "";
+ PLATFORM = "";
+ CLVARSBAT = "";
+
parseConfig(config);
if (0 == WINDIFF.length)