Пример #1
0
def std_file_props():
    """Creates list of all standard source file properties."""
    return _std_model_part_props() + [
        Property("_filename",
                 type=PathType(),
                 default=[],
                 readonly=True,
                 inheritable=False,
                 doc="Source file name."),
        Property("compile-commands",
                 type=ListType(StringType()),
                 default=[],
                 inheritable=False,
                 doc="""
                 Command or commands to run to compile this source file,
                 i.e. to generate other file(s) from it. This can be used for
                 generating some files or for compiling custom file types.

                 Two placeholders can be used in the commands, ``%(in)`` and
                 ``%(out)``. They are replaced with the name of the source file
                 and ``outputs`` respectively. Both placeholders are optional.
                 """),
        Property("compile-message",
                 type=StringType(),
                 default=expr.NullExpr(),
                 inheritable=False,
                 doc="""
                 Message shown to the user when running the command.

                 The same placeholder as in *compiler-commands* can be used.
                 """),
        Property("outputs",
                 type=ListType(PathType()),
                 default=lambda t: None
                 if t["compile-commands"] else expr.NullExpr(),
                 inheritable=False,
                 doc="""
                 Output files created by the build step that compiles this file

                 Only applicable if *compile-commands* is set.
                 """),
        Property("dependencies",
                 type=ListType(PathType()),
                 default=[],
                 inheritable=False,
                 doc="""
                 List of additional files that the source file or or its
                 commands depend on.

                 List any files that must be created before the source file is
                 compiled, such as generated header files. If *compile-commands*
                 is set, list any other files referenced by the commands.
                 """),
    ]
Пример #2
0
def std_module_props():
    """Creates list of all standard module properties."""
    toolsets_enum_type = EnumType("toolset", sorted(api.Toolset.all_names()))

    return [
        Property("toolsets",
                 type=ListType(toolsets_enum_type),
                 default=[],
                 inheritable=True,
                 doc="List of toolsets to generate makefiles/projects for."),
        Property("_srcdir",
             type=PathType(),
             default=lambda x: x.srcdir_as_path(),
             readonly=True,
             inheritable=False,
             doc="The value of @srcdir anchor for the module."),
        ]
Пример #3
0
def std_project_props():
    """Creates list of all standard project properties."""
    toolsets_enum_type = EnumType("toolset", sorted(api.Toolset.all_names()))

    return [
        Property("toolset",
                 type=toolsets_enum_type,
                 default=expr.PlaceholderExpr("toolset"),
                 readonly=True,
                 inheritable=False,
                 doc="The toolset makefiles or projects are being generated for. "
                     "This property is set by Bakefile and can be used for performing "
                     "toolset-specific tasks or modifications."
                 ),
        Property("config",
                 type=StringType(),
                 default=expr.PlaceholderExpr("config"),
                 readonly=True,
                 inheritable=False,
                 doc="""
                     Current configuration.

                     This property is set by Bakefile and can be used for performing
                     per-configuration modifications. The value is one of the
                     *configurations* values specified for the target.

                     See :ref:`configurations` for more information.
                     """
                 ),
        Property("arch",
                 type=StringType(),
                 default=expr.PlaceholderExpr("arch"),
                 readonly=True,
                 inheritable=False,
                 doc="""
                     Current architecture.

                     This property is set by Bakefile and can be used for
                     performing per-architecture modifications (if the toolset
                     supports it, which currently only Visual Studio does).
                     The value is one of the *archs* values specified for the
                     target.
                     """
                 ),
        ]
Пример #4
0
def std_setting_props():
    """Creates list of all standard Setting properties."""
    return _std_model_part_props() + [
        Property("help",
                 type=StringType(),
                 default=expr.NullExpr(),
                 inheritable=False,
                 doc="""
                     Documentation for the setting.
                     This will be used in the generated output to explain the setting to
                     the user, if supported by the toolset.
                     """),
        Property("default",
                 type=TheAnyType,
                 default=expr.NullExpr(),
                 inheritable=False,
                 doc="Default value of the setting, if any."),
    ]
Пример #5
0
def _std_model_part_props():
    return [
        Property("_condition",
             type=BoolType(),
             default=True,
             readonly=True,
             inheritable=False,
             doc="""
                 Whether to include this object in the build.
                 Typically a more complicated boolean expression.
                 """),
        ]
Пример #6
0
def std_target_props():
    """Creates list of all standard target properties."""
    return _std_model_part_props() + [
        Property("id",
                 type=IdType(),
                 default=lambda t: expr.LiteralExpr(t.name),
                 readonly=True,
                 inheritable=False,
                 doc="Target's unique name (ID)."),

        Property("deps",
                 type=ListType(IdType()),
                 default=[],
                 inheritable=False,
                 doc="""
                     Dependencies of the target (list of IDs).

                     The dependencies are handled in target-specific ways.
                     At the very least, they are added to the list of
                     dependencies in generated makefiles or projects to ensure
                     correct build order. Some targets may be smart about some
                     kinds of the dependencies and do more.

                     In particular, compiled targets (executables, DLLs) will
                     automatically link against all libraries found in `deps`.
                     """),

        Property("pre-build-commands",
                 type=ListType(StringType()),
                 default=[],
                 inheritable=False,
                 doc="""
                     Custom commands to run before building the target.

                     The value is a list of shell commands to run.  Notice that
                     the commands are platform-specific and so typically need
                     to be set conditionally depending on the value of
                     ``toolset``.

                     Currently only implemented by Visual Studio.
                     """),
        Property("post-build-commands",
                 type=ListType(StringType()),
                 default=[],
                 inheritable=False,
                 doc="""
                     Custom commands to run after building the target.

                     The value is a list of shell commands to run.  Notice that
                     the commands are platform-specific and so typically need
                     to be set conditionally depending on the value of
                     ``toolset``.

                     Currently only implemented by Visual Studio.
                     """),

        Property("configurations",
                 type=ListType(StringType()), # FIXME: use a custom type that validates config names
                 default="Debug Release",
                 inheritable=True,
                 doc="""
                     List of configurations to use for this target.

                     See :ref:`configurations` for more information.
                     """
                 ),
        ]