hertzg / gyp

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

Error when a target of type 'none' has a 'sources' list #217

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
{ target_name: 'wtf',
 type: 'none',
 sources: ['a.c', 'b.c'],
}

Should be rejected.

Original issue reported on code.google.com by ev...@google.com on 12 Sep 2011 at 10:42

GoogleCodeExporter commented 9 years ago
This pattern is used in Chromium to work around Visual Studio stupidity with 
MIDL.

MIDL processes .idl files and in turn generates multiple files, by default into 
the <(INTERMEDIATE_DIR> ($(IntDir) on Windows)

$(InputName).h
$(InputName)_i.c - An IID file
$(InputName)_p.c - The Proxy File

Dependents typically need to include the .h, which defines the interfaces, 
GUIDS, etc.

However, the following results in an error, because no actual object files are 
produced.
{
  'target_name': 'generate_my_idl',
  'type': '(static|shared)_library',
  'sources': [
    'my_file.idl',
  ]
}

However, as currently implemented, the following works, allowing targets to 
depend on the common generated header. Because it is a 'none' target, Visual 
Studio does not complain, because it maps the type as a 'Utility' project
{
  'target_name': 'generate_my_idl',
  'type': 'none',
  'sources': [
    'my_file.idl',
  ]
}

The reason IDL files are somewhat special is that they like normal 'rules', 
except Visual Studio has a built-in handler for it, with options/configuration 
in the IDE, and gyp knows this.

For a more concrete example, see 
http://src.chromium.org/viewvc/chrome/trunk/src/chrome_frame/chrome_frame.gyp?an
notate=99949#l60

Original comment by rsleevi@chromium.org on 20 Sep 2011 at 3:26