loki.transformations.build_system.plan
Transformations to be used for exposing planned changes to the build system
Classes
|
Gather the planning information from all |
- class CMakePlanTransformation(rootpath=None)
Bases:
TransformationGather the planning information from all
Item.trafo_datato which this information is applied and allows writing a CMake plan fileThis requires that
FileWriteTransformationhas been applied in planning mode first.Applying this transformation to a
Itemupdates internal lists:sources_to_transform: The path of all source files that contain objects that are transformed by a Loki transformation in the pipelinesources_to_append: The path of any new source files that exist as a consequence of the Loki transformation pipeline, e.g., transformed source files that are written.sources_to_remove: The path of any existing source files that are to be removed from the compilation target. This includes all items that don’t have theItem.replicateproperty.
The
Sourcefile.pathis used to determine the file path from which a Fortran sourcefile was read. New paths are provided initem.trafo_data['FileWriteTransformation']['path'].The method
write_plan()allows to write the gathered information to a CMake file that can be included in the CMake scripts that build a library. The plan file is a CMake file defining three lists matching the above:LOKI_SOURCES_TO_TRANSFORM: The list of files that areprocessed in the dependency graph
LOKI_SOURCES_TO_APPEND: The list of files that are createdand have to be added to the build target as part of the processing
LOKI_SOURCES_TO_REMOVE: The list of files that are no longerrequired (because they have been replaced by transformed files) and should be removed from the build target.
These lists are used by the Loki CMake wrappers (particularly
loki_transform_target) to schedule the source updates and update the source lists of the CMake target object accordingly.- Parameters:
rootpath (str (optional)) – If given, all paths will be resolved relative to this root directory
- traverse_file_graph = True
- item_filter = None
- plan_file(sourcefile, **kwargs)
Define the planning steps to apply for
Sourcefileitems.For transformations that modify the definitions or dependencies of
sourcefilethis should be implemented. It gets called via the dispatch methodapply()if the optionalplan_modeargument is set to True.- Parameters:
sourcefile (
Sourcefile) – The sourcefile to be transformed.**kwargs (optional) – Keyword arguments for the transformation.
- write_plan(filepath)
Write the CMake plan file to
filepath