From 416abd81a16f2d3bc3bd50770bca2bf485a5c00f Mon Sep 17 00:00:00 2001 From: Nicholas Hastings Date: Wed, 30 Mar 2016 08:56:27 -0400 Subject: [PATCH] Add support for compiling with VS2015. --- AMBuildScript | 2 ++ core/AMBuilder | 2 ++ extensions/mysql/AMBuilder | 3 +++ public/sm_platform.h | 2 +- 4 files changed, 8 insertions(+), 1 deletion(-) diff --git a/AMBuildScript b/AMBuildScript index b16a557d..83867a4f 100644 --- a/AMBuildScript +++ b/AMBuildScript @@ -404,6 +404,8 @@ class SMConfig(object): if compiler.like('msvc'): compiler.defines += ['COMPILER_MSVC', 'COMPILER_MSVC32'] + if compiler.version >= 1900: + compiler.linkflags += ['legacy_stdio_definitions.lib'] else: compiler.defines += ['COMPILER_GCC'] diff --git a/core/AMBuilder b/core/AMBuilder index 7b25a9ce..8ab06ab6 100644 --- a/core/AMBuilder +++ b/core/AMBuilder @@ -80,6 +80,8 @@ for sdk_name in SM.sdks: vs_year = '' if msvc_ver == 1800: vs_year = '2013' + elif msvc_ver == 1900: + vs_year = '2015' else: raise Exception('Cannot find libprotobuf for MSVC version "' + str(compiler.version) + '"') diff --git a/extensions/mysql/AMBuilder b/extensions/mysql/AMBuilder index 0551ef97..b99aa76c 100644 --- a/extensions/mysql/AMBuilder +++ b/extensions/mysql/AMBuilder @@ -28,6 +28,9 @@ if SM.mysql_root: 'wsock32.lib' ] + if binary.compiler.vendor == 'msvc' and binary.compiler.version >= 1900: + binary.compiler.linkflags += ['legacy_stdio_definitions.lib', 'legacy_stdio_wide_specifiers.lib'] + binary.sources += [ '../../public/smsdk_ext.cpp', 'mysql/MyBasicResults.cpp', diff --git a/public/sm_platform.h b/public/sm_platform.h index 4e64165c..95ecee60 100644 --- a/public/sm_platform.h +++ b/public/sm_platform.h @@ -44,7 +44,7 @@ #if !defined WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN #endif -#if !defined snprintf +#if !defined snprintf && defined _MSC_VER && _MSC_VER < 1900 #define snprintf _snprintf #endif #if !defined stat