Merge pull request #6609 from electron/msvs

Add --msvs parameter to bootstrap.py
This commit is contained in:
Cheng Zhao 2016-07-26 19:03:25 +09:00 committed by GitHub
commit 0cdd764161
3 changed files with 30 additions and 9 deletions

View file

@ -58,17 +58,25 @@ $ python script\build.py -c D
After building is done, you can find `electron.exe` under `out\D` (debug
target) or under `out\R` (release target).
## 64bit Build
## 32bit Build
To build for the 64bit target, you need to pass `--target_arch=x64` when running
the bootstrap script:
To build for the 32bit target, you need to pass `--target_arch=ia32` when
running the bootstrap script:
```powershell
$ python script\bootstrap.py -v --target_arch=x64
$ python script\bootstrap.py -v --target_arch=ia32
```
The other building steps are exactly the same.
## Visual Studio project
To generate a Visual Studio project, you can pass the `--msvs` parameter:
```powershell
$ python script\bootstrap.py --msvs
```
## Tests
Test your changes conform to the project coding style using:

View file

@ -65,7 +65,7 @@ def main():
create_chrome_version_h()
touch_config_gypi()
run_update(defines, args.disable_clang, args.clang_dir)
run_update(defines, args.msvs, args.disable_clang, args.clang_dir)
update_electron_modules('spec', args.target_arch)
@ -86,6 +86,8 @@ def parse_args():
action='store_true',
help='Run non-interactively by assuming "yes" to all ' \
'prompts.')
parser.add_argument('--msvs', action='store_true',
help='Generate Visual Studio project')
parser.add_argument('--target_arch', default=get_target_arch(),
help='Manually specify the arch to build for')
parser.add_argument('--clang_dir', default='', help='Path to clang binaries')
@ -249,14 +251,19 @@ def touch_config_gypi():
f.write(content)
def run_update(defines, disable_clang, clang_dir):
def run_update(defines, msvs, disable_clang, clang_dir):
env = os.environ.copy()
if not disable_clang and clang_dir == '':
# Build with prebuilt clang.
set_clang_env(env)
update = os.path.join(SOURCE_ROOT, 'script', 'update.py')
execute_stdout([sys.executable, update, '--defines', defines], env)
args = [sys.executable, os.path.join(SOURCE_ROOT, 'script', 'update.py')]
if defines:
args += ['--defines', defines]
if msvs:
args += ['--msvs']
execute_stdout(args, env)
if __name__ == '__main__':

View file

@ -28,6 +28,8 @@ def parse_args():
parser = argparse.ArgumentParser(description='Update build configurations')
parser.add_argument('--defines', default='',
help='The definetions passed to gyp')
parser.add_argument('--msvs', action='store_true',
help='Generate Visual Studio project')
return parser.parse_args()
@ -86,7 +88,11 @@ def run_gyp(target_arch, component):
if define:
defines += ['-D' + define]
return subprocess.call([python, gyp, '-f', 'ninja', '--depth', '.',
generator = 'ninja'
if args.msvs:
generator = 'msvs-ninja'
return subprocess.call([python, gyp, '-f', generator, '--depth', '.',
'electron.gyp', '-Icommon.gypi'] + defines, env=env)