• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.
4 
5 #ifndef TOOLS_GN_CONFIG_VALUES_GENERATOR_H_
6 #define TOOLS_GN_CONFIG_VALUES_GENERATOR_H_
7 
8 #include "gn/source_dir.h"
9 
10 class ConfigValues;
11 class Err;
12 class Scope;
13 
14 // This class fills in the config values from a given scope. It's shared
15 // between the "config" function call and all the different binary target types
16 // (shared library, static library, etc.) since all of these support the
17 // various flags stored in the ConfigValues class.
18 class ConfigValuesGenerator {
19  public:
20   ConfigValuesGenerator(ConfigValues* dest_values,
21                         Scope* scope,
22                         const SourceDir& input_dir,
23                         Err* err);
24   ~ConfigValuesGenerator();
25 
26   // Sets the error passed to the constructor on failure.
27   void Run();
28 
29  private:
30   ConfigValues* config_values_;
31   Scope* scope_;
32   const SourceDir input_dir_;
33   Err* err_;
34 
35   ConfigValuesGenerator(const ConfigValuesGenerator&) = delete;
36   ConfigValuesGenerator& operator=(const ConfigValuesGenerator&) = delete;
37 };
38 
39 // For using in documentation for functions which use this.
40 #define CONFIG_VALUES_VARS_HELP                                        \
41   "  Flags: asmflags, cflags, cflags_c, cflags_cc, cflags_objc,\n"     \
42   "         cflags_objcc, defines, include_dirs, inputs, ldflags,\n"   \
43   "         lib_dirs, libs, precompiled_header, precompiled_source,\n" \
44   "         rustenv, rustflags, swiftflags, testonly\n"
45 
46 #endif  // TOOLS_GN_CONFIG_VALUES_GENERATOR_H_
47