| OLD | NEW |
| (Empty) |
| 1 @echo off | |
| 2 | |
| 3 :: Copyright (c) 2012 Google Inc. All rights reserved. | |
| 4 :: Use of this source code is governed by a BSD-style license that can be | |
| 5 :: found in the LICENSE file. | |
| 6 | |
| 7 setlocal enabledelayedexpansion | |
| 8 | |
| 9 :: Parse args to see if a -C argument (to change working directory) is being | |
| 10 :: supplied. We expect project generation to output a set_environment.bat that | |
| 11 :: will set up the environment (variables and path). This script generally | |
| 12 :: just calls the correct VS vars batch file, but only gyp has the knowledge | |
| 13 :: to determine which version of the IDE/toolchain it wants to use, so we have | |
| 14 :: to defer to it to make that decision. | |
| 15 set found_dash_c=0 | |
| 16 set cd_path=. | |
| 17 for %%A in (%*) do ( | |
| 18 if "!found_dash_c!"=="1" ( | |
| 19 set cd_path=%%A | |
| 20 goto done_dash_c | |
| 21 ) | |
| 22 if "%%A"=="-C" ( | |
| 23 set found_dash_c=1 | |
| 24 ) | |
| 25 ) | |
| 26 :done_dash_c | |
| 27 | |
| 28 :: Try running the compiler. If it fails, then we assume we need to set up the | |
| 29 :: environment for the compiler. | |
| 30 :: TODO(scottmg): We should also try to detect if we have the right version | |
| 31 :: of the compiler too (i.e. If generation specified 2010, but we're running | |
| 32 :: from a 2008 command prompt). | |
| 33 cl 2>nul >nul | |
| 34 if not errorlevel 1 goto no_set_env | |
| 35 | |
| 36 if not exist "%cd_path%\set_environment.bat" ( | |
| 37 echo ninja.bat: set_environment.bat not found in '%cd_path%'. Is -C arg correc
t? | |
| 38 goto :EOF | |
| 39 ) | |
| 40 call "%cd_path%\set_environment.bat" | |
| 41 | |
| 42 :: Export only the path changes out of the script. | |
| 43 endlocal & set PATH=%PATH% & set INCLUDE=%INCLUDE% & set LIBPATH=%LIBPATH% & set
LIB=%LIB% | |
| 44 | |
| 45 :: To pair with below when we don't skip this block. | |
| 46 setlocal | |
| 47 | |
| 48 :: Add python to the path, many gyp rules assume it's there. | |
| 49 :: Add ninja directory to the path (to find ninja and ninja-deplist-helper). | |
| 50 :: Put it at the front so that ninja.exe is found before this wrapper so that | |
| 51 :: next time we just run it directly (otherwise, this script adds 500-800ms to | |
| 52 :: ninja invocations). | |
| 53 :no_set_env | |
| 54 endlocal & set PATH=%~dp0python_bin;%~dp0ninja-win;%PATH% | |
| 55 | |
| 56 :: Now run the actual build. | |
| 57 ninja.exe %* | |
| OLD | NEW |