diff --git a/tools/build_addons.py b/tools/build_addons.py index 8e445be5116c62..db948ba7b908e8 100755 --- a/tools/build_addons.py +++ b/tools/build_addons.py @@ -38,7 +38,7 @@ def rebuild_addons(args): # Copy node.lib. if args.is_win: - node_lib_dir = os.path.join(headers_dir, 'Release') + node_lib_dir = os.path.join(headers_dir, args.config) os.makedirs(node_lib_dir) shutil.copy2(os.path.join(args.out_dir, 'node.lib'), os.path.join(node_lib_dir, 'node.lib')) @@ -89,17 +89,17 @@ def node_gyp_rebuild(test_dir): executor.map(node_gyp_rebuild, test_dirs) def get_default_out_dir(args): - default_out_dir = os.path.join('out', 'Release') + default_out_dir = os.path.join('out', args.config) if not args.is_win: # POSIX platforms only have one out dir. return default_out_dir # On Windows depending on the args of GYP and configure script, the out dir - # could be 'out/Release' or just 'Release'. + # could be 'out/Release', 'out/Debug' or just 'Release' or 'Debug'. if os.path.exists(default_out_dir): return default_out_dir - if os.path.exists('Release'): - return 'Release' - raise RuntimeError('Can not find out dir, did you run configure?') + if os.path.exists(args.config): + return args.config + raise RuntimeError('Cannot find out dir, did you run build?') def main(): if sys.platform == 'cygwin': @@ -124,6 +124,8 @@ def main(): default='deps/npm/node_modules/node-gyp/bin/node-gyp.js') parser.add_argument('--is-win', help='build for Windows target', action='store_true', default=(sys.platform == 'win32')) + parser.add_argument('--config', help='build config (Release or Debug)', + default='Release') args, unknown_args = parser.parse_known_args() if not args.out_dir: diff --git a/vcbuild.bat b/vcbuild.bat index b0648bc6e08f50..98e59228e2f932 100644 --- a/vcbuild.bat +++ b/vcbuild.bat @@ -607,7 +607,7 @@ for /d %%F in (test\addons\??_*) do ( if %errorlevel% neq 0 exit /b %errorlevel% :: building addons setlocal -python "%~dp0tools\build_addons.py" "%~dp0test\addons" +python "%~dp0tools\build_addons.py" "%~dp0test\addons" --config %config% if errorlevel 1 exit /b 1 endlocal @@ -624,7 +624,7 @@ for /d %%F in (test\js-native-api\??_*) do ( ) :: building js-native-api setlocal -python "%~dp0tools\build_addons.py" "%~dp0test\js-native-api" +python "%~dp0tools\build_addons.py" "%~dp0test\js-native-api" --config %config% if errorlevel 1 exit /b 1 endlocal goto build-node-api-tests @@ -642,7 +642,7 @@ for /d %%F in (test\node-api\??_*) do ( ) :: building node-api setlocal -python "%~dp0tools\build_addons.py" "%~dp0test\node-api" +python "%~dp0tools\build_addons.py" "%~dp0test\node-api" --config %config% if errorlevel 1 exit /b 1 endlocal goto run-tests