Skip to content
Browse files

ninja windows: make sure that .s files aren't passed to compiler

R=thakis@chromium.org
BUG=125606

Review URL: https://chromiumcodereview.appspot.com/10270020

git-svn-id: http://gyp.googlecode.com/svn/trunk@1345 78cadc50-ecff-11dd-a971-7dbc132099af
  • Loading branch information...
1 parent 891e8ab commit 30fc7a83b548f5a4bb11a20d01fc49bc0a28e325 scottmg@chromium.org committed
View
6 pylib/gyp/generator/ninja.py
@@ -716,7 +716,11 @@ def WriteSources(self, config_name, config, sources, predepends,
obj_ext = self.obj_ext
if ext in ('cc', 'cpp', 'cxx'):
command = 'cxx'
- elif ext in ('c', 's', 'S'):
+ elif ext == 'c' or (ext in ('s', 'S') and self.flavor != 'win'):
+ # TODO(scottmg): .s files won't be handled by the Windows compiler.
+ # We could add support for .asm, though that's only supported on
+ # x86. Currently not used in Chromium in favor of other third-party
+ # assemblers.
command = 'cc'
elif self.flavor == 'mac' and ext == 'm':
command = 'objc'
View
17 test/win/asm-files/asm-files.gyp
@@ -0,0 +1,17 @@
+# Copyright (c) 2012 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+{
+ 'targets': [
+ {
+ 'target_name': 'sources_with_asm',
+ 'type': 'executable',
+ 'sources': [
+ 'hello.cc',
+ 'b.s',
+ 'c.S',
+ ],
+ },
+ ]
+}
View
0 test/win/asm-files/b.s
No changes.
View
0 test/win/asm-files/c.S
No changes.
View
7 test/win/asm-files/hello.cc
@@ -0,0 +1,7 @@
+// Copyright (c) 2012 Google Inc. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+int main() {
+ return 0;
+}
View
26 test/win/gyptest-asm-files.py
@@ -0,0 +1,26 @@
+#!/usr/bin/env python
+
+# Copyright (c) 2012 Google Inc. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+"""
+Make sure .s files aren't passed to cl.
+"""
+
+import TestGyp
+
+import sys
+
+if sys.platform == 'win32':
+ test = TestGyp.TestGyp(formats=['msvs', 'ninja'])
+
+ CHDIR = 'asm-files'
+ test.run_gyp('asm-files.gyp', chdir=CHDIR)
+ # The compiler will error out if it's passed the .s files, so just make sure
+ # the build succeeds. The compiler doesn't directly support building
+ # assembler files on Windows, they have to be built explicitly with a
+ # third-party tool.
+ test.build('asm-files.gyp', test.ALL, chdir=CHDIR)
+
+ test.pass_test()

0 comments on commit 30fc7a8

Please sign in to comment.
Something went wrong with that request. Please try again.