Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix older VS compatibility issues and PDB files generation issue. #1435

Merged
merged 7 commits into from
Nov 7, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions configure.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,7 @@ def shell_escape(str):

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.
)
Expand Down Expand Up @@ -485,6 +485,9 @@ def has_re2c():
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',
Expand All @@ -505,15 +508,15 @@ def has_re2c():
'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')
Expand All @@ -536,7 +539,7 @@ def has_re2c():
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()
Expand All @@ -551,6 +554,8 @@ def has_re2c():
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',
Expand All @@ -569,10 +574,10 @@ def has_re2c():
'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)])
Expand All @@ -588,7 +593,9 @@ def has_re2c():
'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)])

Expand Down
3 changes: 3 additions & 0 deletions src/build_log.cc
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@
#include "graph.h"
#include "metrics.h"
#include "util.h"
#if defined(_MSC_VER) && (_MSC_VER < 1800)
#define strtoll _strtoi64
ikifof marked this conversation as resolved.
Show resolved Hide resolved
#endif

// Implementation details:
// Each run's log appends to the log file.
Expand Down
3 changes: 3 additions & 0 deletions src/deps_log.cc
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
#include <string.h>
#ifndef _WIN32
#include <unistd.h>
#elif defined(_MSC_VER) && (_MSC_VER < 1900)
typedef __int32 int32_t;
typedef unsigned __int32 uint32_t;
#endif

#include "graph.h"
Expand Down