premake / premake-core

Premake
https://premake.github.io/
BSD 3-Clause "New" or "Revised" License
3.2k stars 618 forks source link

Introduce a tools `getrelative` function to allow relative path customization. #2244

Closed tritao closed 1 week ago

tritao commented 4 weeks ago

This just centralizes all project.getrelative in the GCC toolset, allowing for customization by external code, by overriding this function.

This is needed for instance in Ninja generators, when the location of a project is not the workspace location, but the code of the Ninja file itself should still refer to workspace-relative paths.

Jarod42 commented 4 weeks ago

Should also apply to other toolsets (so currently dotnet and msc, as others use toolset.gcc) Whereas premake-ninja doesn't support C# yet, it supports msc.

tritao commented 2 weeks ago

Updated the msc and dotnet toolsets too, clang has no direct calls to project.getrelative and fowards to gcc.

tritao commented 2 weeks ago

Updated this again with some more thorough testing to at least make sure these exist and continue to exist for all toolsets.

@nickclark2016 Please take another look when you have a chance.

nickclark2016 commented 2 weeks ago

Will leave open for comment for a few days. Barring any change requests, will merge. Thank you!

tritao commented 1 week ago

Updates the PR with a new simpler implementation based on a new p.tools.getrelative function.

tritao commented 1 week ago

This one has been sitting for a while.

Can anyone take a look? @samsinsane @nickclark2016