1d3868032626d59662ff73b372b5d584c1d144c53Ben Murdoch// Copyright (c) 2013 The Chromium Authors. All rights reserved.
2d3868032626d59662ff73b372b5d584c1d144c53Ben Murdoch// Use of this source code is governed by a BSD-style license that can be
3d3868032626d59662ff73b372b5d584c1d144c53Ben Murdoch// found in the LICENSE file.
4d3868032626d59662ff73b372b5d584c1d144c53Ben Murdoch
5d3868032626d59662ff73b372b5d584c1d144c53Ben Murdoch#ifndef TOOLS_GN_CONFIG_VALUES_GENERATOR_H_
6d3868032626d59662ff73b372b5d584c1d144c53Ben Murdoch#define TOOLS_GN_CONFIG_VALUES_GENERATOR_H_
7d3868032626d59662ff73b372b5d584c1d144c53Ben Murdoch
8d3868032626d59662ff73b372b5d584c1d144c53Ben Murdoch#include <string>
9d3868032626d59662ff73b372b5d584c1d144c53Ben Murdoch#include <vector>
10d3868032626d59662ff73b372b5d584c1d144c53Ben Murdoch
11d3868032626d59662ff73b372b5d584c1d144c53Ben Murdoch#include "base/basictypes.h"
12d3868032626d59662ff73b372b5d584c1d144c53Ben Murdoch#include "tools/gn/source_dir.h"
13d3868032626d59662ff73b372b5d584c1d144c53Ben Murdoch
14d3868032626d59662ff73b372b5d584c1d144c53Ben Murdochclass ConfigValues;
15d3868032626d59662ff73b372b5d584c1d144c53Ben Murdochclass Err;
16d3868032626d59662ff73b372b5d584c1d144c53Ben Murdochclass Scope;
17d3868032626d59662ff73b372b5d584c1d144c53Ben Murdochclass Token;
18d3868032626d59662ff73b372b5d584c1d144c53Ben Murdoch
19f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// This class fills in the config values from a given scope. It's shared
20f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// between the "config" function call and all the different binary target types
21f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// (shared library, static library, etc.) since all of these support the
22f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)// various flags stored in the ConfigValues class.
23d3868032626d59662ff73b372b5d584c1d144c53Ben Murdochclass ConfigValuesGenerator {
24d3868032626d59662ff73b372b5d584c1d144c53Ben Murdoch public:
25d3868032626d59662ff73b372b5d584c1d144c53Ben Murdoch  ConfigValuesGenerator(ConfigValues* dest_values,
263240926e260ce088908e02ac07a6cf7b0c0cbf44Ben Murdoch                        Scope* scope,
27d3868032626d59662ff73b372b5d584c1d144c53Ben Murdoch                        const SourceDir& input_dir,
28d3868032626d59662ff73b372b5d584c1d144c53Ben Murdoch                        Err* err);
29d3868032626d59662ff73b372b5d584c1d144c53Ben Murdoch  ~ConfigValuesGenerator();
30d3868032626d59662ff73b372b5d584c1d144c53Ben Murdoch
31d3868032626d59662ff73b372b5d584c1d144c53Ben Murdoch  // Sets the error passed to the constructor on failure.
32d3868032626d59662ff73b372b5d584c1d144c53Ben Murdoch  void Run();
33d3868032626d59662ff73b372b5d584c1d144c53Ben Murdoch
34d3868032626d59662ff73b372b5d584c1d144c53Ben Murdoch private:
35d3868032626d59662ff73b372b5d584c1d144c53Ben Murdoch  ConfigValues* config_values_;
363240926e260ce088908e02ac07a6cf7b0c0cbf44Ben Murdoch  Scope* scope_;
37d3868032626d59662ff73b372b5d584c1d144c53Ben Murdoch  const SourceDir input_dir_;
38d3868032626d59662ff73b372b5d584c1d144c53Ben Murdoch  Err* err_;
39d3868032626d59662ff73b372b5d584c1d144c53Ben Murdoch
40d3868032626d59662ff73b372b5d584c1d144c53Ben Murdoch  DISALLOW_COPY_AND_ASSIGN(ConfigValuesGenerator);
41d3868032626d59662ff73b372b5d584c1d144c53Ben Murdoch};
42d3868032626d59662ff73b372b5d584c1d144c53Ben Murdoch
4358537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)// For using in documentation for functions which use this.
4458537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)#define CONFIG_VALUES_VARS_HELP \
4558537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)    "  Flags: cflags, cflags_c, cflags_cc, cflags_objc, cflags_objcc,\n" \
464e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)    "         defines, include_dirs, ldflags, lib_dirs, libs\n"
4758537e28ecd584eab876aee8be7156509866d23aTorne (Richard Coles)
48d3868032626d59662ff73b372b5d584c1d144c53Ben Murdoch#endif  // TOOLS_GN_CONFIG_VALUES_GENERATOR_H_
49