Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
build,tools: there are 2 out dirs on windows
  • Loading branch information
zcbenz committed Feb 23, 2024
commit da69fba975a12ed66d3a532078496f88cb466289
18 changes: 17 additions & 1 deletion tools/build_addons.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,19 @@ def node_gyp_rebuild(test_dir):
with ThreadPoolExecutor() as executor:
executor.map(node_gyp_rebuild, test_dirs)

def get_default_out_dir(args):
default_out_dir = os.path.join('out', 'Release')
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'.
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?')

def main():
if sys.platform == 'cygwin':
raise RuntimeError('This script does not support running with cygwin python.')
Expand All @@ -100,7 +113,7 @@ def main():
'new headers will be generated for building',
default=None)
parser.add_argument('--out-dir', help='path to the output directory',
default='out/Release')
default=None)
parser.add_argument('--loglevel', help='loglevel of node-gyp',
default='silent')
parser.add_argument('--skip-tests', help='skip building tests',
Expand All @@ -113,6 +126,9 @@ def main():
action='store_true', default=(sys.platform == 'win32'))
args, unknown_args = parser.parse_known_args()

if not args.out_dir:
args.out_dir = get_default_out_dir(args)

if args.headers_dir:
rebuild_addons(args)
else:
Expand Down