Skip to content

Ninja generator bug #2604

@alex-rass-88

Description

@alex-rass-88

What seems to be the problem?
If the workspace and projects are in different directories, then the Ninja generator incorrectly generates commands for postbuild, prebuild and prelink.

What did you expect to happen?
Ninja handles commands from subninja differently than make does. They are treated as if they are in the same directory as the main ninja.build.

What version of Premake are you using?
9af00b1

The solution to the problem:
in modules/ninja/ninja_cpp.lua in functions m.buildPreBuildEvents, m.buildPreLinkEvents and m.buildPostBuildEvents replace project location to workspace location for translateCommandsAndPaths:

local commands = os.translateCommandsAndPaths(cfg.prelinkcommands, cfg.project.basedir, cfg.project.location) => local commands = os.translateCommandsAndPaths(cfg.prelinkcommands, cfg.project.basedir, cfg.workspace.location)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions