@@ -38,7 +38,7 @@ def rebuild_addons(args):
3838
3939 # Copy node.lib.
4040 if args .is_win :
41- node_lib_dir = os .path .join (headers_dir , 'Release' )
41+ node_lib_dir = os .path .join (headers_dir , args . config )
4242 os .makedirs (node_lib_dir )
4343 shutil .copy2 (os .path .join (args .out_dir , 'node.lib' ),
4444 os .path .join (node_lib_dir , 'node.lib' ))
@@ -89,17 +89,17 @@ def node_gyp_rebuild(test_dir):
8989 executor .map (node_gyp_rebuild , test_dirs )
9090
9191def get_default_out_dir (args ):
92- default_out_dir = os .path .join ('out' , 'Release' )
92+ default_out_dir = os .path .join ('out' , args . config )
9393 if not args .is_win :
9494 # POSIX platforms only have one out dir.
9595 return default_out_dir
9696 # On Windows depending on the args of GYP and configure script, the out dir
97- # could be 'out/Release' or just 'Release'.
97+ # could be 'out/Release', 'out/Debug' or just 'Release' or 'Debug '.
9898 if os .path .exists (default_out_dir ):
9999 return default_out_dir
100- if os .path .exists ('Release' ):
101- return 'Release'
102- raise RuntimeError ('Can not find out dir, did you run configure ?' )
100+ if os .path .exists (args . config ):
101+ return args . config
102+ raise RuntimeError ('Cannot find out dir, did you run build ?' )
103103
104104def main ():
105105 if sys .platform == 'cygwin' :
@@ -124,6 +124,8 @@ def main():
124124 default = 'deps/npm/node_modules/node-gyp/bin/node-gyp.js' )
125125 parser .add_argument ('--is-win' , help = 'build for Windows target' ,
126126 action = 'store_true' , default = (sys .platform == 'win32' ))
127+ parser .add_argument ('--config' , help = 'build config (Release or Debug)' ,
128+ default = 'Release' )
127129 args , unknown_args = parser .parse_known_args ()
128130
129131 if not args .out_dir :
0 commit comments