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 After building is done, you can find `electron.exe` under `out\D` (debug
target) or under `out\R` (release target). 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 To build for the 32bit target, you need to pass `--target_arch=ia32` when
the bootstrap script: running the bootstrap script:
```powershell ```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. 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 ## Tests
Test your changes conform to the project coding style using: Test your changes conform to the project coding style using:

View file

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

View file

@ -28,6 +28,8 @@ def parse_args():
parser = argparse.ArgumentParser(description='Update build configurations') parser = argparse.ArgumentParser(description='Update build configurations')
parser.add_argument('--defines', default='', parser.add_argument('--defines', default='',
help='The definetions passed to gyp') help='The definetions passed to gyp')
parser.add_argument('--msvs', action='store_true',
help='Generate Visual Studio project')
return parser.parse_args() return parser.parse_args()
@ -86,7 +88,11 @@ def run_gyp(target_arch, component):
if define: if define:
defines += ['-D' + 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) 'electron.gyp', '-Icommon.gypi'] + defines, env=env)