diff --git a/common.gypi b/common.gypi index 31fe5669938..887df4b2285 100644 --- a/common.gypi +++ b/common.gypi @@ -138,8 +138,21 @@ }, 'VCLinkerTool': { 'conditions': [ + ['target_arch=="ia32"', { + 'TargetMachine' : 1, # /MACHINE:X86 + 'target_conditions': [ + ['_type=="executable"', { + 'AdditionalOptions': [ '/SubSystem:Console,"5.01"' ], + }], + ], + }], ['target_arch=="x64"', { - 'TargetMachine' : 17 # /MACHINE:X64 + 'TargetMachine' : 17, # /MACHINE:AMD64 + 'target_conditions': [ + ['_type=="executable"', { + 'AdditionalOptions': [ '/SubSystem:Console,"5.02"' ], + }], + ], }], ], 'GenerateDebugInformation': 'true', @@ -147,11 +160,6 @@ 'DataExecutionPrevention': 2, # enable DEP 'AllowIsolation': 'true', 'SuppressStartupBanner': 'true', - 'target_conditions': [ - ['_type=="executable"', { - 'SubSystem': 1, # console executable - }], - ], }, }, 'conditions': [ diff --git a/node.gyp b/node.gyp index fbf0292a2ee..b641584c312 100644 --- a/node.gyp +++ b/node.gyp @@ -324,11 +324,6 @@ ], }], ], - 'msvs_settings': { - 'VCLinkerTool': { - 'SubSystem': 1, # /subsystem:console - }, - }, }, # generate ETW header and resource files { diff --git a/tools/msvs/msi/custom_actions.c b/tools/msvs/msi/custom_actions.cc similarity index 83% rename from tools/msvs/msi/custom_actions.c rename to tools/msvs/msi/custom_actions.cc index 5e7d617f387..9a23d557476 100644 --- a/tools/msvs/msi/custom_actions.c +++ b/tools/msvs/msi/custom_actions.cc @@ -6,7 +6,7 @@ #include -UINT WINAPI BroadcastEnvironmentUpdate(MSIHANDLE hInstall) { +extern "C" UINT WINAPI BroadcastEnvironmentUpdate(MSIHANDLE hInstall) { HRESULT hr = S_OK; UINT er = ERROR_SUCCESS; @@ -27,7 +27,7 @@ UINT WINAPI BroadcastEnvironmentUpdate(MSIHANDLE hInstall) { } -BOOL WINAPI DllMain(HINSTANCE hInst, ULONG ulReason, VOID* dummy) { +extern "C" BOOL WINAPI DllMain(HINSTANCE hInst, ULONG ulReason, VOID* dummy) { switch (ulReason) { case DLL_PROCESS_ATTACH: WcaGlobalInitialize(hInst); diff --git a/tools/msvs/msi/custom_actions.vcxproj b/tools/msvs/msi/custom_actions.vcxproj index e014a6981f5..3716f07ff6d 100644 --- a/tools/msvs/msi/custom_actions.vcxproj +++ b/tools/msvs/msi/custom_actions.vcxproj @@ -1,5 +1,5 @@  - + Debug @@ -27,24 +27,24 @@ DynamicLibrary - v120 + $(PlatformToolset) Unicode true DynamicLibrary - v120 + $(PlatformToolset) Unicode true DynamicLibrary - v120 + $(PlatformToolset) Unicode DynamicLibrary - v120 + $(PlatformToolset) Unicode @@ -81,7 +81,7 @@ Disabled - $(WIX)sdk\VS2013\inc;%(AdditionalIncludeDirectories) + $(WIX)sdk\VS$(GypMsvsVersion)\inc;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug @@ -91,7 +91,7 @@ msi.lib;dutil.lib;wcautil.lib;version.lib;%(AdditionalDependencies) - $(WIX)sdk\VS2013\lib\x86;%(AdditionalLibraryDirectories) + $(WIX)sdk\VS$(GypMsvsVersion)\lib\x86;%(AdditionalLibraryDirectories) custom_actions.def true Windows @@ -100,7 +100,7 @@ Disabled - $(WIX)sdk\VS2013\inc;%(AdditionalIncludeDirectories) + $(WIX)sdk\VS$(GypMsvsVersion)\inc;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebug @@ -110,7 +110,7 @@ msi.lib;dutil.lib;wcautil.lib;version.lib;%(AdditionalDependencies) - $(WIX)sdk\VS2013\lib\x64;%(AdditionalLibraryDirectories) + $(WIX)sdk\VS$(GypMsvsVersion)\lib\x64;%(AdditionalLibraryDirectories) custom_actions.def true Windows @@ -120,7 +120,7 @@ MaxSpeed true - $(WIX)sdk\VS2013\inc;%(AdditionalIncludeDirectories) + $(WIX)sdk\VS$(GypMsvsVersion)\inc;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) MultiThreaded true @@ -134,7 +134,7 @@ msi.lib;dutil.lib;wcautil.lib;version.lib;%(AdditionalDependencies) - $(WIX)sdk\VS2013\lib\x86;%(AdditionalLibraryDirectories) + $(WIX)sdk\VS$(GypMsvsVersion)\lib\x86;%(AdditionalLibraryDirectories) custom_actions.def true Windows @@ -146,7 +146,7 @@ MaxSpeed true - $(WIX)sdk\VS2013\inc;%(AdditionalIncludeDirectories) + $(WIX)sdk\VS$(GypMsvsVersion)\inc;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) MultiThreaded true @@ -160,7 +160,7 @@ msi.lib;dutil.lib;wcautil.lib;version.lib;%(AdditionalDependencies) - $(WIX)sdk\VS2013\lib\x64;%(AdditionalLibraryDirectories) + $(WIX)sdk\VS$(GypMsvsVersion)\lib\x64;%(AdditionalLibraryDirectories) custom_actions.def true Windows @@ -169,7 +169,7 @@ - + @@ -178,4 +178,4 @@ - \ No newline at end of file + diff --git a/vcbuild.bat b/vcbuild.bat index 1fb9aa44ab3..4684769136c 100644 --- a/vcbuild.bat +++ b/vcbuild.bat @@ -83,54 +83,87 @@ if defined nosnapshot set nosnapshot_arg=--without-snapshot if defined noetw set noetw_arg=--without-etw& set noetw_msi_arg=/p:NoETW=1 if defined noperfctr set noperfctr_arg=--without-perfctr& set noperfctr_msi_arg=/p:NoPerfCtr=1 -:project-gen -@rem Skip project generation if requested. -if defined noprojgen goto msbuild - -if defined NIGHTLY set TAG=nightly-%NIGHTLY% - -@rem Generate the VS project. -SETLOCAL - if defined VS100COMNTOOLS call "%VS100COMNTOOLS%\VCVarsQueryRegistry.bat" - python configure %debug_arg% %nosnapshot_arg% %noetw_arg% %noperfctr_arg% --dest-cpu=%target_arch% --tag=%TAG% - 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. -if defined nobuild goto sign - @rem Look for Visual Studio 2013 +echo Looking for Visual Studio 2013 if not defined VS120COMNTOOLS goto vc-set-2012 if not exist "%VS120COMNTOOLS%\..\..\vc\vcvarsall.bat" goto vc-set-2012 +echo Found Visual Studio 2013 +if defined msi ( + echo Looking for WiX installation for Visual Studio 2013... + if not exist "%WIX%\SDK\VS2013" ( + echo Failed to find WiX install for Visual Studio 2013 + goto vc-set-2012 + ) +) call "%VS120COMNTOOLS%\..\..\vc\vcvarsall.bat" if not defined VCINSTALLDIR goto msbuild-not-found set GYP_MSVS_VERSION=2013 +set PLATFORM_TOOLSET=v120 goto msbuild-found :vc-set-2012 @rem Look for Visual Studio 2012 +echo Looking for Visual Studio 2012 if not defined VS110COMNTOOLS goto vc-set-2010 if not exist "%VS110COMNTOOLS%\..\..\vc\vcvarsall.bat" goto vc-set-2010 +echo Found Visual Studio 2012 +if defined msi ( + echo Looking for WiX installation for Visual Studio 2012... + if not exist "%WIX%\SDK\VS2012" ( + echo Failed to find WiX install for Visual Studio 2012 + goto vc-set-2010 + ) +) call "%VS110COMNTOOLS%\..\..\vc\vcvarsall.bat" if not defined VCINSTALLDIR goto msbuild-not-found set GYP_MSVS_VERSION=2012 +set PLATFORM_TOOLSET=v110 goto msbuild-found :vc-set-2010 +echo Looking for Visual Studio 2010 if not defined VS100COMNTOOLS goto msbuild-not-found if not exist "%VS100COMNTOOLS%\..\..\vc\vcvarsall.bat" goto msbuild-not-found +echo Found Visual Studio 2010 +if defined msi ( + echo Looking for WiX installation for Visual Studio 2010... + if not exist "%WIX%\SDK\VS2010" ( + echo Failed to find WiX install for Visual Studio 2010 + goto wix-not-found + ) +) call "%VS100COMNTOOLS%\..\..\vc\vcvarsall.bat" if not defined VCINSTALLDIR goto msbuild-not-found +set GYP_MSVS_VERSION=2010 +set PLATFORM_TOOLSET=v100 goto msbuild-found :msbuild-not-found -echo Build skipped. To build, this file needs to run from VS cmd prompt. +echo Failed to find Visual Studio installation. +goto exit + +:wix-not-found +echo Build skipped. To generate installer, you need to install Wix. goto run :msbuild-found + +:project-gen +@rem Skip project generation if requested. +if defined noprojgen goto msbuild + +if defined NIGHTLY set TAG=nightly-%NIGHTLY% + +@rem Generate the VS project. +python configure %debug_arg% %nosnapshot_arg% %noetw_arg% %noperfctr_arg% --dest-cpu=%target_arch% --tag=%TAG% +if errorlevel 1 goto create-msvs-files-failed +if not exist node.sln goto create-msvs-files-failed +echo Project files generated. + +:msbuild +@rem Skip project generation if requested. +if defined nobuild goto sign + @rem Build the sln with msbuild. msbuild node.sln /m /t:%target% /p:Configuration=%config% /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo if errorlevel 1 goto exit @@ -159,7 +192,7 @@ set NODE_VERSION=%NODE_VERSION%.%NIGHTLY% :msibuild echo Building node-%NODE_VERSION% -msbuild "%~dp0tools\msvs\msi\nodemsi.sln" /m /t:Clean,Build /p:Configuration=%config% /p:Platform=%msiplatform% /p:NodeVersion=%NODE_VERSION% %noetw_msi_arg% %noperfctr_msi_arg% /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo +msbuild "%~dp0tools\msvs\msi\nodemsi.sln" /m /t:Clean,Build /p:PlatformToolset=%PLATFORM_TOOLSET% /p:GypMsvsVersion=%GYP_MSVS_VERSION% /p:Configuration=%config% /p:Platform=%msiplatform% /p:NodeVersion=%NODE_VERSION% %noetw_msi_arg% %noperfctr_msi_arg% /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo if errorlevel 1 goto exit if defined nosign goto run