aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/main/java/com/google/devtools
diff options
context:
space:
mode:
authorGravatar lberki <lberki@google.com>2018-01-26 05:37:58 -0800
committerGravatar Copybara-Service <copybara-piper@google.com>2018-01-26 05:39:14 -0800
commitc026569c445a5b22903d17ea6691876c47059eba (patch)
treeae3245e8494733834dc77f6ab2fd346195235143 /src/main/java/com/google/devtools
parenta59e60e4fba191b8793254c38485f781f790a607 (diff)
Add a few options that tweak the host configuration to parallel those that do the same with the target one.
I'm not exactly happy at this development, but we already have a host of --host_* options so it's only incremental badness. Fixes #4484. RELNOTES: None. PiperOrigin-RevId: 183375817
Diffstat (limited to 'src/main/java/com/google/devtools')
-rw-r--r--src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java16
-rw-r--r--src/main/java/com/google/devtools/build/lib/rules/cpp/CppOptions.java24
2 files changed, 38 insertions, 2 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java b/src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java
index 3b54a8b17c..d5aa190596 100644
--- a/src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java
+++ b/src/main/java/com/google/devtools/build/lib/analysis/config/BuildConfiguration.java
@@ -604,10 +604,22 @@ public class BuildConfiguration implements BuildEvent {
category = "semantics", // Should this be "flags"?
documentationCategory = OptionDocumentationCategory.OUTPUT_PARAMETERS,
effectTags = { OptionEffectTag.AFFECTS_OUTPUTS, OptionEffectTag.ACTION_COMMAND_LINES },
- help = "Specify the mode the binary will be built in. " + "Values: 'fastbuild', 'dbg', 'opt'."
+ help = "Specify the mode the binary will be built in. Values: 'fastbuild', 'dbg', 'opt'."
)
public CompilationMode compilationMode;
+ @Option(
+ name = "host_compilation_mode",
+ converter = CompilationMode.Converter.class,
+ defaultValue = "opt",
+ category = "semantics", // Should this be "flags"?
+ documentationCategory = OptionDocumentationCategory.OUTPUT_PARAMETERS,
+ effectTags = { OptionEffectTag.AFFECTS_OUTPUTS, OptionEffectTag.ACTION_COMMAND_LINES },
+ help = "Specify the mode the tools used during the build will be built in. Values: "
+ + "'fastbuild', 'dbg', 'opt'."
+ )
+ public CompilationMode hostCompilationMode;
+
/**
* This option is used internally to set output directory name of the <i>host</i> configuration
* to a constant, so that the output files for the host are completely independent of those for
@@ -1066,7 +1078,7 @@ public class BuildConfiguration implements BuildEvent {
Options host = (Options) getDefault();
host.outputDirectoryName = "host";
- host.compilationMode = CompilationMode.OPT;
+ host.compilationMode = hostCompilationMode;
host.isHost = true;
host.configsMode = configsMode;
host.enableRunfiles = enableRunfiles;
diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppOptions.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppOptions.java
index 3d2a242318..77f846d645 100644
--- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppOptions.java
+++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppOptions.java
@@ -720,6 +720,28 @@ public class CppOptions extends FragmentOptions {
public List<String> hostCxxoptList;
@Option(
+ name = "host_conlyopt",
+ allowMultiple = true,
+ defaultValue = "",
+ category = "flags",
+ documentationCategory = OptionDocumentationCategory.OUTPUT_PARAMETERS,
+ effectTags = {OptionEffectTag.ACTION_COMMAND_LINES, OptionEffectTag.AFFECTS_OUTPUTS},
+ help = "Additional option to pass to gcc when compiling C source files for host tools."
+ )
+ public List<String> hostConlyoptList;
+
+ @Option(
+ name = "host_linkopt",
+ defaultValue = "",
+ category = "flags",
+ allowMultiple = true,
+ documentationCategory = OptionDocumentationCategory.OUTPUT_PARAMETERS,
+ effectTags = {OptionEffectTag.ACTION_COMMAND_LINES, OptionEffectTag.AFFECTS_OUTPUTS},
+ help = "Additional option to pass to gcc when linking host tools."
+ )
+ public List<String> hostLinkoptList;
+
+ @Option(
name = "grte_top",
defaultValue = "null", // The default value is chosen by the toolchain.
category = "version",
@@ -882,6 +904,8 @@ public class CppOptions extends FragmentOptions {
}
host.coptList = coptListBuilder.addAll(hostCoptList).build();
host.cxxoptList = cxxoptListBuilder.addAll(hostCxxoptList).build();
+ host.conlyoptList = ImmutableList.copyOf(hostConlyoptList);
+ host.linkoptList = ImmutableList.copyOf(hostLinkoptList);
host.useStartEndLib = useStartEndLib;
host.stripBinaries = StripMode.ALWAYS;