Add new Makefile configuration kind to API and project validation
This commit is contained in:
parent
e8f45e5735
commit
64d6d71fcd
@ -762,9 +762,10 @@
|
||||
kind = "string",
|
||||
allowed = {
|
||||
"ConsoleApp",
|
||||
"WindowedApp",
|
||||
"StaticLib",
|
||||
"Makefile",
|
||||
"SharedLib",
|
||||
"StaticLib",
|
||||
"WindowedApp",
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
--
|
||||
-- premake.lua
|
||||
-- High-level processing functions.
|
||||
-- Copyright (c) 2002-2012 Jason Perkins and the Premake project
|
||||
-- Copyright (c) 2002-2013 Jason Perkins and the Premake project
|
||||
--
|
||||
|
||||
local solution = premake.solution
|
||||
@ -18,10 +18,12 @@
|
||||
premake.CLANG = "clang"
|
||||
premake.CONSOLEAPP = "ConsoleApp"
|
||||
premake.CPP = "C++"
|
||||
premake.CSHARP = "C#"
|
||||
premake.GCC = "gcc"
|
||||
premake.HAIKU = "haiku"
|
||||
premake.LINUX = "linux"
|
||||
premake.MACOSX = "macosx"
|
||||
premake.MAKEFILE = "Makefile"
|
||||
premake.POSIX = "posix"
|
||||
premake.PS3 = "ps3"
|
||||
premake.SHAREDLIB = "SharedLib"
|
||||
@ -150,7 +152,6 @@
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Sanity check the settings of a specific project. Raises an error if
|
||||
-- an insane state is detected.
|
||||
@ -188,6 +189,11 @@
|
||||
premake.error("project '%s' needs a kind in configuration '%s'", cfg.project.name, cfg.name)
|
||||
end
|
||||
|
||||
-- makefile configuration can only appear in C++ projects
|
||||
if cfg.kind == premake.MAKEFILE and not project.iscpp(cfg.project) then
|
||||
premake.error("project '%s' uses Makefile kind in configuration '%s'; language must be C++", cfg.project.name, cfg.name)
|
||||
end
|
||||
|
||||
-- check for out of scope fields
|
||||
premake.validateScopes(cfg, "config", ctx)
|
||||
end
|
||||
|
@ -84,6 +84,11 @@
|
||||
-- attach a bit more local state
|
||||
ctx.solution = sln
|
||||
|
||||
-- if no language is set for the project, default to C++
|
||||
if not ctx.language then
|
||||
ctx.language = premake.CPP
|
||||
end
|
||||
|
||||
-- create a list of build cfg/platform pairs for the project
|
||||
local cfgs = table.fold(ctx.configurations or {}, ctx.platforms or {})
|
||||
|
||||
@ -118,7 +123,6 @@
|
||||
})
|
||||
setmetatable(prj, getmetatable(result))
|
||||
|
||||
|
||||
-- bake all configurations contained by the project
|
||||
local configs = {}
|
||||
for _, pairing in ipairs(result._cfglist) do
|
||||
@ -779,8 +783,7 @@
|
||||
--
|
||||
|
||||
function project.isc(prj)
|
||||
local language = prj.language or prj.solution.language
|
||||
return language == "C"
|
||||
return prj.language == premake.C
|
||||
end
|
||||
|
||||
|
||||
@ -789,19 +792,16 @@
|
||||
--
|
||||
|
||||
function project.iscpp(prj)
|
||||
local language = prj.language or prj.solution.language
|
||||
return language == "C" or language == "C++"
|
||||
return prj.language == premake.C or prj.language == premake.CPP
|
||||
end
|
||||
|
||||
|
||||
|
||||
--
|
||||
-- Returns true if the project uses a .NET language.
|
||||
--
|
||||
|
||||
function project.isdotnet(prj)
|
||||
local language = prj.language or prj.solution.language
|
||||
return language == "C#"
|
||||
return prj.language == premake.CSHARP
|
||||
end
|
||||
|
||||
|
||||
|
@ -47,20 +47,6 @@
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Fail if no language is set on the project.
|
||||
--
|
||||
|
||||
function suite.fails_onNoProjectLanguage()
|
||||
solution "MySolution"
|
||||
configurations { "Debug", "Release" }
|
||||
project "MyProject"
|
||||
kind "ConsoleApp"
|
||||
|
||||
test.isfalse(pcall(premake.validate))
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Fail on duplicate project UUIDs.
|
||||
--
|
||||
|
Loading…
Reference in New Issue
Block a user