Flutter Engine Uber Docs
Docs for the entire Flutter Engine repo.
 
Loading...
Searching...
No Matches
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 <filesystem>
10#include <iostream>
11#include <memory>
12
18
19namespace impeller {
20namespace compiler {
21
22class Switches {
23 public:
24 std::shared_ptr<fml::UniqueFD> working_directory = nullptr;
25 std::vector<IncludeDir> include_directories = {};
26 std::filesystem::path source_file_name;
28 /// The raw shader file output by the compiler. For --iplr and
29 /// --shader-bundle modes, this is used as the filename for the output
30 /// flatbuffer output.
31 std::filesystem::path sl_file_name;
32 bool iplr = false;
33 std::string shader_bundle = "";
34 std::filesystem::path spirv_file_name;
35 std::filesystem::path reflection_json_name;
36 std::filesystem::path reflection_header_name;
37 std::filesystem::path reflection_cc_name;
38 std::filesystem::path depfile_path;
39 std::vector<std::string> defines = {};
40 bool json_format = false;
43 std::string metal_version = "";
44 std::string entry_point = "";
45 std::string entry_point_prefix = "";
46 bool use_half_textures = false;
48 bool verbose = false;
49
51
53
54 explicit Switches(const fml::CommandLine& command_line);
55
56 bool AreValid(std::ostream& explain) const;
57
58 /// A vector containing at least one valid platform.
59 std::vector<TargetPlatform> PlatformsToCompile() const;
60
61 /// Creates source options from these switches. The returned options does not
62 /// have a set TargetPlatform because that cannot be determined based purely
63 /// on the switches. Clients must set a valid TargetPlatform on the returned
64 /// options before before it is used.
66
67 static void PrintHelp(std::ostream& stream);
68
69 private:
70 // Use |SelectDefaultTargetPlatform|.
72 // Use |PlatformsToCompile|.
73 std::vector<TargetPlatform> runtime_stages_;
74};
75
76} // namespace compiler
77} // namespace impeller
78
79#endif // FLUTTER_IMPELLER_COMPILER_SWITCHES_H_
std::vector< TargetPlatform > PlatformsToCompile() const
A vector containing at least one valid platform.
Definition switches.cc:312
std::filesystem::path reflection_cc_name
Definition switches.h:37
std::string entry_point_prefix
Definition switches.h:45
std::filesystem::path sl_file_name
Definition switches.h:31
SourceLanguage source_language
Definition switches.h:41
std::vector< std::string > defines
Definition switches.h:39
std::shared_ptr< fml::UniqueFD > working_directory
Definition switches.h:24
bool AreValid(std::ostream &explain) const
Definition switches.cc:259
static void PrintHelp(std::ostream &stream)
Definition switches.cc:43
std::filesystem::path reflection_json_name
Definition switches.h:35
SourceOptions CreateSourceOptions() const
Definition switches.cc:319
std::filesystem::path spirv_file_name
Definition switches.h:34
std::filesystem::path depfile_path
Definition switches.h:38
std::vector< IncludeDir > include_directories
Definition switches.h:25
std::filesystem::path source_file_name
Definition switches.h:26
std::filesystem::path reflection_header_name
Definition switches.h:36