Skip to content

Commit 48b7671

Browse files
committed
tools,build: add PRODUCT_DIR_ABS default gyp var
This commit adds a default variable named PRODUCT_DIR_ABS which contains the absolute path to the configured output and buildtype (Release/Debug) directory. The motivation for adding this instead of using PRODUCT_DIR is that the value of PRODUCT_DIR is a ${builddir} variable which is fine in most situations. The use case we ran into was where we wanted to add a defines for OpenSSL 3.0 MODULESDIR macro. I this case we want the value would ${builddir} would be escaped into $${builddir} which would not be resolved when passed with -DMODULEDIR, so the actual value would contains the variable ${buildtype} instread of an actual path.
1 parent 4e9cc86 commit 48b7671

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

configure.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1986,7 +1986,8 @@ def make_bin_override():
19861986

19871987

19881988

1989-
gyp_args = ['--no-parallel', '-Dconfiguring_node=1']
1989+
gyp_args = ['--no-parallel', '-Dconfiguring_node=1',
1990+
'-Dbuildtype=' + output['target_defaults']['default_configuration']];
19901991

19911992
if options.use_ninja:
19921993
gyp_args += ['-f', 'ninja']

tools/gyp/pylib/gyp/__init__.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,10 @@ def Load(
103103
for (key, val) in generator.generator_default_variables.items():
104104
default_variables.setdefault(key, val)
105105

106+
output_dir = params["options"].generator_output or params["options"].toplevel_dir
107+
default_variables.setdefault("PRODUCT_DIR_ABS", os.path.join(output_dir,
108+
default_variables['buildtype']))
109+
106110
# Give the generator the opportunity to set additional variables based on
107111
# the params it will receive in the output phase.
108112
if getattr(generator, "CalculateVariables", None):

tools/gyp/pylib/gyp/generator/make.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,6 @@ def CalculateVariables(default_variables, params):
104104
default_variables.setdefault("SHARED_LIB_DIR", "$(builddir)/lib.$(TOOLSET)")
105105
default_variables.setdefault("LIB_DIR", "$(obj).$(TOOLSET)")
106106

107-
108107
def CalculateGeneratorInputInfo(params):
109108
"""Calculate the generator specific info that gets fed to input (called by
110109
gyp)."""

0 commit comments

Comments
 (0)