ChrisPei / gyp

Automatically exported from code.google.com/p/gyp
0 stars 0 forks source link

Mixed C++ source file extension is not supported for Android target #348

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create project with both .cc and .cpp files as sources
2. Generate Makefiles for Android native application
3. Try to compile the project

What is the expected output? What do you see instead?
Expected: all C++ sources get compiled into the library
Instead: Only .cpp files get compiled. .cc files are ignored.

What version of the product are you using? On what operating system?
SVN revision 1645, Ubuntu Linux.

Please provide any additional information below.

{
  'targets': [
    {
      'target_name': 'testLib',
      'type': 'shared_library',
      'sources': [
        'first.cpp',
        'second.cc',
      ],
    },
  ],
}

It's easy to see in android.py (
http://code.google.com/p/gyp/source/browse/trunk/pylib/gyp/generator/android.py#
528 ) that the _first_ found C++ file extension automagically gets chosen as 
LOCAL_CPP_EXTENSION and only sources with matching extension get listed as 
LOCAL_SRC_FILES.

Although as mentioned here: 
http://stackoverflow.com/questions/6617224/c-extensions-in-android-mk-files , 
NDK >= r7 supports multiple values, eg:
LOCAL_CPP_EXTENSION := .cc .cpp .cxx

Considering this I suggest setting LOCAL_CPP_EXTENSION to all the extensions 
found in the sources list and listing all the sources into LOCAL_SRC_FILES.

Original issue reported on code.google.com by icqk...@gmail.com on 11 Jun 2013 at 6:36