diff options
Diffstat (limited to '3rdparty/genie/src/base/api.lua')
-rw-r--r-- | 3rdparty/genie/src/base/api.lua | 119 |
1 files changed, 110 insertions, 9 deletions
diff --git a/3rdparty/genie/src/base/api.lua b/3rdparty/genie/src/base/api.lua index b76982662a0..1b442884572 100644 --- a/3rdparty/genie/src/base/api.lua +++ b/3rdparty/genie/src/base/api.lua @@ -42,6 +42,12 @@ scope = "config", }, + buildoptions_asm = + { + kind = "list", + scope = "config", + }, + buildoptions_c = { kind = "list", @@ -60,6 +66,18 @@ scope = "config", }, + buildoptions_objcpp = + { + kind = "list", + scope = "config", + }, + + clrreferences = + { + kind = "list", + scope = "container", + }, + configurations = { kind = "list", @@ -115,6 +133,12 @@ scope = "config", }, + forcenative = + { + kind = "filelist", + scope = "config", + }, + nopch = { kind = "filelist", @@ -223,6 +247,11 @@ "3.5", "4.0", "4.5", + "4.5.1", + "4.5.2", + "4.6", + "4.6.1", + "4.6.2", } }, @@ -321,6 +350,7 @@ "C++", "C#", "Vala", + "Swift", } }, @@ -596,6 +626,30 @@ scope = "container", }, + vsimportreferences = + { + kind = "filelist", + scope = "container", + }, + + -- swift options + swiftmodulemaps = + { + kind = "filelist", + scope = "config", + }, + + buildoptions_swift = + { + kind = "list", + scope = "config", + }, + + linkoptions_swift = + { + kind = "list", + scope = "config", + }, } @@ -725,11 +779,13 @@ end -- -- Adds values to an array-of-directories field of a solution/project/configuration. --- `ctype` specifies the container type (see premake.getobject) for the field. All +-- `fields` is an array of containers/fieldname pairs to add the results to. All -- values are converted to absolute paths before being stored. -- +-- Only the result of the first field given is returned. +-- - local function domatchedarray(ctype, fieldname, value, matchfunc) + local function domatchedarray(fields, value, matchfunc) local result = { } function makeabsolute(value, depth) @@ -753,15 +809,28 @@ end makeabsolute(value, 3) - return premake.setarray(ctype, fieldname, result) + + local retval = {} + + for index, field in ipairs(fields) do + local ctype = field[1] + local fieldname = field[2] + local array = premake.setarray(ctype, fieldname, result) + + if index == 1 then + retval = array + end + end + + return retval end - function premake.setdirarray(ctype, fieldname, value) - return domatchedarray(ctype, fieldname, value, os.matchdirs) + function premake.setdirarray(fields, value) + return domatchedarray(fields, value, os.matchdirs) end - function premake.setfilearray(ctype, fieldname, value) - return domatchedarray(ctype, fieldname, value, os.matchfiles) + function premake.setfilearray(fields, value) + return domatchedarray(fields, value, os.matchfiles) end @@ -863,9 +932,21 @@ elseif kind == "table" then return premake.settable(container, name, value, allowed) elseif kind == "dirlist" then - return premake.setdirarray(container, name, value) + return premake.setdirarray({{container, name}}, value) elseif kind == "filelist" or kind == "absolutefilelist" then - return premake.setfilearray(container, name, value) + -- HACK: If we're adding files, we should also add them to the project's + -- `allfiles` field. This is to support files being added per config. + local fields = {{container, name}} + if name == "files" then + local prj, err = premake.getobject("container") + if (not prj) then + error(err, 2) + end + -- The first config block for the project is always the project's + -- global config. See the `project` function. + table.insert(fields, {prj.blocks[1], "allfiles"}) + end + return premake.setfilearray(fields, value) elseif kind == "keyvalue" or kind == "keypath" then return premake.setkeyvalue(scope, name, value) end @@ -1145,6 +1226,26 @@ return premake.CurrentGroup end + function importvsproject(location) + if string.find(_ACTION, "vs") ~= 1 then + error("Only available for visual studio actions") + end + + sln, err = premake.getobject("solution") + if not sln then + error(err) + end + + local group = creategroupsfrompath(premake.CurrentGroup, sln) + + local project = {} + project.location = location + project.group = group + project.flags = {} + + table.insert(sln.importedprojects, project) + end + -- -- Define a new action. |