2013-05-13 22:55:10 +00:00
|
|
|
#!/usr/bin/env python
|
2013-03-13 19:12:05 +00:00
|
|
|
|
2013-05-13 22:55:10 +00:00
|
|
|
import os
|
|
|
|
import subprocess
|
2013-05-14 15:21:03 +00:00
|
|
|
import sys
|
2013-03-13 19:12:05 +00:00
|
|
|
|
|
|
|
|
2013-05-13 22:55:10 +00:00
|
|
|
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
|
2013-08-23 11:48:37 +00:00
|
|
|
GYP = os.path.join(SOURCE_ROOT, 'vendor', 'gyp', 'gyp_main.py')
|
2013-05-13 22:55:10 +00:00
|
|
|
|
2013-05-14 17:29:35 +00:00
|
|
|
|
2013-05-13 22:55:10 +00:00
|
|
|
def main():
|
|
|
|
os.chdir(SOURCE_ROOT)
|
2013-08-06 21:25:07 +00:00
|
|
|
return (run_gyp() or build())
|
2013-05-14 17:29:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
def run_gyp():
|
2014-07-07 18:40:22 +00:00
|
|
|
env = os.environ.copy()
|
|
|
|
gyp_pylib = os.path.join(os.path.dirname(GYP), 'pylib')
|
|
|
|
env['PYTHONPATH'] = os.path.pathsep.join([gyp_pylib,
|
|
|
|
env.get('PYTHONPATH', '')])
|
2015-04-11 05:43:02 +00:00
|
|
|
env['GYP_DEFINES'] = 'libchromiumcontent_component=static_library'
|
2014-07-07 18:40:22 +00:00
|
|
|
return subprocess.call([sys.executable, GYP, '--depth', '.',
|
2015-04-11 05:43:02 +00:00
|
|
|
'-Ibrightray.gypi', 'brightray.gyp'], env=env)
|
2013-05-14 17:29:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
def build():
|
|
|
|
if sys.platform == 'darwin':
|
2013-08-06 21:25:07 +00:00
|
|
|
return subprocess.call(['xcodebuild'])
|
|
|
|
if sys.platform == 'linux2':
|
|
|
|
return subprocess.call(['make'])
|
2013-05-14 17:29:35 +00:00
|
|
|
|
|
|
|
assert sys.platform == 'win32', sys.platform
|
2014-06-27 16:06:13 +00:00
|
|
|
program_files = os.environ.get('PROGRAMFILES(X86)', os.environ['PROGRAMFILES'])
|
|
|
|
msbuild = os.path.join(program_files, 'MSBuild', '12.0', 'Bin', 'MSBuild.exe')
|
2013-08-06 21:25:07 +00:00
|
|
|
return subprocess.call([msbuild, 'brightray.sln'])
|
2013-05-13 22:55:10 +00:00
|
|
|
|
|
|
|
|
|
|
|
if __name__ == '__main__':
|
|
|
|
sys.exit(main())
|