premake / premake/premake-core
Allow specifying root directory for the project sources
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 3.6k
- Forks
- 654
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 13
Description
For various reasons, I can't have Premake files in the root directory of the project, but have to put it into a subdirectory, let's call it build/premake. This means that even my simplest project definitions look like this:
project "foo"
kind "StaticLib"
symbols "On"
local srcdir = "../../foo/"
vpaths {
["Source Files"] = srcdir .. "**.cpp",
["Header Files"] = srcdir .. "**.h",
}
includedirs { srcdir .. "include" }
files {
srcdir .. "include/foo/bar.h",
-- a dozen more of them...
srcdir .. "src/foo/foo.cpp",
-- and a dozen more of those...
}
Having to write srcdir .. everywhere is aggravating.
My existing build system allows to do this instead
srcdir ../../foo; // This line makes all the paths relative to this directory.
library foo {
includedirs = include;
headers {
include/foo/foo.h
...
}
sources {
src/foo/foo.cpp
...
}
}
and I find this much more convenient.
So I wonder if a similar option could be added to Premake? I'd be willing to implement it, but I'd appreciate any hints about how to do it because I am not sure how to get an option set at the current project level in translate() function which is where, I think, prepending of srcdir should be implemented.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by tracing the project-level path handling around the translate() function mentioned in the issue, and identify how current project options are made available there. Define the root-directory behavior for project paths, then verify that source, header, include, and vpath entries can omit the repeated prefix without changing existing relative-path behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- lua
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100