Flutter Engine
The Flutter Engine
Public Member Functions | Public Attributes | List of all members
gn.gn_to_cmake.Project Class Reference
Inheritance diagram for gn.gn_to_cmake.Project:

Public Member Functions

def __init__ (self, project_json)
 
def GetAbsolutePath (self, path)
 
def GetObjectSourceDependencies (self, gn_target_name, object_dependencies)
 
def GetObjectLibraryDependencies (self, gn_target_name, object_dependencies)
 
def GetCMakeTargetName (self, gn_target_name)
 

Public Attributes

 targets
 
 root_path
 
 build_path
 

Detailed Description

Definition at line 160 of file gn_to_cmake.py.

Constructor & Destructor Documentation

◆ __init__()

def gn.gn_to_cmake.Project.__init__ (   self,
  project_json 
)

Definition at line 161 of file gn_to_cmake.py.

161 def __init__(self, project_json):
162 self.targets = project_json['targets']
163 build_settings = project_json['build_settings']
164 self.root_path = build_settings['root_path']
165 self.build_path = self.GetAbsolutePath(build_settings['build_dir'])
166

Member Function Documentation

◆ GetAbsolutePath()

def gn.gn_to_cmake.Project.GetAbsolutePath (   self,
  path 
)

Definition at line 167 of file gn_to_cmake.py.

167 def GetAbsolutePath(self, path):
168 if path.startswith('//'):
169 return posixpath.join(self.root_path, path[2:])
170 else:
171 return path
172
static std::string GetAbsolutePath(const fml::UniqueFD &base_directory, const char *subpath)
Definition: file_win.cc:50

◆ GetCMakeTargetName()

def gn.gn_to_cmake.Project.GetCMakeTargetName (   self,
  gn_target_name 
)

Definition at line 192 of file gn_to_cmake.py.

192 def GetCMakeTargetName(self, gn_target_name):
193 # See <chromium>/src/tools/gn/label.cc#Resolve
194 # //base/test:test_support(//build/toolchain/win:msvc)
195 path_separator = FindFirstOf(gn_target_name, (':', '('))
196 location = None
197 name = None
198 toolchain = None
199 if not path_separator:
200 location = gn_target_name[2:]
201 else:
202 location = gn_target_name[2:path_separator]
203 toolchain_separator = gn_target_name.find('(', path_separator)
204 if toolchain_separator == -1:
205 name = gn_target_name[path_separator + 1:]
206 else:
207 if toolchain_separator > path_separator:
208 name = gn_target_name[path_separator + 1:toolchain_separator]
209 assert gn_target_name.endswith(')')
210 toolchain = gn_target_name[toolchain_separator + 1:-1]
211 assert location or name
212
213 cmake_target_name = None
214 if location.endswith('/' + name):
215 cmake_target_name = location
216 elif location:
217 cmake_target_name = location + '_' + name
218 else:
219 cmake_target_name = name
220 if toolchain:
221 cmake_target_name += '--' + toolchain
222 return CMakeTargetEscape(cmake_target_name)
223
224
def FindFirstOf(s, a)
Definition: gn_to_cmake.py:156
def CMakeTargetEscape(a)
Definition: gn_to_cmake.py:46

◆ GetObjectLibraryDependencies()

def gn.gn_to_cmake.Project.GetObjectLibraryDependencies (   self,
  gn_target_name,
  object_dependencies 
)
All OBJECT libraries whose libraries have not been absorbed.

Definition at line 183 of file gn_to_cmake.py.

183 def GetObjectLibraryDependencies(self, gn_target_name, object_dependencies):
184 """All OBJECT libraries whose libraries have not been absorbed."""
185 dependencies = self.targets[gn_target_name].get('deps', [])
186 for dependency in dependencies:
187 dependency_type = self.targets[dependency].get('type', None)
188 if dependency_type == 'source_set':
189 object_dependencies.add(dependency)
190 self.GetObjectLibraryDependencies(dependency, object_dependencies)
191
const myers::Point & get(const myers::Segment &)

◆ GetObjectSourceDependencies()

def gn.gn_to_cmake.Project.GetObjectSourceDependencies (   self,
  gn_target_name,
  object_dependencies 
)
All OBJECT libraries whose sources have not been absorbed.

Definition at line 173 of file gn_to_cmake.py.

173 def GetObjectSourceDependencies(self, gn_target_name, object_dependencies):
174 """All OBJECT libraries whose sources have not been absorbed."""
175 dependencies = self.targets[gn_target_name].get('deps', [])
176 for dependency in dependencies:
177 dependency_type = self.targets[dependency].get('type', None)
178 if dependency_type == 'source_set':
179 object_dependencies.add(dependency)
180 if dependency_type not in gn_target_types_that_absorb_objects:
181 self.GetObjectSourceDependencies(dependency, object_dependencies)
182

Member Data Documentation

◆ build_path

gn.gn_to_cmake.Project.build_path

Definition at line 165 of file gn_to_cmake.py.

◆ root_path

gn.gn_to_cmake.Project.root_path

Definition at line 164 of file gn_to_cmake.py.

◆ targets

gn.gn_to_cmake.Project.targets

Definition at line 162 of file gn_to_cmake.py.


The documentation for this class was generated from the following file: