Fix compilation on VS2013

This commit is contained in:
Scott Graham 2013-10-17 21:12:11 -07:00
parent 6f7ea464bb
commit a90b279e46
5 changed files with 16 additions and 2 deletions

View File

@ -125,6 +125,8 @@ if platform.is_msvc():
'/DNOMINMAX', '/D_CRT_SECURE_NO_WARNINGS',
'/D_VARIADIC_MAX=10',
'/DNINJA_PYTHON="%s"' % options.with_python]
if platform.msvc_needs_fs():
cflags.append('/FS')
ldflags = ['/DEBUG', '/libpath:$builddir']
if not options.debug:
cflags += ['/Ox', '/DNDEBUG', '/GL']

View File

@ -21,8 +21,8 @@ def platforms():
return ['linux', 'darwin', 'freebsd', 'openbsd', 'solaris', 'sunos5',
'mingw', 'msvc', 'gnukfreebsd8', 'bitrig']
class Platform( object ):
def __init__( self, platform):
class Platform(object):
def __init__(self, platform):
self._platform = platform
if not self._platform is None:
return
@ -56,6 +56,14 @@ class Platform( object ):
def is_msvc(self):
return self._platform == 'msvc'
def msvc_needs_fs(self):
import subprocess
popen = subprocess.Popen('cl /nologo /?',
stdout=subprocess.PIPE,
stderr=subprocess.PIPE)
out, err = popen.communicate()
return '/FS ' in out
def is_windows(self):
return self.is_mingw() or self.is_msvc()

View File

@ -14,6 +14,7 @@
#include "edit_distance.h"
#include <algorithm>
#include <vector>
int EditDistance(const StringPiece& s1,

View File

@ -15,6 +15,7 @@
#ifndef NINJA_MAP_H_
#define NINJA_MAP_H_
#include <algorithm>
#include <string.h>
#include "string_piece.h"

View File

@ -24,6 +24,8 @@
#include <windows.h>
#endif
#include <algorithm>
#include "util.h"
Metrics* g_metrics = NULL;