From a6167742811a69d98a716de8f0defa5e50af17d9 Mon Sep 17 00:00:00 2001 From: Scott Blomquist Date: Thu, 3 Jan 2013 23:36:04 +0100 Subject: [PATCH] windows: improve Visual Studio Express build support * Moved generated files to a clearer directory. * Improved detection logic for ctrpp.exe tool. Closes #4482 --- configure | 13 ++++----- node.gyp | 26 +++++++++--------- {src/gen => tools/msvs/genfiles}/MSG00001.bin | Bin .../msvs/genfiles}/node_etw_provider.h | 0 .../msvs/genfiles}/node_etw_provider.rc | 0 .../msvs/genfiles}/node_etw_providerTEMP.BIN | Bin .../msvs/genfiles}/node_perfctr_provider.h | 0 .../msvs/genfiles}/node_perfctr_provider.rc | 0 vcbuild.bat | 11 +++++--- 9 files changed, 26 insertions(+), 24 deletions(-) rename {src/gen => tools/msvs/genfiles}/MSG00001.bin (100%) rename {src/gen => tools/msvs/genfiles}/node_etw_provider.h (100%) rename {src/gen => tools/msvs/genfiles}/node_etw_provider.rc (100%) rename {src/gen => tools/msvs/genfiles}/node_etw_providerTEMP.BIN (100%) rename {src/gen => tools/msvs/genfiles}/node_perfctr_provider.h (100%) rename {src/gen => tools/msvs/genfiles}/node_perfctr_provider.rc (100%) diff --git a/configure b/configure index 3445153c09..a8687f26f5 100755 --- a/configure +++ b/configure @@ -604,15 +604,14 @@ def configure_winsdk(o): if not sys.platform.startswith('win32'): return - try: - p = subprocess.Popen(['ctrpp.exe'], - stdin=subprocess.PIPE, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE) - except OSError: + winsdk_dir = os.environ.get("WindowsSdkDir") + + if winsdk_dir and os.path.isfile(winsdk_dir + '\\bin\\ctrpp.exe'): + print "Found ctrpp in WinSDK--will build generated files into tools/msvs/genfiles." + o['variables']['node_has_winsdk'] = 'true' return - o['variables']['node_has_winsdk'] = 'true' + print "ctrpp not found in WinSDK path--using pre-gen files from tools/msvs/genfiles." output = { diff --git a/node.gyp b/node.gyp index 5b82114c72..bbded80895 100644 --- a/node.gyp +++ b/node.gyp @@ -73,7 +73,7 @@ 'include_dirs': [ 'src', - 'src/gen', + 'tools/msvs/genfiles', 'deps/uv/src/ares', '<(SHARED_INTERMEDIATE_DIR)' # for node_natives.h ], @@ -194,8 +194,8 @@ 'src/node_win32_etw_provider-inl.h', 'src/node_win32_etw_provider.cc', 'src/node_dtrace.cc', - 'src/gen/node_etw_provider.h', - 'src/gen/node_etw_provider.rc', + 'tools/msvs/genfiles/node_etw_provider.h', + 'tools/msvs/genfiles/node_etw_provider.rc', ] } ], [ 'node_use_perfctr=="true"', { @@ -206,7 +206,7 @@ 'src/node_win32_perfctr_provider.cc', 'src/node_counters.cc', 'src/node_counters.h', - 'src/gen/node_perfctr_provider.rc', + 'tools/msvs/genfiles/node_perfctr_provider.rc', ] } ], [ 'node_shared_v8=="false"', { @@ -295,11 +295,11 @@ 'action_name': 'node_etw', 'inputs': [ 'src/res/node_etw_provider.man' ], 'outputs': [ - 'src/gen/node_etw_provider.rc', - 'src/gen/node_etw_provider.h', - 'src/gen/node_etw_providerTEMP.BIN', + 'tools/msvs/genfiles/node_etw_provider.rc', + 'tools/msvs/genfiles/node_etw_provider.h', + 'tools/msvs/genfiles/node_etw_providerTEMP.BIN', ], - 'action': [ 'mc <@(_inputs) -h src/gen -r src/gen' ] + 'action': [ 'mc <@(_inputs) -h tools/msvs/genfiles -r tools/msvs/genfiles' ] } ] } ] @@ -316,13 +316,13 @@ 'action_name': 'node_perfctr_man', 'inputs': [ 'src/res/node_perfctr_provider.man' ], 'outputs': [ - 'src/gen/node_perfctr_provider.h', - 'src/gen/node_perfctr_provider.rc', - 'src/gen/MSG00001.BIN', + 'tools/msvs/genfiles/node_perfctr_provider.h', + 'tools/msvs/genfiles/node_perfctr_provider.rc', + 'tools/msvs/genfiles/MSG00001.BIN', ], 'action': [ 'ctrpp <@(_inputs) ' - '-o src/gen/node_perfctr_provider.h ' - '-rc src/gen/node_perfctr_provider.rc' + '-o tools/msvs/genfiles/node_perfctr_provider.h ' + '-rc tools/msvs/genfiles/node_perfctr_provider.rc' ] }, ], diff --git a/src/gen/MSG00001.bin b/tools/msvs/genfiles/MSG00001.bin similarity index 100% rename from src/gen/MSG00001.bin rename to tools/msvs/genfiles/MSG00001.bin diff --git a/src/gen/node_etw_provider.h b/tools/msvs/genfiles/node_etw_provider.h similarity index 100% rename from src/gen/node_etw_provider.h rename to tools/msvs/genfiles/node_etw_provider.h diff --git a/src/gen/node_etw_provider.rc b/tools/msvs/genfiles/node_etw_provider.rc similarity index 100% rename from src/gen/node_etw_provider.rc rename to tools/msvs/genfiles/node_etw_provider.rc diff --git a/src/gen/node_etw_providerTEMP.BIN b/tools/msvs/genfiles/node_etw_providerTEMP.BIN similarity index 100% rename from src/gen/node_etw_providerTEMP.BIN rename to tools/msvs/genfiles/node_etw_providerTEMP.BIN diff --git a/src/gen/node_perfctr_provider.h b/tools/msvs/genfiles/node_perfctr_provider.h similarity index 100% rename from src/gen/node_perfctr_provider.h rename to tools/msvs/genfiles/node_perfctr_provider.h diff --git a/src/gen/node_perfctr_provider.rc b/tools/msvs/genfiles/node_perfctr_provider.rc similarity index 100% rename from src/gen/node_perfctr_provider.rc rename to tools/msvs/genfiles/node_perfctr_provider.rc diff --git a/vcbuild.bat b/vcbuild.bat index f4020dfb15..0a2bd5e1c9 100644 --- a/vcbuild.bat +++ b/vcbuild.bat @@ -85,10 +85,13 @@ if defined noperfctr set noperfctr_arg=--without-perfctr& set noperfctr_msi_arg= if defined noprojgen goto msbuild @rem Generate the VS project. -python configure %debug_arg% %nosnapshot_arg% %noetw_arg% %noperfctr_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. +SETLOCAL + if defined VS100COMNTOOLS call "%VS100COMNTOOLS%\VCVarsQueryRegistry.bat" + python configure %debug_arg% %nosnapshot_arg% %noetw_arg% %noperfctr_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. +ENDLOCAL :msbuild @rem Skip project generation if requested.