premake5 如何使用多个配置文件?
premake5 How do I use multiple configuration files?
对于我正在处理的项目,我需要针对不同编译器的不同构建选项。我正在考虑使用 dofile 关键字根据使用 premake5 时选择的编译器来包含不同的构建配置。我如何指示 premake5 做类似的事情(在伪代码中)
if gcc
dofile gcc.lua
else if vs2008
dofile vs2008.lua
else if vs2010
dofile vs2010.lua
else if vs2012
dofile vs2012.lua
else if vs2013
dofile vs2013.lua
else if vs2015
dofile vs2015.lua
等等
您可以按照您的建议进行操作:
if _ACTION == "gmake" then
dofile "gcc.lua"
elseif _ACTION == "vs2008" then
dofile "vs2008.lua"
elseif ...
或者像这样:
dofile(_ACTION .. ".lua")
但您可能想这样做:
filter { "action:gmake" }
define { "SOME_GMAKE_SYMBOLS" }
-- put your gmake configuration here
filter { "action:vs*" }
-- put your common VS configuration here
filter { "action:vs2008" }
define { "SOME_VS2008_SYMBOLS" }
-- put your VS2008 specific configuration here
filter { "action:vs*" }
-- put your common VS configuration here
-- and so on...
对于我正在处理的项目,我需要针对不同编译器的不同构建选项。我正在考虑使用 dofile 关键字根据使用 premake5 时选择的编译器来包含不同的构建配置。我如何指示 premake5 做类似的事情(在伪代码中)
if gcc
dofile gcc.lua
else if vs2008
dofile vs2008.lua
else if vs2010
dofile vs2010.lua
else if vs2012
dofile vs2012.lua
else if vs2013
dofile vs2013.lua
else if vs2015
dofile vs2015.lua
等等
您可以按照您的建议进行操作:
if _ACTION == "gmake" then
dofile "gcc.lua"
elseif _ACTION == "vs2008" then
dofile "vs2008.lua"
elseif ...
或者像这样:
dofile(_ACTION .. ".lua")
但您可能想这样做:
filter { "action:gmake" }
define { "SOME_GMAKE_SYMBOLS" }
-- put your gmake configuration here
filter { "action:vs*" }
-- put your common VS configuration here
filter { "action:vs2008" }
define { "SOME_VS2008_SYMBOLS" }
-- put your VS2008 specific configuration here
filter { "action:vs*" }
-- put your common VS configuration here
-- and so on...