简体   繁体   English

premake5 如何生成与用户调用 premake 的位置相关的项目,而不是与 premake5.lua 文件相关的项目?

[英]premake5 How can I generate the projects relative to where the user call premake, and not relative to the premake5.lua file?

I want the workspace and project files generated relative to where the user call premake5, as right now, everything is relative to the premake5.lua location.我想要相对于用户调用 premake5 的位置生成的工作区和项目文件,就像现在一样,一切都与 premake5.lua 位置相关。

I tried to use the location command in my workspace, but I'm unable to find a function that return the folder where the executable is call.我试图在我的工作区中使用 location 命令,但我找不到一个函数来返回调用可执行文件的文件夹。

The goal is to mimic what cmake does, without hardcoding anything.目标是模仿 cmake 的功能,而不需要硬编码任何东西。 So if a user wants to do:因此,如果用户想要执行以下操作:

mkdir build 
premake5 --file=../premake5.lua

It should generate all workspace/projects inside the build folder, and not at the root.它应该在构建文件夹中生成所有工作区/项目,而不是在根目录中。

Thanks for help.感谢帮助。

See location , _WORKING_DIR , and maybe path.join .查看location_WORKING_DIR ,也许还有path.join

project 'MyProject'
   location(path.join(_WORKING_DIR, 'MyProject'))

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM