electron/brightray/script/build

40 lines
1.1 KiB
Text
Raw Normal View History

#!/usr/bin/env python
2013-03-13 19:12:05 +00:00
import os
import subprocess
import sys
2013-03-13 19:12:05 +00:00
SOURCE_ROOT = os.path.abspath(os.path.dirname(os.path.dirname(__file__)))
GYP = os.path.join(SOURCE_ROOT, 'vendor', 'gyp', 'gyp_main.py')
2013-05-14 17:29:35 +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():
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', '')])
return subprocess.call([sys.executable, GYP, '--depth', '.',
'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
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'])
if __name__ == '__main__':
sys.exit(main())