1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "tools/gn/binary_target_generator.h"
7 #include "tools/gn/config_values_generator.h"
8 #include "tools/gn/err.h"
9 #include "tools/gn/scope.h"
10 #include "tools/gn/variables.h"
12 BinaryTargetGenerator::BinaryTargetGenerator(
15 const FunctionCallNode
* function_call
,
16 Target::OutputType type
,
18 : TargetGenerator(target
, scope
, function_call
, err
),
22 BinaryTargetGenerator::~BinaryTargetGenerator() {
25 void BinaryTargetGenerator::DoRun() {
26 target_
->set_output_type(output_type_
);
29 if (err_
->has_error())
32 FillOutputExtension();
33 if (err_
->has_error())
37 if (err_
->has_error())
41 if (err_
->has_error())
45 if (err_
->has_error())
49 if (err_
->has_error())
52 // Config values (compiler flags, etc.) set directly on this target.
53 ConfigValuesGenerator
gen(&target_
->config_values(), scope_
,
54 scope_
->GetSourceDir(), err_
);
56 if (err_
->has_error())
60 void BinaryTargetGenerator::FillOutputName() {
61 const Value
* value
= scope_
->GetValue(variables::kOutputName
, true);
64 if (!value
->VerifyTypeIs(Value::STRING
, err_
))
66 target_
->set_output_name(value
->string_value());
69 void BinaryTargetGenerator::FillOutputExtension() {
70 const Value
* value
= scope_
->GetValue(variables::kOutputExtension
, true);
73 if (!value
->VerifyTypeIs(Value::STRING
, err_
))
75 target_
->set_output_extension(value
->string_value());