1 From e54832c051aa34708025f350e81d08bafd3025f7 Mon Sep 17 00:00:00 2001
2 From: Roger Zanoni <rzanoni@igalia.com>
3 Date: Thu, 30 Mar 2023 15:22:32 +0200
4 Subject: [PATCH 3/9] Add an option to use an alternative base output directory
7 tools/gclient_hook.py | 19 +++++++++++++++++--
8 1 file changed, 17 insertions(+), 2 deletions(-)
10 diff --git a/tools/gclient_hook.py b/tools/gclient_hook.py
11 index c525984e3..3d4375ec0 100644
12 --- a/tools/gclient_hook.py
13 +++ b/tools/gclient_hook.py
15 from __future__ import absolute_import
16 from __future__ import print_function
17 from file_util import make_dir, write_file
18 +from optparse import OptionParser
19 from gclient_util import *
20 from gn_args import GetAllPlatformConfigs, GetConfigFileContents
25 +parser = OptionParser()
31 + help="Use an anternative base path for the generated gn outputs instead of using chromium source dir")
33 +(options, args) = parser.parse_args()
35 # The CEF directory is the parent directory of _this_ script.
36 cef_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
37 # The src directory is the parent directory of the CEF directory.
38 @@ -136,14 +147,18 @@ if platform == 'windows':
39 configs = GetAllPlatformConfigs(gn_args)
40 for dir, config in configs.items():
41 # Create out directories and write the args.gn file.
42 - out_path = os.path.join(src_dir, 'out', dir)
43 + base_out_dir = src_dir
44 + if options.baseoutpath != '':
45 + base_out_dir = options.baseoutpath
46 + out_path = os.path.join(base_out_dir, 'out', dir)
47 make_dir(out_path, False)
48 args_gn_path = os.path.join(out_path, 'args.gn')
49 args_gn_contents = GetConfigFileContents(config)
50 write_file(args_gn_path, args_gn_contents)
52 # Generate the Ninja config.
53 - cmd = ['gn', 'gen', os.path.join('out', dir)]
54 + cmd = ['gn', 'gen', os.path.join('out', out_path)]
56 if 'GN_ARGUMENTS' in os.environ.keys():
57 cmd.extend(os.environ['GN_ARGUMENTS'].split(' '))
58 RunAction(src_dir, cmd)