Use abusolute path when linking to external libraries. Fixes #22.

The ninja generator of gyp behaves strangely on the 'libraries' field of link
settings, for example, specifying path to an external library works well on
both xcodebuild and msvc generators, but the ninja generator would link to
the wrong path (it can neither translate relative path correctly, nor convert
the command line parameter to the '-lxxx' form).

The only way to make all generators work on all platforms is to use abusolute
paths for external libraries.
This commit is contained in:
Cheng Zhao 2013-07-02 15:12:34 +08:00
parent 3d00cded27
commit 5e807cffc8
2 changed files with 16 additions and 4 deletions

View file

@ -2,6 +2,9 @@
'includes': [
'brightray.gypi',
],
'variables': {
'brightray_source_root': '<!(python tools/brightray_source_root.py)',
},
'targets': [
{
'target_name': 'brightray',
@ -70,7 +73,7 @@
['OS=="mac"', {
'link_settings': {
'libraries': [
'libchromiumcontent.dylib',
'<(brightray_source_root)/<(libchromiumcontent_library_dir)/libchromiumcontent.dylib',
'$(SDKROOT)/System/Library/Frameworks/AppKit.framework',
],
},
@ -78,9 +81,9 @@
['OS=="win"', {
'link_settings': {
'libraries': [
'<(libchromiumcontent_library_dir)/base_static.lib',
'<(libchromiumcontent_library_dir)/chromiumcontent.dll.lib',
'<(libchromiumcontent_library_dir)/sandbox_static.lib',
'<(brightray_source_root)/<(libchromiumcontent_library_dir)/base_static.lib',
'<(brightray_source_root)/<(libchromiumcontent_library_dir)/chromiumcontent.dll.lib',
'<(brightray_source_root)/<(libchromiumcontent_library_dir)/sandbox_static.lib',
],
},
}],

View file

@ -0,0 +1,9 @@
#!/usr/bin/env python
import os
"""Prints the absolute path of the root of brightray's source tree.
"""
print os.path.abspath(os.path.dirname(os.path.dirname(__file__)))