ChrisPei / gyp

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

MSVS generator creates invalid library paths when using --generator-output #306

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. In some folder named "A", create test.gyp, which has 'libraries' pointing to 
"libs/test.lib".
2. In "A", create a folder called "B". Then create a MSVC project using 
--generator-output=B.
3. Open the generated project. Right-click in the solution explorer, and click 
"Properties". Then go to Configuration Properties -> Linker -> Input and notice 
that in "Additional Dependencies", it says "libs/test.lib" instead of the 
correct adjusted path, "../libs/test.lib".

What is the expected output? What do you see instead?
The path should be adjusted to be the correct relative path to test.lib from 
"B".

What version of the product are you using? On what operating system?
SVN revision 1533 on Windows 7 x64.

Please provide any additional information below.
I think the fix is pretty simple. On line 1133 of generator/msvs.py:
- return unique_libraries_libs
+ return _FixPaths(unique_libraries_list)

Original issue reported on code.google.com by awishn...@izotope.com on 14 Nov 2012 at 8:19

GoogleCodeExporter commented 9 years ago
The suggested solution "return _FixPaths(unique_libraries_list)" doesn't work 
well if you reference system libraries (e.g., '-lOpenGL32.lib') because it 
tries prepends relative path info to the system lib (e.g., 'can't find 
../OpenGL32.lib'). What I've done to address this is _FixPath on anything that 
doesn't start with '-l'

#if library starts with -l strip it and make no adjustment, otherwise adjust 
the path
    if re.match('-l', entry):
      library = re.sub('^\-l', '', entry)
    else:
      library = re.sub('^\-l', '', _FixPath(entry))

Original comment by mark.mac...@gmail.com on 18 Mar 2014 at 11:53