vcbuild: run the 'configure' script in vcbuild.bat
authorNathan Rajlich <nathan@tootallnate.net>
Thu, 15 Mar 2012 22:17:25 +0000 (15:17 -0700)
committerNathan Rajlich <nathan@tootallnate.net>
Thu, 15 Mar 2012 23:12:19 +0000 (16:12 -0700)
So that a 'config.gypi' file gets generated, which is
required for the `process.config` object (see #2928).

configure
vcbuild.bat

index 00a8ed0..30b8f4b 100755 (executable)
--- a/configure
+++ b/configure
@@ -146,8 +146,8 @@ def pkg_config(pkg):
   return (libs, cflags)
 
 
-def host_arch():
-  """Host architecture. One of arm, ia32 or x64."""
+def host_arch_cc():
+  """Host architecture check using the CC command."""
 
   p = subprocess.Popen([CC, '-dM', '-E', '-'],
                        stdin=subprocess.PIPE,
@@ -183,6 +183,29 @@ def host_arch():
   return rtn
 
 
+def host_arch_win():
+  """Host architecture check using environ vars (better way to do this?)"""
+
+  arch = os.environ.get('PROCESSOR_ARCHITECTURE', 'x86')
+
+  matchup = {
+    'AMD64'  : 'x64',
+    'x86'    : 'ia32',
+    'arm'    : 'arm',
+  }
+
+  return matchup.get(arch, 'ia32')
+
+
+def host_arch():
+  """Host architecture. One of arm, ia32 or x64."""
+  if os.name == 'nt':
+    arch = host_arch_win()
+  else:
+    arch = host_arch_cc()
+  return arch
+
+
 def target_arch():
   return host_arch()
 
@@ -314,4 +337,8 @@ write('config.gypi', "# Do not edit. Generated by the configure script.\n" +
 write('config.mk', "# Do not edit. Generated by the configure script.\n" +
   ("BUILDTYPE=%s\n" % ('Debug' if options.debug else 'Release')))
 
-subprocess.call(['tools/gyp_node','-f', 'make'])
+if os.name == 'nt':
+  subprocess.call(['python', 'tools/gyp_node', '-f', 'msvs',
+                                               '-G', 'msvs_version=2010'])
+else:
+  subprocess.call(['tools/gyp_node', '-f', 'make'])
index 632668e..fc4d94e 100644 (file)
@@ -15,6 +15,8 @@ if /i "%1"=="/?" goto help
 set config=Release
 set target=Build
 set target_arch=ia32
+set debug_arg=
+set nosnapshot_arg=
 set noprojgen=
 set nobuild=
 set nosign=
@@ -57,21 +59,15 @@ goto next-arg
 if defined upload goto upload
 if defined jslint goto jslint
 
+if "%config%"=="Debug" set debug_arg=--debug
+if defined nosnapshot set nosnapshot_arg=--without-snapshot
 
 :project-gen
 @rem Skip project generation if requested.
 if defined noprojgen goto msbuild
 
 @rem Generate the VS project.
-if defined nosnapshot goto nosnapshotgen
-python tools\gyp_node -f msvs -G msvs_version=2010 -Dtarget_arch=%target_arch%
-if errorlevel 1 goto create-msvs-files-failed
-if not exist node.sln goto create-msvs-files-failed
-echo Project files generated.
-goto msbuild
-
-:nosnapshotgen
-python tools\gyp_node -f msvs -G msvs_version=2010 -D v8_use_snapshot='false' -Dtarget_arch=%target_arch%
+python configure %debug_arg% %nosnapshot_arg% --dest-cpu=%target_arch%
 if errorlevel 1 goto create-msvs-files-failed
 if not exist node.sln goto create-msvs-files-failed
 echo Project files generated.