From 0db30f237ccc66a4fdf19d88666fc1f7e415a562 Mon Sep 17 00:00:00 2001 From: ikifof <38361739+ikifof@users.noreply.github.com> Date: Wed, 7 Nov 2018 02:32:29 -0800 Subject: Fix older VS compatibility issues and PDB files generation issue. (#1435) Fixes #1411. --- configure.py | 23 +++++++++++++++-------- src/build_log.cc | 3 +++ src/deps_log.cc | 3 +++ 3 files changed, 21 insertions(+), 8 deletions(-) diff --git a/configure.py b/configure.py index cfe27f2..78cd1de 100755 --- a/configure.py +++ b/configure.py @@ -414,7 +414,7 @@ n.newline() if platform.is_msvc(): n.rule('cxx', - command='$cxx $cflags -c $in /Fo$out', + command='$cxx $cflags -c $in /Fo$out /Fd' + built('$pdb'), description='CXX $out', deps='msvc' # /showIncludes is included in $cflags. ) @@ -485,6 +485,9 @@ else: n.newline() n.comment('Core source files all build into ninja library.') +cxxvariables = [] +if platform.is_msvc(): + cxxvariables = [('pdb', 'ninja.pdb')] for name in ['build', 'build_log', 'clean', @@ -505,15 +508,15 @@ for name in ['build', 'string_piece_util', 'util', 'version']: - objs += cxx(name) + objs += cxx(name, variables=cxxvariables) if platform.is_windows(): for name in ['subprocess-win32', 'includes_normalize-win32', 'msvc_helper-win32', 'msvc_helper_main-win32']: - objs += cxx(name) + objs += cxx(name, variables=cxxvariables) if platform.is_msvc(): - objs += cxx('minidump-win32') + objs += cxx('minidump-win32', variables=cxxvariables) objs += cc('getopt') else: objs += cxx('subprocess-posix') @@ -536,7 +539,7 @@ if platform.is_aix(): all_targets = [] n.comment('Main executable is library plus main() function.') -objs = cxx('ninja') +objs = cxx('ninja', variables=cxxvariables) ninja = n.build(binary('ninja'), 'link', objs, implicit=ninja_lib, variables=[('libs', libs)]) n.newline() @@ -551,6 +554,8 @@ if options.bootstrap: n.comment('Tests all build into ninja_test executable.') objs = [] +if platform.is_msvc(): + cxxvariables = [('pdb', 'ninja_test.pdb')] for name in ['build_log_test', 'build_test', @@ -569,10 +574,10 @@ for name in ['build_log_test', 'subprocess_test', 'test', 'util_test']: - objs += cxx(name) + objs += cxx(name, variables=cxxvariables) if platform.is_windows(): for name in ['includes_normalize_test', 'msvc_helper_test']: - objs += cxx(name) + objs += cxx(name, variables=cxxvariables) ninja_test = n.build(binary('ninja_test'), 'link', objs, implicit=ninja_lib, variables=[('libs', libs)]) @@ -588,7 +593,9 @@ for name in ['build_log_perftest', 'hash_collision_bench', 'manifest_parser_perftest', 'clparser_perftest']: - objs = cxx(name) + if platform.is_msvc(): + cxxvariables = [('pdb', name + '.pdb')] + objs = cxx(name, variables=cxxvariables) all_targets += n.build(binary(name), 'link', objs, implicit=ninja_lib, variables=[('libs', libs)]) diff --git a/src/build_log.cc b/src/build_log.cc index 2a65f9d..c4a08a0 100644 --- a/src/build_log.cc +++ b/src/build_log.cc @@ -35,6 +35,9 @@ #include "graph.h" #include "metrics.h" #include "util.h" +#if defined(_MSC_VER) && (_MSC_VER < 1800) +#define strtoll _strtoi64 +#endif // Implementation details: // Each run's log appends to the log file. diff --git a/src/deps_log.cc b/src/deps_log.cc index eb81a37..0bb96f3 100644 --- a/src/deps_log.cc +++ b/src/deps_log.cc @@ -20,6 +20,9 @@ #include #ifndef _WIN32 #include +#elif defined(_MSC_VER) && (_MSC_VER < 1900) +typedef __int32 int32_t; +typedef unsigned __int32 uint32_t; #endif #include "graph.h" -- cgit v0.12