Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed buildcommand not haveing project working directory #39

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

LostbBlizzard
Copy link
Contributor

there may be a cleaner way to fix this issue.

local function prebuild_rule(cfg)
if #cfg.prebuildcommands > 0 or cfg.prebuildmessage then
local commands = {}
if cfg.prebuildmessage then
commands = {os.translateCommandsAndPaths("{ECHO} " .. cfg.prebuildmessage, cfg.workspace.basedir, cfg.workspace.location)}
end
commands = table.join(commands, os.translateCommandsAndPaths(cfg.prebuildcommands, cfg.workspace.basedir, cfg.workspace.location))
commands = table.join(commands, os.translateCommandsAndPaths(fixupbuildcommands(cfg,cfg.prebuildcommands), cfg.workspace.basedir, cfg.workspace.location))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we just have to play with 2nd or 3rd parameter.

@Jarod42
Copy link
Collaborator

Jarod42 commented Oct 19, 2024

Can you share a problematic config?
I tried modifying https://github.com/Jarod42/premake-sample-projects/tree/master/projects/project-04-prepost-build to have project location as workspace-location+"project" and it worked.

@LostbBlizzard
Copy link
Contributor Author

LostbBlizzard commented Oct 19, 2024

Can you share a problematic config? I tried modifying https://github.com/Jarod42/premake-sample-projects/tree/master/projects/project-04-prepost-build to have project location as workspace-location+"project" and it worked.

I simplified my project premake5.lua to https://github.com/LostbBlizzard/premake-problematic-ninja-example.
compare the ninja plugin to premake gmake2 and see the difference.
here the original if you need it.

also may need to run ninja subproject1_Debug_linux64 first because pre_cmd does not wait for dependency.

the believe the issue is from the include function

@Jarod42
Copy link
Collaborator

Jarod42 commented Oct 20, 2024

As mentionned in Tokens#path-in-commands,
you have to use %[..], i.e:
prebuildcommands { "%[" .. ProgramPath .."] pwdcmd" }.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants