From dd23085f1d707589d0407991479a6e7f036d38ea Mon Sep 17 00:00:00 2001 From: Dane Springmeyer Date: Wed, 29 Jul 2015 13:08:04 -0700 Subject: [PATCH 1/2] apply c++11 patches --- common.gypi | 12 ++++++++---- configure | 4 ++-- deps/cares/common.gypi | 8 ++++---- deps/http_parser/http_parser.gyp | 4 ++-- deps/openssl/openssl/e_os.h | 4 ++-- deps/uv/common.gypi | 8 ++++---- deps/uv/src/win/fs.c | 4 ++-- deps/v8/build/common.gypi | 8 ++++---- deps/zlib/zconf.h | 3 +++ src/node.cc | 2 +- vcbuild.bat | 15 +++++++++++++-- 11 files changed, 45 insertions(+), 27 deletions(-) diff --git a/common.gypi b/common.gypi index 31fe56699388..fd2ff84effb6 100644 --- a/common.gypi +++ b/common.gypi @@ -44,7 +44,7 @@ ], 'msvs_settings': { 'VCCLCompilerTool': { - 'RuntimeLibrary': 1, # static debug + 'RuntimeLibrary': 3, # MDd 'Optimization': 0, # /Od, no optimization 'MinimalRebuild': 'false', 'OmitFramePointers': 'false', @@ -96,7 +96,7 @@ ], 'msvs_settings': { 'VCCLCompilerTool': { - 'RuntimeLibrary': 0, # static release + 'RuntimeLibrary': 2, # MD 'Optimization': 3, # /Ox, full optimization 'FavorSizeOrSpeed': 1, # /Ot, favour speed over size 'InlineFunctionExpansion': 2, # /Ob2, inline anything eligible @@ -171,7 +171,7 @@ }], [ 'OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', { 'cflags': [ '-Wall', '-Wextra', '-Wno-unused-parameter', '-pthread', ], - 'cflags_cc': [ '-fno-rtti', '-fno-exceptions' ], + 'cflags_cc': [ '-fno-rtti', '-fno-exceptions', '-std=c++11' ], 'ldflags': [ '-pthread', '-rdynamic' ], 'target_conditions': [ ['_type=="static_library"', { @@ -198,6 +198,10 @@ ['OS=="mac"', { 'defines': ['_DARWIN_USE_64_BIT_INODE=1'], 'xcode_settings': { + 'CLANG_CXX_LIBRARY': 'libc++', + 'CLANG_CXX_LANGUAGE_STANDARD':'c++11', + 'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0', + 'GCC_OPTIMIZATION_LEVEL': '3', 'ALWAYS_SEARCH_USER_PATHS': 'NO', 'GCC_CW_ASM_SYNTAX': 'NO', # No -fasm-blocks 'GCC_DYNAMIC_NO_PIC': 'NO', # No -mdynamic-no-pic @@ -207,7 +211,7 @@ 'GCC_ENABLE_PASCAL_STRINGS': 'NO', # No -mpascal-strings 'GCC_THREADSAFE_STATICS': 'NO', # -fno-threadsafe-statics 'PREBINDING': 'NO', # No -Wl,-prebind - 'MACOSX_DEPLOYMENT_TARGET': '10.5', # -mmacosx-version-min=10.5 + 'MACOSX_DEPLOYMENT_TARGET': '10.9', # -mmacosx-version-min=10.9 'USE_HEADERMAP': 'NO', 'OTHER_CFLAGS': [ '-fno-strict-aliasing', diff --git a/configure b/configure index 2722d591f85a..e6c8d5884e16 100755 --- a/configure +++ b/configure @@ -655,7 +655,7 @@ def configure_winsdk(o): winsdk_dir = os.environ.get("WindowsSdkDir") - if winsdk_dir and os.path.isfile(winsdk_dir + '\\bin\\ctrpp.exe'): + if winsdk_dir and os.path.isfile(winsdk_dir + '\\bin\\x64\\ctrpp.exe'): print "Found ctrpp in WinSDK--will build generated files into tools/msvs/genfiles." o['variables']['node_has_winsdk'] = 'true' return @@ -724,7 +724,7 @@ if options.use_ninja: elif options.use_xcode: gyp_args += ['-f', 'xcode'] elif flavor == 'win': - gyp_args += ['-f', 'msvs', '-G', 'msvs_version=auto'] + gyp_args += ['-f', 'msvs', '-G', 'msvs_version=2013'] else: gyp_args += ['-f', 'make-' + flavor] diff --git a/deps/cares/common.gypi b/deps/cares/common.gypi index e707e440406d..9ffd7cef613d 100644 --- a/deps/cares/common.gypi +++ b/deps/cares/common.gypi @@ -18,9 +18,9 @@ 'VCCLCompilerTool': { 'target_conditions': [ ['library=="static_library"', { - 'RuntimeLibrary': 1 # static debug + 'RuntimeLibrary': 3 # MDd }, { - 'RuntimeLibrary': 3 # DLL debug + 'RuntimeLibrary': 3 # MDd }] ], 'Optimization': 0, # /Od, no optimization @@ -49,9 +49,9 @@ 'VCCLCompilerTool': { 'target_conditions': [ ['library=="static_library"', { - 'RuntimeLibrary': 0, # static release + 'RuntimeLibrary': 2 # MD }, { - 'RuntimeLibrary': 2, # debug release + 'RuntimeLibrary': 2 # MD }], ], 'Optimization': 3, # /Ox, full optimization diff --git a/deps/http_parser/http_parser.gyp b/deps/http_parser/http_parser.gyp index c6eada707f27..4963f7b0e7c6 100644 --- a/deps/http_parser/http_parser.gyp +++ b/deps/http_parser/http_parser.gyp @@ -14,7 +14,7 @@ 'defines': [ 'DEBUG', '_DEBUG' ], 'msvs_settings': { 'VCCLCompilerTool': { - 'RuntimeLibrary': 1, # static debug + 'RuntimeLibrary': 3 # MDd }, }, }, @@ -22,7 +22,7 @@ 'defines': [ 'NDEBUG' ], 'msvs_settings': { 'VCCLCompilerTool': { - 'RuntimeLibrary': 0, # static release + 'RuntimeLibrary': 2 # MD }, }, } diff --git a/deps/openssl/openssl/e_os.h b/deps/openssl/openssl/e_os.h index 758448596a16..61c3ec750d04 100644 --- a/deps/openssl/openssl/e_os.h +++ b/deps/openssl/openssl/e_os.h @@ -315,7 +315,7 @@ static __inline unsigned int _strlen31(const char *str) # undef isxdigit # endif # if defined(_MSC_VER) && !defined(_DLL) && defined(stdin) -# if _MSC_VER>=1300 +# if _MSC_VER>=1300 && _MSC_VER<1900 # undef stdin # undef stdout # undef stderr @@ -323,7 +323,7 @@ FILE *__iob_func(); # define stdin (&__iob_func()[0]) # define stdout (&__iob_func()[1]) # define stderr (&__iob_func()[2]) -# elif defined(I_CAN_LIVE_WITH_LNK4049) +# elif _MSC_VER<1900 && defined(I_CAN_LIVE_WITH_LNK4049) # undef stdin # undef stdout # undef stderr diff --git a/deps/uv/common.gypi b/deps/uv/common.gypi index 4b240d98f78f..1e295119e3aa 100644 --- a/deps/uv/common.gypi +++ b/deps/uv/common.gypi @@ -20,9 +20,9 @@ 'VCCLCompilerTool': { 'target_conditions': [ ['library=="static_library"', { - 'RuntimeLibrary': 1, # static debug + 'RuntimeLibrary': 3 # MDd }, { - 'RuntimeLibrary': 3, # DLL debug + 'RuntimeLibrary': 3 # MDd }], ], 'Optimization': 0, # /Od, no optimization @@ -57,9 +57,9 @@ 'VCCLCompilerTool': { 'target_conditions': [ ['library=="static_library"', { - 'RuntimeLibrary': 0, # static release + 'RuntimeLibrary': 2 # MD }, { - 'RuntimeLibrary': 2, # debug release + 'RuntimeLibrary': 2 # MD }], ], 'Optimization': 3, # /Ox, full optimization diff --git a/deps/uv/src/win/fs.c b/deps/uv/src/win/fs.c index c5a4b2b70343..74e78faa7f51 100644 --- a/deps/uv/src/win/fs.c +++ b/deps/uv/src/win/fs.c @@ -732,9 +732,9 @@ void fs__readdir(uv_fs_t* req) { if (len == 0) { fmt = L"./*"; } else if (pathw[len - 1] == L'/' || pathw[len - 1] == L'\\') { - fmt = L"%ls*"; + fmt = L"%S*"; } else { - fmt = L"%ls\\*"; + fmt = L"%S\\*"; } /* Figure out whether path is a file or a directory. */ diff --git a/deps/v8/build/common.gypi b/deps/v8/build/common.gypi index 200c02c78060..a7cdfcdbb4fa 100644 --- a/deps/v8/build/common.gypi +++ b/deps/v8/build/common.gypi @@ -344,9 +344,9 @@ 'conditions': [ ['OS=="win" and component=="shared_library"', { - 'RuntimeLibrary': '3', # /MDd + 'RuntimeLibrary': 3 # MDd }, { - 'RuntimeLibrary': '1', # /MTd + 'RuntimeLibrary': 3 # MDd }], ], }, @@ -409,9 +409,9 @@ 'StringPooling': 'true', 'conditions': [ ['OS=="win" and component=="shared_library"', { - 'RuntimeLibrary': '2', #/MD + 'RuntimeLibrary': 2 # MD }, { - 'RuntimeLibrary': '0', #/MT + 'RuntimeLibrary': 2 # MD }], ['v8_target_arch=="x64"', { # TODO(2207): remove this option once the bug is fixed. diff --git a/deps/zlib/zconf.h b/deps/zlib/zconf.h index 9987a775530c..498a2aa802f5 100644 --- a/deps/zlib/zconf.h +++ b/deps/zlib/zconf.h @@ -203,6 +203,9 @@ #endif #if !defined(STDC) && (defined(MSDOS) || defined(WINDOWS) || defined(WIN32)) # define STDC +#if _MSC_VER>=1900 +# define STDC99 +#endif #endif #if !defined(STDC) && (defined(OS2) || defined(__HOS_AIX__)) # define STDC diff --git a/src/node.cc b/src/node.cc index e8ccb7276b87..91af7ba734a5 100644 --- a/src/node.cc +++ b/src/node.cc @@ -2086,7 +2086,7 @@ static Handle EnvSetter(Local property, WCHAR* key_ptr = reinterpret_cast(*key); // Environment variables that start with '=' are read-only. if (key_ptr[0] != L'=') { - SetEnvironmentVariableW(key_ptr, reinterpret_cast(*val)); + _wputenv_s(key_ptr, reinterpret_cast(*val)); } #endif // Whether it worked or not, always return rval. diff --git a/vcbuild.bat b/vcbuild.bat index 6b58209ef9a3..df169a458dea 100644 --- a/vcbuild.bat +++ b/vcbuild.bat @@ -13,6 +13,7 @@ if /i "%1"=="/?" goto help @rem Process arguments. set config=Release +set platform=Win32 set msiplatform=x86 set target=Build set target_arch=ia32 @@ -77,6 +78,7 @@ if defined jslint goto jslint if "%config%"=="Debug" set debug_arg=--debug if "%target_arch%"=="x64" set msiplatform=x64 +if "%target_arch%"=="x64" set platform=x64 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 @@ -100,6 +102,15 @@ ENDLOCAL @rem Skip project generation if requested. if defined nobuild goto sign +@rem Look for Visual Studio 2015 +if not defined VS140COMNTOOLS goto vc-set-2013 +if not exist "%VS140COMNTOOLS%\..\..\vc\vcvarsall.bat" goto vc-set-2013 +call "%VS140COMNTOOLS%\..\..\vc\vcvarsall.bat" +if not defined VCINSTALLDIR goto msbuild-not-found +set GYP_MSVS_VERSION=2015 +goto msbuild-found + +:vc-set-2013 @rem Look for Visual Studio 2013 if not defined VS120COMNTOOLS goto vc-set-2012 if not exist "%VS120COMNTOOLS%\..\..\vc\vcvarsall.bat" goto vc-set-2012 @@ -130,7 +141,7 @@ goto run :msbuild-found @rem Build the sln with msbuild. -msbuild node.sln /m /t:%target% /p:Configuration=%config% /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo +msbuild node.sln /m:%NUMBER_OF_PROCESSORS% /p:BuildInParallel=true /toolsversion:14.0 /p:PlatformToolset=v140 /t:%target% /p:Configuration=%config% /p:Platform=%platform% /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo if errorlevel 1 goto exit :sign @@ -197,7 +208,7 @@ if "%test%"=="test" goto jslint goto exit :create-msvs-files-failed -echo Failed to create vc project files. +echo Failed to create vc project files. goto exit :upload From d10a62e23792225712808b9420e73232eb6e1960 Mon Sep 17 00:00:00 2001 From: bergwerkgis Date: Thu, 30 Jul 2015 14:27:34 +0000 Subject: [PATCH 2/2] undo fs.c patch --- deps/uv/src/win/fs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deps/uv/src/win/fs.c b/deps/uv/src/win/fs.c index 74e78faa7f51..c5a4b2b70343 100644 --- a/deps/uv/src/win/fs.c +++ b/deps/uv/src/win/fs.c @@ -732,9 +732,9 @@ void fs__readdir(uv_fs_t* req) { if (len == 0) { fmt = L"./*"; } else if (pathw[len - 1] == L'/' || pathw[len - 1] == L'\\') { - fmt = L"%S*"; + fmt = L"%ls*"; } else { - fmt = L"%S\\*"; + fmt = L"%ls\\*"; } /* Figure out whether path is a file or a directory. */