Skip to content

Commit

Permalink
bootstrap: make --windows usable for cl.exe-on-wine
Browse files Browse the repository at this point in the history
  • Loading branch information
evmar committed Apr 11, 2013
1 parent 4497d0f commit 368f5bc
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions bootstrap.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
help='force 64-bit build (Windows)',)
# TODO: make this --platform to match configure.py.
parser.add_option('--windows', action='store_true',
help='force native Windows build (when using Cygwin Python)',
help='force native Windows build',
default=sys.platform.startswith('win32'))
(options, conf_args) = parser.parse_args()

Expand Down Expand Up @@ -82,15 +82,17 @@ def run(*args, **kwargs):
if options.windows:
sources.append('src/getopt.c')

vcdir = os.environ.get('VCINSTALLDIR')
if vcdir:
if options.x64:
cl = [os.path.join(vcdir, 'bin', 'x86_amd64', 'cl.exe')]
if not os.path.exists(cl[0]):
cl = [os.path.join(vcdir, 'bin', 'amd64', 'cl.exe')]
else:
cl = [os.path.join(vcdir, 'bin', 'cl.exe')]
args = cl + ['/nologo', '/EHsc', '/DNOMINMAX']
if options.windows:
cl = 'cl'
vcdir = os.environ.get('VCINSTALLDIR')
if vcdir:
if options.x64:
cl = os.path.join(vcdir, 'bin', 'x86_amd64', 'cl.exe')
if not os.path.exists(cl):
cl = os.path.join(vcdir, 'bin', 'amd64', 'cl.exe')
else:
cl = os.path.join(vcdir, 'bin', 'cl.exe')
args = [cl, '/nologo', '/EHsc', '/DNOMINMAX']
else:
args = shlex.split(os.environ.get('CXX', 'g++'))
cflags.extend(['-Wno-deprecated',
Expand All @@ -107,7 +109,7 @@ def run(*args, **kwargs):
if options.windows:
binary = 'ninja.bootstrap.exe'
args.extend(sources)
if vcdir:
if options.windows:
args.extend(['/link', '/out:' + binary])
else:
args.extend(['-o', binary])
Expand Down

0 comments on commit 368f5bc

Please sign in to comment.