Flutter Engine
The Flutter Engine
switches.h
Go to the documentation of this file.
1// Copyright 2013 The Flutter 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 FLUTTER_IMPELLER_COMPILER_SWITCHES_H_
6#define FLUTTER_IMPELLER_COMPILER_SWITCHES_H_
7
8#include <cstdint>
9#include <iostream>
10#include <memory>
11
12#include "flutter/fml/command_line.h"
13#include "flutter/fml/unique_fd.h"
17
18namespace impeller {
19namespace compiler {
20
21class Switches {
22 public:
23 std::shared_ptr<fml::UniqueFD> working_directory = nullptr;
24 std::vector<IncludeDir> include_directories = {};
25 std::string source_file_name = "";
27 /// The raw shader file output by the compiler. For --iplr and
28 /// --shader-bundle modes, this is used as the filename for the output
29 /// flatbuffer output.
30 std::string sl_file_name = "";
31 bool iplr = false;
32 std::string shader_bundle = "";
33 std::string spirv_file_name = "";
34 std::string reflection_json_name = "";
35 std::string reflection_header_name = "";
36 std::string reflection_cc_name = "";
37 std::string depfile_path = "";
38 std::vector<std::string> defines = {};
39 bool json_format = false;
42 std::string metal_version = "";
43 std::string entry_point = "";
44 bool use_half_textures = false;
46
48
50
51 explicit Switches(const fml::CommandLine& command_line);
52
53 bool AreValid(std::ostream& explain) const;
54
55 /// A vector containing at least one valid platform.
56 std::vector<TargetPlatform> PlatformsToCompile() const;
58
59 // Creates source options from these switches for the specified
60 // TargetPlatform. Uses SelectDefaultTargetPlatform if not specified.
62 std::optional<TargetPlatform> target_platform = std::nullopt) const;
63
64 static void PrintHelp(std::ostream& stream);
65
66 private:
67 // Use |SelectDefaultTargetPlatform|.
69 // Use |PlatformsToCompile|.
70 std::vector<TargetPlatform> runtime_stages_;
71};
72
73} // namespace compiler
74} // namespace impeller
75
76#endif // FLUTTER_IMPELLER_COMPILER_SWITCHES_H_
std::vector< TargetPlatform > PlatformsToCompile() const
A vector containing at least one valid platform.
Definition: switches.cc:292
std::string reflection_json_name
Definition: switches.h:34
SourceLanguage source_language
Definition: switches.h:40
std::string reflection_header_name
Definition: switches.h:35
std::vector< std::string > defines
Definition: switches.h:38
std::shared_ptr< fml::UniqueFD > working_directory
Definition: switches.h:23
SourceOptions CreateSourceOptions(std::optional< TargetPlatform > target_platform=std::nullopt) const
Definition: switches.cc:307
std::string reflection_cc_name
Definition: switches.h:36
std::string spirv_file_name
Definition: switches.h:33
bool AreValid(std::ostream &explain) const
Definition: switches.cc:239
static void PrintHelp(std::ostream &stream)
Definition: switches.cc:41
std::string source_file_name
Definition: switches.h:25
std::vector< IncludeDir > include_directories
Definition: switches.h:24
TargetPlatform SelectDefaultTargetPlatform() const
Definition: switches.cc:299