我最近发现这个令人惊叹的新宝石叫做premake,我全都是#14;最后!"
我试图做一个简单的测试"配置,这样工作: 在测试配置中,排除source / Main.cpp 当不在测试配置中时,排除source / Test.cpp(包含另一个main)
这是尝试执行此操作的premake4.lua代码
解决方案" Foo" 配置{"调试","发布","测试"} location" build"
project "Bar"
targetname "Bar"
language "C++"
kind "WindowedApp"
files {"source/**.h","source/**.cpp","source/**.c"}
flags {"StaticRuntime","ExtraWarnings", "FatalWarnings"}
configuration "Test"
excludes "source/Main.cpp"
targetsuffix "_Test"
defines {"DEBUG", "TEST"}
flags {"Symbols"}
configuration "not Test"
excludes "source/Test.cpp"
-- And so on ...
但是当我使用" make -Cbuild config = test"它将无论编译和链接与#34; Main.cpp"。
我做错了什么?
答案 0 :(得分:0)
Premake目前不支持每配置文件或排除列表,在生成构建文件时仅考虑在项目级别(在任何配置之外)指定的文件。
每个配置文件列表位于下一个版本(4.5)的简短列表中。
答案 1 :(得分:0)
你可以这样做。
project "Bar"
targetname "Bar"
language "C++"
kind "WindowedApp"
files {"source/**.h","source/**.cpp","source/**.c"}
flags {"StaticRuntime","ExtraWarnings", "FatalWarnings"}
configurations { "Test", "notTest" }
filter { "configurations:Test" }
excludes "source/Main.cpp"
targetsuffix "_Test"
defines {"DEBUG", "TEST"}
flags {"Symbols"}
filter {}
filter { "configurations:notTest" }
excludes "source/Test.cpp"
filter {}