所以我有一个Premake5脚本来为我当前的项目(一个静态库)生成makefile。它有一个名为"with-sandbox“的命令行选项。“沙箱”是一个库的测试环境。但是,只有在设置了"with-sandbox“选项的情况下,才应该创建它的makefile。因此,我制作了一个过滤器,只有在设置了该选项时才包含"sandbox“的Premake5脚本。但是似乎"include“不受过滤器的影响,所以这是不起作用的。
下面是我的主项目的Premake5脚本:
newoption
{
trigger = "with-sandbox",
description = "Creates a sandbox testing environment"
}
workspace "celer"
project "celer"
-- Project setup...
filter "options:with-sandbox"
include "tests/sandbox/"这是“沙盒”项目的Premake5脚本:
project "sandbox"
-- Project setup...我只想让“沙箱”的东西存在,如果我想的话。当我使用Visual Studio将库移植到Windows时,这一点尤其重要。我只想在必要的时候在我的解决方案中使用“沙箱”项目。
发布于 2020-02-06 19:58:00
我认为你可以做这样的事情
if _OPTIONS['with-sandbox'] then
project "sandbox"
...
end这样,只有在您传递选项时才会生成项目
https://stackoverflow.com/questions/59474246
复制相似问题