2011-12-21 07:03:32 +01:00
|
|
|
#!/usr/bin/env python
|
|
|
|
import os
|
|
|
|
import sys
|
|
|
|
|
|
|
|
script_dir = os.path.dirname(__file__)
|
2012-02-26 22:23:42 +01:00
|
|
|
node_root = os.path.abspath(os.path.join(script_dir, os.pardir))
|
2012-03-05 21:38:31 +01:00
|
|
|
module_root = os.getcwd()
|
2012-02-26 22:23:42 +01:00
|
|
|
if sys.platform == 'win32':
|
2012-03-05 21:38:31 +01:00
|
|
|
output_dir = os.path.join(module_root, 'build')
|
2012-02-26 22:23:42 +01:00
|
|
|
else:
|
2012-02-27 22:54:30 +01:00
|
|
|
output_dir = 'build'
|
2011-12-21 07:03:32 +01:00
|
|
|
|
2012-01-16 23:06:55 +01:00
|
|
|
sys.path.insert(0, os.path.join(node_root, 'tools', 'gyp', 'pylib'))
|
2011-12-21 07:03:32 +01:00
|
|
|
import gyp
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
args = sys.argv[1:]
|
2012-01-16 23:06:55 +01:00
|
|
|
addon_gypi = os.path.join(node_root, 'tools', 'addon.gypi')
|
|
|
|
common_gypi = os.path.join(node_root, 'common.gypi')
|
2012-01-18 10:37:02 +01:00
|
|
|
config_gypi = os.path.join(node_root, 'config.gypi')
|
2011-12-21 07:03:32 +01:00
|
|
|
args.extend(['-I', addon_gypi])
|
|
|
|
args.extend(['-I', common_gypi])
|
2012-01-18 11:18:13 +01:00
|
|
|
if os.path.exists(config_gypi):
|
|
|
|
args.extend(['-I', config_gypi])
|
2011-12-21 07:03:32 +01:00
|
|
|
args.extend(['-Dlibrary=shared_library'])
|
|
|
|
args.extend(['-Dvisibility=default'])
|
2012-01-07 00:48:23 +01:00
|
|
|
args.extend(['-Dnode_root_dir=%s' % node_root])
|
2012-03-05 21:38:31 +01:00
|
|
|
args.extend(['-Dmodule_root_dir=%s' % module_root])
|
2011-12-21 07:03:32 +01:00
|
|
|
args.extend(['--depth=.']);
|
|
|
|
|
2012-02-26 22:23:42 +01:00
|
|
|
# Tell gyp to write the Makefile/Solution files into output_dir
|
|
|
|
args.extend(['--generator-output', output_dir])
|
|
|
|
|
|
|
|
# Tell make to write its output into the same dir
|
|
|
|
args.extend(['-Goutput_dir=.'])
|
|
|
|
|
2011-12-21 07:03:32 +01:00
|
|
|
gyp_args = list(args)
|
|
|
|
rc = gyp.main(gyp_args)
|
|
|
|
if rc != 0:
|
|
|
|
print 'Error running GYP'
|
|
|
|
sys.exit(rc)
|
|
|
|
|