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

Projects not being built in the correct directories. #371

Closed
NicolBolas opened this issue Dec 18, 2015 · 9 comments
Closed

Projects not being built in the correct directories. #371

NicolBolas opened this issue Dec 18, 2015 · 9 comments

Comments

@NicolBolas
Copy link

I have a premake5 script that's doing this:

local libPremakes = 
{
    "glload/glload.lua",
    "glimg/glimg.lua",
    "glfw/glfw.lua",
    "freeglut/freeglut.lua",
    "glutil/glutil.lua",
    "glmesh/glmesh.lua",
    "glscene/glscene.lua",
}

for i, luaPremake in ipairs(libPremakes) do
    if(#os.matchfiles(luaPremake) ~= 0) then
        dofile(luaPremake)
    end
end

Each of these files creates a project. The problem is that it doesn't create the project in those directories. The projects are being created in the root directory

According to the workspaces and projects documentation page, "By default, Premake will place generated workspace and project files in the same directory as the script which defined them." If that's supposed to be the case, then I shouldn't have to add location "." to all of those Lua scripts, right? So either Premake5 is doing the wrong thing or the docs are wrong.

I'm using Premake5.0.0 alpha-7, and I'm building for vs2015.

@starkos
Copy link
Member

starkos commented Dec 18, 2015

Did this work with older versions of Premake, or is this a new project?

@NicolBolas
Copy link
Author

It used to work back in Premake4. It only broke when I updated to Premake5.

@starkos
Copy link
Member

starkos commented Jul 13, 2016

Hi Nicol—noticed that this fell through the cracks. Are you still having this issue? If so, can you provide a more complete project snippet? Your example works fine in my local testing, so I suspect there is more going on.

@samsinsane
Copy link
Member

@starkos This does appear to be broken, I'm generating the Premake repository and all of the project files are being dumped into the root folder. This seems to be wrong, by the time we reach this line wks.location is always set regardless of whether you call the location API or not. Interestingly, if you remove wks.location from that line, it all works as expected. I'm happy to submit a PR for this, but I just want to make sure I'm not missing something.

@NicolBolas
Copy link
Author

Note that alpha11 still has this problem.

@NicolBolas
Copy link
Author

NicolBolas commented Apr 5, 2017

Here's a short, runable example:

premake_test.zip

The solution file ought to be in the premake_test directory, and the project file ought to be in the premake_test/loc directory. But the project file is always generated in the premake_test directory alongside the solution.

Note that if the workspace declaration is placed in the loc5.lua script, then both the solution and the project are placed in the premake_test/loc directory. So the full bug seems to be that all projects for a workspace are generated into the same directory as the workspace itself.

@tvandijck
Copy link
Contributor

does adding a location '.' in the loc5.lua solve anything at all??

I think @samsinsane indicated the right line of code that causes this... did @samsinsane ever make a pull request for that?

@samsinsane
Copy link
Member

@tvandijck adding location '.' will likely fix it, based on my testing 7 months ago. I never got around to making a PR for it, ended up getting busy with work. My bad. I might be able to get a PR together tomorrow if you'd like?

@NicolBolas
Copy link
Author

Yes, location '.' does generate them in the correct place.

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

No branches or pull requests

4 participants