1 From 33aa8b58d5c5d189dcd51d465f1d9d39c740146e 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 03/10] Add an option to use an alternative base output
8 tools/gclient_hook.py | 19 +++++++++++++++++--
9 1 file changed, 17 insertions(+), 2 deletions(-)
11 diff --git a/tools/gclient_hook.py b/tools/gclient_hook.py
12 index 290487433..4e5f9f687 100644
13 --- a/tools/gclient_hook.py
14 +++ b/tools/gclient_hook.py
16 from __future__ import absolute_import
17 from __future__ import print_function
18 from file_util import make_dir, write_file
19 +from optparse import OptionParser
20 from gclient_util import *
21 from gn_args import GetAllPlatformConfigs, GetConfigFileContents
26 +parser = OptionParser()
32 + help="Use an anternative base path for the generated gn outputs instead of using chromium source dir")
34 +(options, args) = parser.parse_args()
36 # The CEF directory is the parent directory of _this_ script.
37 cef_dir = os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir))
38 # The src directory is the parent directory of the CEF directory.
39 @@ -133,14 +144,18 @@ if platform == 'windows':
40 configs = GetAllPlatformConfigs(gn_args)
41 for dir, config in configs.items():
42 # Create out directories and write the args.gn file.
43 - out_path = os.path.join(src_dir, 'out', dir)
44 + base_out_dir = src_dir
45 + if options.baseoutpath != '':
46 + base_out_dir = options.baseoutpath
47 + out_path = os.path.join(base_out_dir, 'out', dir)
48 make_dir(out_path, False)
49 args_gn_path = os.path.join(out_path, 'args.gn')
50 args_gn_contents = GetConfigFileContents(config)
51 write_file(args_gn_path, args_gn_contents)
53 # Generate the Ninja config.
54 - cmd = ['gn', 'gen', os.path.join('out', dir)]
55 + cmd = ['gn', 'gen', os.path.join('out', out_path)]
57 if 'GN_ARGUMENTS' in os.environ.keys():
58 cmd.extend(os.environ['GN_ARGUMENTS'].split(' '))
59 RunAction(src_dir, cmd)