@ -1,41 +1,42 @@
/* Premake's Lua scripts, as static data buffers for release mode builds */
/* Premake's Lua scripts, as static data buffers for release mode builds */
/* DO NOT EDIT - this file is autogenerated - see BUILD.txt */
/* To regenerate this file, run: premake4 embed */
const char * builtin_scripts [ ] = {
/* base/os.lua */
" function os.executef(cmd, ...) \n local arg={...} \n cmd = string.format(cmd, table.unpack(arg)) \n return os.execute(cmd) \n end \n local function parse_ld_so_conf(conf_file) \n local first, last \n local dirs = { } \n local file = io.open(conf_file) \n if file == nil then \n return dirs \n end \n for line in file:lines() do \n first = line:find( \" # \" , 1, true) \n if first ~= nil then \n line = line:sub(1, first - 1) \n end \n if line ~= \" \" then \n first, last = line:find( \" include%s+ \" ) \n if first ~= nil then \n local include_glob = line:sub(last + 1) \n local includes = os.matchfiles(include_glob) \n for _, v in ipairs(includes) do \n dirs = table.join(dirs, parse_ld_so_conf(v)) \n end \n else \n table.insert(dirs, line) \n end \n end \n end \n return dirs \n end \n function os.findlib(libname) \n local path, formats \n if os.is( \" windows \" ) then \n formats = { \" %s.dll \" , \" %s \" } \n path = os.getenv( \" PATH \" ) \n else \n if os.is( \" macosx \" ) then \n formats = { \" lib%s.dylib \" , \" %s.dylib \" } \n path = os.getenv( \" DYLD_LIBRARY_PATH \" ) \n else \n formats = { \" lib%s.so \" , \" %s.so \" } \n p "
" ath = os.getenv( \" LD_LIBRARY_PATH \" ) or \" \" \n for _, v in ipairs(parse_ld_so_conf( \" /etc/ld.so.conf \" )) do \n path = path .. \" : \" .. v \n end \n end \n table.insert(formats, \" %s \" ) \n path = path or \" \" \n if os.is64bit() then \n path = path .. \" :/lib64:/usr/lib64/:usr/local/lib64 \" \n end \n path = path .. \" :/lib:/usr/lib:/usr/local/lib \" \n end \n for _, fmt in ipairs(formats) do \n local name = string.format(fmt, libname) \n local result = os.pathsearch(name, path) \n if result then return result end \n end \n end \n function os.get() \n return _OPTIONS.os or _OS \n end \n function os.is(id) \n return (os.get():lower() == id:lower()) \n end \n local _64BitHostTypes = { \n \" x86_64 \" , \n \" ia64 \" , \n \" amd64 \" , \n \" ppc64 \" , \n \" powerpc64 \" , \n \" sparc64 \" \n } \n function os.is64bit() \n if (os._is64bit()) then \n return true \n end \n local arch \n if _OS == \" windows \" then \n arch = os.getenv( \" PROCESSOR_ARCHITECTURE \" ) \n elseif _OS == \" macosx \" then \n arch = os.outputof( \" echo $HOSTTYPE \" ) \n else \n arch = os.outputof( \" uname -m \" ) \n end \n arch = arch:lower()\n for _, hosttype "
" in ipairs(_64BitHostTypes) do\n if arch:find(hosttype) then \n return true \n end \n end \n return false \n end \n local function domatch(result, mask, wantfiles) \n if mask:startswith( \" ./ \" ) then \n mask = mask:sub(3) \n end \n local basedir = mask \n local starpos = mask:find( \" %* \" ) \n if starpos then \n basedir = basedir:sub(1, starpos - 1) \n end \n basedir = path.getdirectory(basedir) \n if (basedir == \" . \" ) then basedir = \" \" end \n local recurse = mask:find( \" ** \" , nil, true) \n mask = path.wildcards(mask) \n local function matchwalker(basedir) \n local wildcard = path.join(basedir, \" * \" ) \n local m = os.matchstart(wildcard) \n while (os.matchnext(m)) do \n local isfile = os.matchisfile(m) \n if ((wantfiles and isfile) or (not wantfiles and not isfile)) then \n local fname = path.join(basedir, os.matchname(m)) \n if fname:match(mask) == fname then \n table.insert(result, fname) \n end \n end \n end \n os.matchdone(m) \n if recurse then \n m = os.matchstart(wildcard) \n while (os.matchnext(m)) do \n if not os.matchisfile(m) then \n local dirname = os.matchname(m)\n match "
" walker(path.join(basedir, dirname))\n end \n end \n os.matchdone(m) \n end \n end \n matchwalker(basedir) \n end \n function os.matchdirs(...) \n local arg={...} \n local result = { } \n for _, mask in ipairs(arg) do \n domatch(result, mask, false) \n end \n return result \n end \n function os.matchfiles(...) \n local arg={...} \n local result = { } \n for _, mask in ipairs(arg) do \n domatch(result, mask, true) \n end \n return result \n end \n local builtin_mkdir = os.mkdir \n function os.mkdir(p) \n local dir = iif(p:startswith( \" / \" ), \" / \" , \" \" ) \n for part in p:gmatch( \" [^/]+ \" ) do \n dir = dir .. part \n if (part ~= \" \" and not path.isabsolute(part) and not os.isdir(dir)) then \n local ok, err = builtin_mkdir(dir) \n if (not ok) then \n return nil, err \n end \n end \n dir = dir .. \" / \" \n end \n return true \n end \n function os.outputof(cmd) \n local pipe = io.popen(cmd) \n local result = pipe:read('*a') \n pipe:close() \n return result \n end \n local builtin_rmdir = os.rmdir \n function os.rmdir(p) \n local dirs = os.matchdirs(p .. \" /* \" ) \n for _, dname i n ipairs(dirs) do\n os.rmdir(dname "
" )\n end \n local files = os.matchfiles(p .. \" /* \" ) \n for _, fname in ipairs(files) do \n os.remove(fname) \n end \n builtin_rmdir(p) \n end \n " ,
" ath = os.getenv( \" LD_LIBRARY_PATH \" ) or \" \" \n for _, v in ipairs(parse_ld_so_conf( \" /etc/ld.so.conf \" )) do \n path = path .. \" : \" .. v \n end \n end \n table.insert(formats, \" %s \" ) \n path = path or \" \" \n if os.is64bit() then \n path = path .. \" :/lib64:/usr/lib64/:usr/local/lib64 \" \n end \n path = path .. \" :/lib:/usr/lib:/usr/local/lib \" \n end \n for _, fmt in ipairs(formats) do \n local name = string.format(fmt, libname) \n local result = os.pathsearch(name, path) \n if result then return result end \n end \n end \n function os.get() \n return _OPTIONS.os or _OS \n end \n function os.is(id) \n return (os.get():lower() == id:lower()) \n end \n local _64BitHostTypes = { \n \" x86_64 \" , \n \" ia64 \" , \n \" amd64 \" , \n \" ppc64 \" , \n \" powerpc64 \" , \n \" sparc64 \" \n } \n function os.is64bit() \n if (os._is64bit()) then \n return true \n end \n local arch = \" \" \n if _OS == \" windows \" then \n arch = os.getenv( \" PROCESSOR_ARCHITECTURE \" ) \n elseif _OS == \" macosx \" then \n arch = os.outputof( \" echo $HOSTTYPE \" ) \n else \n arch = os.outputof( \" uname -m \" ) \n end \n if nil ~= arch then\n arch = a "
" rch:lower()\n for _, hosttype in ipairs(_64BitHostTypes) do\n if arch:find(hosttype) then \n return true \n end \n end \n end \n return false \n end \n local function domatch(result, mask, wantfiles) \n if mask:startswith( \" ./ \" ) then \n mask = mask:sub(3) \n end \n local basedir = mask \n local starpos = mask:find( \" %* \" ) \n if starpos then \n basedir = basedir:sub(1, starpos - 1) \n end \n basedir = path.getdirectory(basedir) \n if (basedir == \" . \" ) then basedir = \" \" end \n local recurse = mask:find( \" ** \" , nil, true) \n mask = path.wildcards(mask) \n local function matchwalker(basedir) \n local wildcard = path.join(basedir, \" * \" ) \n local m = os.matchstart(wildcard) \n while (os.matchnext(m)) do \n local isfile = os.matchisfile(m) \n if ((wantfiles and isfile) or (not wantfiles and not isfile)) then \n local fname = path.join(basedir, os.matchname(m)) \n if fname:match(mask) == fname then \n table.insert(result, fname) \n end \n end \n end \n os.matchdone(m) \n if recurse then \n m = os.matchstart(wildcard) \n while (os.matchnext(m)) do \n if not os.matchisfile(m) then \n local "
" dirname = os.matchname(m)\n match walker(path.join(basedir, dirname))\n end \n end \n os.matchdone(m) \n end \n end \n matchwalker(basedir) \n end \n function os.matchdirs(...) \n local arg={...} \n local result = { } \n for _, mask in ipairs(arg) do \n domatch(result, mask, false) \n end \n return result \n end \n function os.matchfiles(...) \n local arg={...} \n local result = { } \n for _, mask in ipairs(arg) do \n domatch(result, mask, true) \n end \n return result \n end \n local builtin_mkdir = os.mkdir \n function os.mkdir(p) \n local dir = iif(p:startswith( \" / \" ), \" / \" , \" \" ) \n for part in p:gmatch( \" [^/]+ \" ) do \n dir = dir .. part \n if (part ~= \" \" and not path.isabsolute(part) and not os.isdir(dir)) then \n local ok, err = builtin_mkdir(dir) \n if (not ok) then \n return nil, err \n end \n end \n dir = dir .. \" / \" \n end \n return true \n end \n function os.outputof(cmd) \n local pipe = io.popen(cmd) \n local result = pipe:read('*a') \n pipe:close() \n return result \n end \n local builtin_rmdir = os.rmdir \n function os.rmdir(p) \n local dirs = os.matchdirs(p .. \" /* \" ) \n for _, dname i "
" n ipairs(dirs) do\n os.rmdir(dname )\n end \n local files = os.matchfiles(p .. \" /* \" ) \n for _, fname in ipairs(files) do \n os.remove(fname) \n end \n builtin_rmdir(p) \n end \n " ,
/* base/path.lua */
" function path.getbasename(p) \n local name = path.getname(p) \n local i = name:findlast( \" . \" , true) \n if (i) then \n return name:sub(1, i - 1) \n else \n return name \n end \n end \n function path.removeext(name) \n local i = name:findlast( \" . \" , true) \n if (i) then \n return name:sub(1, i - 1) \n else \n return name \n end \n end \n function path.getdirectory(p) \n local i = p:findlast( \" / \" , true) \n if (i) then \n if i > 1 then i = i - 1 end \n return p:sub(1, i) \n else \n return \" . \" \n end \n end \n function path.getdrive(p) \n local ch1 = p:sub(1,1) \n local ch2 = p:sub(2,2) \n if ch2 == \" : \" then \n return ch1 \n end \n end \n function path.getextension(p) \n local i = p:findlast( \" . \" , true) \n if (i) then \n return p:sub(i) \n else \n return \" \" \n end \n end \n function path.getname(p) \n local i = p:findlast( \" [/ \\ \\ ] \" ) \n if (i) then \n return p:sub(i + 1) \n else \n return p \n end \n end \n function path.getcommonbasedir(a, b) \n a = path.getdirectory(a)..'/' \n b = path.getdirectory(b)..'/' \n local idx = 0 \n while (true) do \n local tst = a:find('/', idx + 1, true) \n if tst then \n if a:sub(1,t "
" st) == b:sub(1,tst) then \n idx = tst \n else \n break \n end \n else \n break \n end \n end \n local result = '' \n if idx > 1 then \n result = a:sub(1, idx - 1)-- Remove the trailing slash to be consistent with other functions. \n end \n return result \n end \n function path.hasextension(fname, extensions) \n local fext = path.getextension(fname):lower() \n if type(extensions) == \" table \" then \n for _, extension in pairs(extensions) do \n if fext == extension then \n return true \n end \n end \n return false \n else \n return (fext == extensions) \n end \n end \n function path.iscfile(fname) \n return path.hasextension(fname, { \" .c \" , \" .m \" }) \n end \n function path.iscppfile(fname) \n return path.hasextension(fname, { \" .cc \" , \" .cpp \" , \" .cxx \" , \" .c \" , \" .m \" , \" .mm \" }) \n end \n function path.iscxfile(fname) \n return path.hasextension(fname, \" .cx \" ) \n end \n function path.isobjcfile(fname) \n return path.hasextension(fname, { \" .m \" , \" .mm \" }) \n end \n function path.iscppheader(fname) \n return path.hasextension(fname, { \" .h \" , \" .hh \" , \" .hpp \" , \" .hxx \" }) \n end \n function "
" path.isappxmanifest(fname)\n return path.hasextension(fname, \" .appxmanifest \" ) \n end \n function path.isnatvis(fname) \n return path.hasextension(fname, \" .natvis \" ) \n end \n function path.isasmfile(fname) \n return path.hasextension(fname, { \" .asm \" , \" .s \" , \" .S \" }) \n end \n function path.isvalafile(fname) \n return path.hasextension(fname, \" .vala \" ) \n end \n function path.isswiftfile(fname) \n return path.hasextension(fname, \" .swift \" ) \n end \n function path.issourcefile(fname) \n return path.iscfile(fname) \n or path.iscppfile(fname) \n or path.iscxfile(fname) \n or path.isasmfile(fname) \n or path.isvalafile(fname) \n or path.isswiftfile(fname) \n end \n function path.issourcefilevs(fname) \n return path.hasextension(fname, { \" .cc \" , \" .cpp \" , \" .cxx \" , \" .c \" }) \n or path.iscxfile(fname) \n end \n function path.is resourcefile(fname)\n return path.hasextension(fname, \" .rc \" ) \n end \n function path.isimagefile(fname) \n local extensions = { \" .png \" } \n local ext = path.getextension(fname):lower() \n return table.contains(extensions, ext) \n end \n function "
" path.join(...)\n local arg={...} \n local numargs = select( \" # \" , ...) \n if numargs == 0 then \n return \" \" ; \n end \n local allparts = {} \n for i = numargs, 1, -1 do \n local part = select(i, ...) \n if part and #part > 0 and part ~= \" . \" then \n while part:endswith( \" / \" ) do \n part = part:sub(1, -2) \n end \n table.insert(allparts, 1, part) \n if path.isabsolute(part) then \n break \n end \n end \n end \n return table.concat(allparts, \" / \" ) \n end \n function path.rebase(p, oldbase, newbase) \n p = path.getabsolute(path.join(oldbase, p)) \n p = path.getrelative(newbase, p) \n return p \n end \n function path.translate(p, sep) \n if (type(p) == \" table \" ) then \n local result = { } \n for _, value in ipairs(p) do \n table.insert(result, path.translate(value)) \n end \n return result \n else \n if (not sep) then \n if (os.is( \" windows \" )) then \n sep = \" \\ \\ \" \n else \n sep = \" / \" \n end \n end \n local result = p:gsub( \" [/ \\ \\ ] \" , sep) \n return result \n end \n end \n function path.wildcards(pattern) \n pattern = pattern:gsub( \" ([%+%.%-%^%$%(%)%%]) \" , \" %%%1 \" ) \n pattern = pattern:gsub( \" "
" %*%* \" , \" \\ 001 \" ) \n pattern = pattern:gsub( \" %* \" , \" \\ 002 \" ) \n pattern = pattern:gsub( \" \\ 001 \" , \" .* \" ) \n pattern = pattern:gsub( \" \\ 002 \" , \" [^/]* \" ) \n return pattern \n end \n function path.trimdots(p) \n local changed \n repeat \n changed = true \n if p:startswith( \" ./ \" ) then \n p = p:sub(3) \n elseif p:startswith( \" ../ \" ) then \n p = p:sub(4) \n else \n changed = false \n end \n until not changed \n return p \n end \n function path.rebase(p, oldbase, newbase) \n p = path.getabsolute(path.join(oldbase, p)) \n p = path.getrelative(newbase, p) \n return p \n end \n function path.replaceextension(p, newext) \n local ext = path.getextension(p) \n if not ext then \n return p \n end \n if #newext > 0 and not newext:findlast( \" . \" , true) then \n newext = \" . \" ..newext \n end \n return p:match( \" ^(.*) \" ..ext.. \" $ \" )..newext \n end \n " ,
" st) == b:sub(1,tst) then \n idx = tst \n else \n break \n end \n else \n break \n end \n end \n local result = '' \n if idx > 1 then \n result = a:sub(1, idx - 1)-- Remove the trailing slash to be consistent with other functions. \n end \n return result \n end \n function path.hasextension(fname, extensions) \n local fext = path.getextension(fname):lower() \n if type(extensions) == \" table \" then \n for _, extension in pairs(extensions) do \n if fext == extension then \n return true \n end \n end \n return false \n else \n return (fext == extensions) \n end \n end \n function path.iscfile(fname) \n return path.hasextension(fname, { \" .c \" , \" .m \" }) \n end \n function path.iscppfile(fname) \n return path.hasextension(fname, { \" .cc \" , \" .cpp \" , \" .cxx \" , \" .c ++\" , \" .c \" , \" .m \" , \" .mm \" }) \n end \n function path.iscxfile(fname) \n return path.hasextension(fname, \" .cx \" ) \n end \n function path.isobjcfile(fname) \n return path.hasextension(fname, { \" .m \" , \" .mm \" }) \n end \n function path.iscppheader(fname) \n return path.hasextension(fname, { \" .h \" , \" .hh \" , \" .hpp \" , \" .hxx \" }) \n end "
" \n function path.isappxmanifest(fname)\n return path.hasextension(fname, \" .appxmanifest \" ) \n end \n function path.isandroidbuildfile(fname) \n return path.getname(fname) == \" AndroidManifest.xml \" \n end \n function path.isnatvis(fname) \n return path.hasextension(fname, \" .natvis \" ) \n end \n function path.isasmfile(fname) \n return path.hasextension(fname, { \" .asm \" , \" .s \" , \" .S \" }) \n end \n function path.isvalafile(fname) \n return path.hasextension(fname, \" .vala \" ) \n end \n function path.isswiftfile(fname) \n return path.hasextension(fname, \" .swift \" ) \n end \n function path.issourcefile(fname) \n return path.iscfile(fname) \n or path.iscppfile(fname) \n or path.iscxfile(fname) \n or path.isasmfile(fname) \n or path.isvalafile(fname) \n or path.isswiftfile(fname) \n end \n function path.issourcefilevs(fname) \n return path.hasextension(fname, { \" .cc \" , \" .cpp \" , \" .cxx \" , \" .c ++\" , \" .c \" }) \n or path.iscxfile(fname) \n end \n function path.is objectfile(fname)\n return path.hasextension(fname, { \" .o \" , \" .obj \" }) \n end \n function path.isresourcefile(fname "
" )\n return path.hasextension(fname, \" .rc \" ) \n end \n function path.isimagefile(fname) \n local extensions = { \" .png \" } \n local ext = path.getextension(fname):lower() \n return table.contains(extensions, ext) \n end \n function path.join(...)\n local arg={...} \n local numargs = select( \" # \" , ...) \n if numargs == 0 then \n return \" \" ; \n end \n local allparts = {} \n for i = numargs, 1, -1 do \n local part = select(i, ...) \n if part and #part > 0 and part ~= \" . \" then \n while part:endswith( \" / \" ) do \n part = part:sub(1, -2) \n end \n table.insert(allparts, 1, part) \n if path.isabsolute(part) then \n break \n end \n end \n end \n return table.concat(allparts, \" / \" ) \n end \n function path.rebase(p, oldbase, newbase) \n p = path.getabsolute(path.join(oldbase, p)) \n p = path.getrelative(newbase, p) \n return p \n end \n function path.translate(p, sep) \n if (type(p) == \" table \" ) then \n local result = { } \n for _, value in ipairs(p) do \n table.insert(result, path.translate(value)) \n end \n return result \n else \n if (not sep) then \n if (os.is( \" windows \" )) then \n sep = \" \\ \\ \" "
" \n else \n sep = \" / \" \n end \n end \n local result = p:gsub( \" [/ \\ \\ ] \" , sep) \n return result \n end \n end \n function path.wildcards(pattern) \n pattern = pattern:gsub( \" ([%+%.%-%^%$%(%)%%]) \" , \" %%%1 \" ) \n pattern = pattern:gsub( \" %*%* \" , \" \\ 001 \" ) \n pattern = pattern:gsub( \" %* \" , \" \\ 002 \" ) \n pattern = pattern:gsub( \" \\ 001 \" , \" .* \" ) \n pattern = pattern:gsub( \" \\ 002 \" , \" [^/]* \" ) \n return pattern \n end \n function path.trimdots(p) \n local changed \n repeat \n changed = true \n if p:startswith( \" ./ \" ) then \n p = p:sub(3) \n elseif p:startswith( \" ../ \" ) then \n p = p:sub(4) \n else \n changed = false \n end \n until not changed \n return p \n end \n function path.rebase(p, oldbase, newbase) \n p = path.getabsolute(path.join(oldbase, p)) \n p = path.getrelative(newbase, p) \n return p \n end \n function path.replaceextension(p, newext) \n local ext = path.getextension(p) \n if not ext then \n return p \n end \n if #newext > 0 and not newext:findlast( \" . \" , true) then \n newext = \" . \" ..newext \n end \n return p:match( \" ^(.*) \" ..ext.. \" $ \" )..newext \n end \n " ,
/* base/string.lua */
" function string.explode(s, pattern, plain) \n if (pattern == '') then return false end \n local pos = 0 \n local arr = { } \n for st,sp in function() return s:find(pattern, pos, plain) end do \n table.insert(arr, s:sub(pos, st-1)) \n pos = sp + 1 \n end \n table.insert(arr, s:sub(pos)) \n return arr \n end \n function string.findlast(s, pattern, plain) \n local curr = 0 \n local term = nil \n repeat \n local next, nextterm = s:find(pattern, curr + 1, plain) \n if (next) then \n curr = next \n term = nextterm \n end \n until (not next) \n if (curr > 0) then \n return curr, term \n end \n end \n function string.startswith(haystack, needle) \n return (haystack:find(needle, 1, true) == 1) \n end \n function string.trim(s) \n return (s:gsub( \" ^%s*(.-)%s*$ \" , \" %1 \" )) \n end \n " ,
/* base/table.lua */
" function table.contains(t, value) \n for _, v in pairs(t) do \n if v == value then return true end \n end \n return false \n end \n function table.icontains(t, value) \n for _, v in ipairs(t) do \n if v == value then return true end \n end \n return false \n end \n function table.deepcopy(object) \n local seen = {} \n local function copy(object) \n if type(object) ~= \" table \" then \n return object \n elseif seen[object] then \n return seen[object] \n end \n local clone = {} \n seen[object] = clone \n for key, value in pairs(object) do \n clone[key] = copy(value) \n end \n setmetatable(clone, getmetatable(object)) \n return clone \n end \n return copy(object) \n end \n function table.extract(arr, fname) \n local result = { } \n for _,v in ipairs(arr) do \n table.insert(result, v[fname]) \n end \n return result \n end \n function table.flatten(arr) \n local result = { } \n local function flatten(arr) \n for _, v in ipairs(arr) do \n if type(v) == \" table \" then \n flatten(v) \n else \n table.insert(result, v) \n end \n end \n end \n flatten(arr) \n return result \n end \n function table.implode(arr, before, aft "
" er, between) \n local result = \" \" \n for _,v in ipairs(arr) do \n if (result ~= \" \" and between) then \n result = result .. between \n end \n result = result .. before .. v .. after \n end \n return result \n end \n function table.insertflat(tbl, values) \n if type(values) == \" table \" then \n for _, value in ipairs(values) do \n table.insertflat(tbl, value) \n end \n else \n table.insert(tbl, values) \n end \n end \n function table.isempty(t) \n return next(t) == nil \n end \n function table.join(...) \n local arg={...} \n local result = { } \n for _,t in ipairs(arg) do \n if type(t) == \" table \" then \n for _,v in ipairs(t) do \n table.insert(result, v) \n end \n else \n table.insert(result, t) \n end \n end \n return result \n end \n function table.keys(tbl) \n local keys = {} \n for k, _ in pairs(tbl) do \n table.insert(keys, k) \n end \n return keys \n end \n function table. merge(...)\n local arg={...} \n local result = { } \n for _,t in ipairs(arg) do \n if type(t) == \" table \" then \n for k,v in pairs(t) do \n result[k] = v \n end \n else \n error( \" invalid value \" ) \n end \n end \n return result \n end \n func "
" tion table.translate(arr, translation)\n local result = { } \n for _, value in ipairs(arr) do \n local tvalue \n if type(translation) == \" function \" then \n tvalue = translation(value) \n else \n tvalue = translation[value] \n end \n if (tvalue) then \n table.insert(result, tvalue) \n end \n end \n return result \n end \n function table.reverse(arr) \n for i=1, math.floor(#arr / 2) do \n arr[i], arr[#arr - i + 1] = arr[#arr - i + 1], arr[i] \n end \n return arr \n end \n function table.arglist(arg, value) \n if #value > 0 then \n local args = {} \n for _, val in ipairs(value) do \n table.insert(args, string.format( \" %s %s \" , arg, val)) \n end \n return table.concat(args, \" \" ) \n else \n return \" \" \n end \n end \n " ,
" er, between) \n local result = \" \" \n for _,v in ipairs(arr) do \n if (result ~= \" \" and between) then \n result = result .. between \n end \n result = result .. before .. v .. after \n end \n return result \n end \n function table.insertflat(tbl, values) \n if type(values) == \" table \" then \n for _, value in ipairs(values) do \n table.insertflat(tbl, value) \n end \n else \n table.insert(tbl, values) \n end \n end \n function table.isempty(t) \n return next(t) == nil \n end \n function table.join(...) \n local arg={...} \n local result = { } \n for _,t in ipairs(arg) do \n if type(t) == \" table \" then \n for _,v in ipairs(t) do \n table.insert(result, v) \n end \n else \n table.insert(result, t) \n end \n end \n return result \n end \n function table.keys(tbl) \n local keys = {} \n for k, _ in pairs(tbl) do \n table.insert(keys, k) \n end \n return keys \n end \n function table. sortedpairs(t)\n local keys = table.keys(t) \n local i = 0 \n table.sort(keys) \n return function() \n i = i + 1 \n if keys[i] == nil then \n return nil \n end \n return keys[i], t[keys[i]] \n end \n end \n function table.merge(...) \n local "
" arg={...}\n local result = { } \n for _,t in ipairs(arg) do \n if type(t) == \" table \" then \n for k,v in pairs(t) do \n result[k] = v \n end \n else \n error( \" invalid value \" ) \n end \n end \n return result \n end \n func tion table.translate(arr, translation)\n local result = { } \n for _, value in ipairs(arr) do \n local tvalue \n if type(translation) == \" function \" then \n tvalue = translation(value) \n else \n tvalue = translation[value] \n end \n if (tvalue) then \n table.insert(result, tvalue) \n end \n end \n return result \n end \n function table.reverse(arr) \n for i=1, math.floor(#arr / 2) do \n arr[i], arr[#arr - i + 1] = arr[#arr - i + 1], arr[i] \n end \n return arr \n end \n function table.arglist(arg, value) \n if #value > 0 then \n local args = {} \n for _, val in ipairs(value) do \n table.insert(args, string.format( \" %s %s \" , arg, val)) \n end \n return table.concat(args, \" \" ) \n else \n return \" \" \n end \n end \n " ,
/* base/io.lua */
" io.eol = \" \\ n \" \n io.indent = \" \\ t \" \n io.indentLevel = 0 \n local function _escaper(v) return v end \n _esc = _escaper \n function io.capture() \n io.captured = ''\n end\n function io.endcapture( )\n local captured = io.captured \n io.captured = nil \n return captured \n end \n local builtin_open = io.open \n function io.open(fname, mode) \n if (mode) then \n if (mode:find( \" w \" )) then \n local dir = path.getdirectory(fname) \n ok, err = os.mkdir(dir) \n if (not ok) then \n error(err, 0) \n end \n end \n end \n return builtin_open(fname, mode) \n end \n function io.printf(msg, ...) \n local arg={...} \n if not io.eol then \n io.eol = \" \\ n \" \n end \n if not io.indent then \n io.indent = \" \\ t \" \n end \n if type(msg) == \" number \" then \n s = string.rep(io.indent, msg) .. string.format(table.unpack(arg)) \n else \n s = string.format(msg, table.unpack(arg)) \n end \n if io.captured then \n io.captured = io.captured .. s .. io.eol \n else \n io.write(s) \n io.write(io.eol) \n end \n end \n function io.xprintf(msg, ...) \n local arg = {...}\n for i = 1, #arg do \n arg[i] = io.esc(arg[i]) "
" \n end \n io.printf(msg, unpack(arg)) \n end \n function io.esc(value) \n if type(value) == \" table \" then \n local result = {} \n local n = #value \n for i = 1, n do \n table.insert(result, io.esc(value[i])) \n end \n return result \n end \n return _esc(value or \" \" ) \n end \n function io.escaper(func) \n _esc = func or _escaper \n end \n _p = io.printf \n _x = io.xprintf \n " ,
" io.eol = \" \\ n \" \n io.indent = \" \\ t \" \n io.indentLevel = 0 \n local function _escaper(v) return v end \n _esc = _escaper \n function io.capture() \n local prev = io.captured\n io.captured = ''\n return prev\n end\n function io.endcapture( restore )\n local captured = io.captured \n io.captured = restore \n return captured \n end \n local builtin_open = io.open \n function io.open(fname, mode) \n if (mode) then \n if (mode:find( \" w \" )) then \n local dir = path.getdirectory(fname) \n ok, err = os.mkdir(dir) \n if (not ok) then \n error(err, 0) \n end \n end \n end \n return builtin_open(fname, mode) \n end \n function io.printf(msg, ...) \n local arg={...} \n if not io.eol then \n io.eol = \" \\ n \" \n end \n if not io.indent then \n io.indent = \" \\ t \" \n end \n if type(msg) == \" number \" then \n s = string.rep(io.indent, msg) .. string.format(table.unpack(arg)) \n else \n s = string.format(msg, table.unpack(arg)) \n end \n if io.captured then \n io.captured = io.captured .. s .. io.eol \n else \n io.write(s) \n io.write(io.eol) \n end \n end \n function io.xprintf(msg, ...) \n local arg = "
" {...} \n for i = 1, #arg do \n arg[i] = io.esc(arg[i]) \n end \n io.printf(msg, unpack(arg)) \n end \n function io.esc(value) \n if type(value) == \" table \" then \n local result = {} \n local n = #value \n for i = 1, n do \n table.insert(result, io.esc(value[i])) \n end \n return result \n end \n return _esc(value or \" \" ) \n end \n function io.escaper(func) \n _esc = func or _escaper \n end \n _p = io.printf \n _x = io.xprintf \n " ,
/* base/globals.lua */
" premake = { } \n premake.platforms = \n { \n Native = \n { \n cfgsuffix = \" \" , \n }, \n x32 = \n { \n cfgsuffix = \" 32 \" , \n }, \n x64 = \n { \n cfgsuffix = \" 64 \" , \n }, \n Universal = \n { \n cfgsuffix = \" univ \" , \n }, \n Universal32 = \n { \n cfgsuffix = \" univ32 \" , \n }, \n Universal64 = \n { \n cfgsuffix = \" univ64 \" , \n }, \n PS3 = \n { \n cfgsuffix = \" ps3 \" , \n iscrosscompiler = true, \n nosharedlibs = true, \n namestyle = \" PS3 \" , \n }, \n WiiDev = \n { \n cfgsuffix = \" wii \" , \n iscrosscompiler = true, \n namestyle = \" PS3 \" , \n }, \n Xbox360 = \n { \n cfgsuffix = \" xbox360 \" , \n iscrosscompiler = true, \n namestyle = \" windows \" , \n }, \n PowerPC = \n { \n cfgsuffix = \" ppc \" , \n iscrosscompiler = true, \n }, \n ARM = \n { \n cfgsuffix = \" ARM \" , \n iscrosscompiler = true, \n }, \n Orbis = \n { \n cfgsuffix = \" orbis \" , \n iscrosscompiler = true, \n namestyle = \" Orbis \" , \n }, \n Durango = \n { \n cfgsuffix = \" durango \" , \n iscrosscompiler = true, \n nosharedlibs = true, \n namestyle = \" windows \" , \n }, \n } \n local bu "
" iltin_dofile = dofile \n function dofile(fname) \n local oldcwd = os.getcwd() \n local oldfile = _SCRIPT \n if (not os.isfile(fname)) then \n local path = os.pathsearch(fname, _OPTIONS[ \" scripts \" ], os.getenv( \" PREMAKE_PATH \" )) \n if (path) then \n fname = path.. \" / \" ..fname \n end \n end \n _SCRIPT = path.getabsolute(fname) \n local newcwd = path.getdirectory(_SCRIPT) \n os.chdir(newcwd) \n local a, b, c, d, e, f = builtin_dofile(_SCRIPT) \n _SCRIPT = oldfile \n os.chdir(oldcwd) \n return a, b, c, d, e, f \n end \n function iif(expr, trueval, falseval) \n if (expr) then \n return trueval \n else \n return falseval \n end \n end \n function include(fname) \n local dir, name = premake.findDefaultScript(fname, false) \n if dir ~= nil then \n return dofile(dir .. \" / \" .. name) \n end \n return nil \n end \n function printf(msg, ...) \n local arg={...} \n print(string.format(msg, table.unpack(arg))) \n end \n function typex(t) \n local mt = getmetatable(t) \n if (mt) then \n if (mt.__type) then \n return mt.__type \n end \n end \n return type(t) \n end \n " ,
" premake = { } \n premake.platforms = \n { \n Native = \n { \n cfgsuffix = \" \" , \n }, \n x32 = \n { \n cfgsuffix = \" 32 \" , \n }, \n x64 = \n { \n cfgsuffix = \" 64 \" , \n }, \n Universal = \n { \n cfgsuffix = \" univ \" , \n }, \n Universal32 = \n { \n cfgsuffix = \" univ32 \" , \n }, \n Universal64 = \n { \n cfgsuffix = \" univ64 \" , \n }, \n PS3 = \n { \n cfgsuffix = \" ps3 \" , \n iscrosscompiler = true, \n nosharedlibs = true, \n namestyle = \" PS3 \" , \n }, \n WiiDev = \n { \n cfgsuffix = \" wii \" , \n iscrosscompiler = true, \n namestyle = \" PS3 \" , \n }, \n Xbox360 = \n { \n cfgsuffix = \" xbox360 \" , \n iscrosscompiler = true, \n namestyle = \" windows \" , \n }, \n PowerPC = \n { \n cfgsuffix = \" ppc \" , \n iscrosscompiler = true, \n }, \n ARM = \n { \n cfgsuffix = \" ARM \" , \n iscrosscompiler = true, \n }, \n Orbis = \n { \n cfgsuffix = \" orbis \" , \n iscrosscompiler = true, \n namestyle = \" Orbis \" , \n }, \n Durango = \n { \n cfgsuffix = \" durango \" , \n iscrosscompiler = true, \n nosharedlibs = true, \n namestyle = \" windows \" , \n }, \n TegraAndroi "
" d = \n { \n cfgsuffix = \" tegraandroid \" , \n iscrosscompiler = true, \n namestyle = \" TegraAndroid \" , \n }, \n NX32 = \n { \n cfgsuffix = \" nx32 \" , \n iscrosscompiler = true, \n namestyle = \" NX \" , \n }, \n NX64 = \n { \n cfgsuffix = \" nx64 \" , \n iscrosscompiler = true, \n namestyle = \" NX \" , \n }, \n Emscripten = \n { \n cfgsuffix = \" emscripten \" , \n iscrosscompiler = true, \n nosharedlibs = true, \n namestyle = \" Emscripten \" , \n }, \n } \n local builtin_dofile = dofile \n function dofile(fname) \n local oldcwd = os.getcwd() \n local oldfile = _SCRIPT \n if (not os.isfile(fname)) then \n local path = os.pathsearch(fname, _OPTIONS[ \" scripts \" ], os.getenv( \" PREMAKE_PATH \" )) \n if (path) then \n fname = path.. \" / \" ..fname \n end \n end \n _SCRIPT = path.getabsolute(fname) \n local newcwd = path.getdirectory(_SCRIPT) \n os.chdir(newcwd) \n local a, b, c, d, e, f = builtin_dofile(_SCRIPT) \n _SCRIPT = oldfile \n os.chdir(oldcwd) \n return a, b, c, d, e, f \n end \n function iif(expr, trueval, falseval) \n if (expr) then \n return trueval \n else \n return "
" falseval \n end \n end \n function include(fname) \n local dir, name = premake.findDefaultScript(fname, false) \n if dir ~= nil then \n return dofile(dir .. \" / \" .. name) \n end \n return nil \n end \n function printf(msg, ...) \n local arg={...} \n print(string.format(msg, table.unpack(arg))) \n end \n function typex(t) \n local mt = getmetatable(t) \n if (mt) then \n if (mt.__type) then \n return mt.__type \n end \n end \n return type(t) \n end \n " ,
/* base/action.lua */
" premake.action = { } \n premake.action.list = { } \n function premake.action.add(a) \n local missing \n for _, field in ipairs({ \" description \" , \" trigger \" }) do \n if (not a[field]) then \n missing = field \n end \n end \n if (missing) then \n error( \" action needs a \" .. missing, 3) \n end \n premake.action.list[a.trigger] = a \n end \n function premake.action.call(name) \n local a = premake.action.list[name] \n for sln in premake.solution.each() do \n if a.onsolution then \n a.onsolution(sln) \n end \n for prj in premake.solution.eachproject(sln) do\n if a.onproject then \n a.onproject(prj) \n end \n end \n end \n if a.execute then \n a.execute() \n end \n end \n function premake.action.current() \n return premake.action.get(_ACTION) \n end \n function premake.action.get(name) \n return premake.action.list[name] \n end \n function premake.action.each() \n local keys = { } \n for _, action in pairs(premake.action.list) do\n table.insert(keys, action.trigger) \n end \n table.sort(keys) \n local i = 0 \n return function() \n i = i + 1 \n return premake.action.list[keys[i]] \n end \n end \n function pre "
" make.action.set(name)\n _ACTION = name \n local action = premake.action.get(name) \n if action then \n _OS = action.os or _OS \n end \n end \n function premake.action.supports(action, feature) \n if not action then \n return false \n end \n if action.valid_languages then \n if table.contains(action.valid_languages, feature) then \n return true \n end \n end \n if action.valid_kinds then \n if table.contains(action.valid_kinds, feature) then \n return true \n end \n end \n return false \n end \n " ,
" premake.action = { } \n premake.action.list = { } \n function premake.action.add(a) \n local missing \n for _, field in ipairs({ \" description \" , \" trigger \" }) do \n if (not a[field]) then \n missing = field \n end \n end \n if (missing) then \n error( \" action needs a \" .. missing, 3) \n end \n premake.action.list[a.trigger] = a \n end \n function premake.action.call(name) \n local a = premake.action.list[name] \n for sln in premake.solution.each() do \n if a.onsolution then \n a.onsolution(sln) \n end \n if sln.postsolutioncallbacks then\n for _,cb in ipairs(sln.postsolutioncallbacks) do \n cb(sln) \n end \n end \n for prj in premake.solution.eachproject(sln) do\n if a.onproject then \n a.onproject(prj) \n end \n if prj.postprojectcallbacks then \n for _,cb in ipairs(prj.postprojectcallbacks) do \n cb(prj) \n end \n end \n end \n end \n if a.execute then \n a.execute() \n end \n end \n function premake.action.current() \n return premake.action.get(_ACTION) \n end \n function premake.action.get(name) \n return premake.action.list[name] \n end \n function premake.action.each() \n local keys = { } \n for "
" _, action in pairs(premake.action.list) do\n table.insert(keys, action.trigger) \n end \n table.sort(keys) \n local i = 0 \n return function() \n i = i + 1 \n return premake.action.list[keys[i]] \n end \n end \n function pre make.action.set(name)\n _ACTION = name \n local action = premake.action.get(name) \n if action then \n _OS = action.os or _OS \n end \n end \n function premake.action.supports(action, feature) \n if not action then \n return false \n end \n if action.valid_languages then \n if table.contains(action.valid_languages, feature) then \n return true \n end \n end \n if action.valid_kinds then \n if table.contains(action.valid_kinds, feature) then \n return true \n end \n end \n return false \n end \n " ,
/* base/option.lua */
" premake.option = { } \n premake.option.list = { } \n function premake.option.add(opt) \n local missing \n for _, field in ipairs({ \" description \" , \" trigger \" }) do \n if (not opt[field]) then \n missing = field \n end \n end \n if (missing) then \n error( \" option needs a \" .. missing, 3) \n end \n premake.option.list[opt.trigger] = opt \n end \n function premake.option.get(name) \n return premake.option.list[name] \n end \n function premake.option.each() \n local keys = { } \n for _, option in pairs(premake.option.list) do \n table.insert(keys, option.trigger) \n end \n table.sort(keys) \n local i = 0 \n return function() \n i = i + 1 \n return premake.option.list[keys[i]] \n end \n end \n function premake.option.validate(values) \n for key, value in pairs(values) do \n local opt = premake.option.get(key) \n if (not opt) then \n return false, \" invalid option ' \" .. key .. \" ' \" \n end \n if (opt.value and value == \" \" ) then \n return false, \" no value specified for option ' \" .. key .. \" ' \" \n end \n if opt.allowed then \n local found = false \n for _, match in ipairs(opt.allowed) d "
@ -57,54 +58,61 @@ const char* builtin_scripts[] = {
" ntains(results, dep) then \n table.insert(results, dep) \n end \n end \n end \n return results \n end \n function premake.project.getbasename(prjname, pattern) \n return pattern:gsub( \" %%%% \" , prjname) \n end \n function premake.project.getfilename(prj, pattern) \n local fname = premake.project.getbasename(prj.name, pattern) \n fname = path.join(prj.location, fname) \n return path.getrelative(os.getcwd(), fname) \n end \n function premake.getlinks(cfg, kind, part) \n local result = iif (part == \" directory \" and kind == \" all \" , cfg.libdirs, {}) \n local cfgname = iif(cfg.name == cfg.project.name, \" \" , cfg.name) \n local pathstyle = premake.getpathstyle(cfg) \n local namestyle = premake.getnamestyle(cfg) \n local function canlink(source, target) \n if (target.kind ~= \" SharedLib \" and target.kind ~= \" StaticLib \" ) then \n return false \n end \n if premake.iscppproject(source) then \n return premake.iscppproject(target) \n elseif premake.isdotnetproject(source) then \n return premake.isdotnetproject(target) \n elseif premake.isswiftproject(source) then \n return pre "
" make.isswiftproject(source) or premake.iscppproject(source) \n end \n end \n for _, link in ipairs(cfg.links) do \n local item \n local prj = premake.findproject(link) \n if prj and kind ~= \" system \" then \n local prjcfg = premake.getconfig(prj, cfgname, cfg.platform) \n if kind == \" dependencies \" or canlink(cfg, prjcfg) then \n if (part == \" directory \" ) then \n item = path.rebase(prjcfg.linktarget.directory, prjcfg.location, cfg.location) \n elseif (part == \" basename \" ) then \n item = prjcfg.linktarget.basename \n elseif (part == \" fullpath \" ) then \n item = path.rebase(prjcfg.linktarget.fullpath, prjcfg.location, cfg.location) \n elseif (part == \" object \" ) then \n item = prjcfg \n end \n end \n elseif not prj and (kind == \" system \" or kind == \" all \" ) then \n if (part == \" directory \" ) then \n item = path.getdirectory(link) \n elseif (part == \" fullpath \" ) then \n item = link \n if namestyle == \" windows \" then \n if premake.iscppproject(cfg) then \n item = item .. \" .lib \" \n elseif premake.isdotnetproject(cfg) then \n item = item .. \" .dll \" \n end \n end \n el "
" seif part == \" name \" then \n item = path.getname(link) \n elseif part == \" basename \" then \n item = path.getbasename(link) \n else \n item = link \n end \n if item:find( \" / \" , nil, true) then \n item = path.getrelative(cfg.project.location, item) \n end \n end \n if item then \n if pathstyle == \" windows \" and part ~= \" object \" then \n item = path.translate(item, \" \\ \\ \" ) \n end \n if not table.contains(result, item) then \n table.insert(result, item) \n end \n end \n end \n return result \n end \n function premake.getnamestyle(cfg) \n return premake.platforms[cfg.platform].namestyle or premake.gettool(cfg).namestyle or \" posix \" \n end \n function premake.getpathstyle(cfg) \n if premake.action.current().os == \" windows \" then \n return \" windows \" \n else \n return \" posix \" \n end \n end \n function premake.gettarget(cfg, direction, pathstyle, namestyle, system) \n if system == \" bsd \" then \n system = \" linux \" \n end \n local kind = cfg.kind \n if premake.iscppproject(cfg) then \n if (namestyle == \" windows \" or system == \" windows \" ) \n and kind == \" SharedLib \" and direction = "
" = \" link \" \n and not cfg.flags.NoImportLib \n then \n kind = \" StaticLib \" \n end \n if namestyle == \" posix \" and system == \" windows \" and kind ~= \" StaticLib \" then \n namestyle = \" windows \" \n end \n end \n local field = \" build \" \n if direction == \" link \" and cfg.kind == \" SharedLib \" then \n field = \" implib \" \n end \n local name = cfg[field.. \" name \" ] or cfg.targetname or cfg.project.name \n local dir = cfg[field.. \" dir \" ] or cfg.targetdir or path.getrelative(cfg.location, cfg.basedir) \n local subdir = cfg[field.. \" subdir \" ] or cfg.targetsubdir or \" . \" \n local prefix = \" \" \n local suffix = \" \" \n local ext = \" \" \n local bundlepath, bundlename \n dir = path.join(dir, subdir) \n if namestyle == \" windows \" then \n if kind == \" ConsoleApp \" or kind == \" WindowedApp \" then \n ext = \" .exe \" \n elseif kind == \" SharedLib \" then \n ext = \" .dll \" \n elseif kind == \" StaticLib \" then \n ext = \" .lib \" \n end \n elseif namestyle == \" posix \" then \n if kind == \" WindowedApp \" and system == \" macosx \" then \n bundlename = name .. \" .app \" \n bund "
" lepath = path.join(dir, bundlename) \n dir = path.join(bundlepath, \" Contents/MacOS \" ) \n elseif (kind == \" ConsoleApp \" or kind == \" WindowedApp \" ) and system == \" os2 \" then \n ext = \" .exe \" \n elseif kind == \" SharedLib \" then \n prefix = \" lib \" \n ext = iif(system == \" macosx \" , \" .dylib \" , \" .so \" ) \n elseif kind == \" StaticLib \" then \n prefix = \" lib \" \n ext = \" .a \" \n end \n elseif namestyle == \" PS3 \" then \n if kind == \" ConsoleApp \" or kind == \" WindowedApp \" then \n ext = \" .elf \" \n elseif kind == \" StaticLib \" then \n prefix = \" lib \" \n ext = \" .a \" \n end \n elseif namestyle == \" Orbis \" then \n if kind == \" ConsoleApp \" or kind == \" WindowedApp \" then \n ext = \" .elf \" \n elseif kind == \" StaticLib \" then \n prefix = \" lib \" \n ext = \" .a \" \n elseif kind == \" SharedLib \" then \n ext = \" .prx \" \n end \n end \n prefix = cfg[field.. \" prefix \" ] or cfg.targetprefix or prefix \n suffix = cfg[field.. \" suffix \" ] or cfg.targetsuffix or suffix \n ext = cfg[field.. \" extension \" ] or cfg.targetextension or ext \n local result = { } \n result.basename = nam "
" e .. suffix \n result.name = prefix .. name .. suffix .. ext \n result.directory = dir \n result.subdirectory = subdir \n result.prefix = prefix \n result.suffix = suffix \n result.fullpath = path.join(result.directory, result.name) \n result.bundlepath = bundlepath or result.fullpath \n if pathstyle == \" windows \" then \n result.directory = path.translate(result.directory, \" \\ \\ \" ) \n result.subdirectory = path.translate(result.subdirectory, \" \\ \\ \" ) \n result.fullpath = path.translate(result.fullpath, \" \\ \\ \" ) \n end \n return result \n end \n function premake.gettool(cfg) \n if premake.iscppproject(cfg) then \n if _OPTIONS.cc then \n return premake[_OPTIONS.cc] \n end \n local action = premake.action.current() \n if action.valid_tools then \n return premake[action.valid_tools.cc[1]] \n end \n return premake.gcc \n elseif premake.isdotnetproject(cfg) then \n return premake.dotnet \n elseif premake.isswiftproject(cfg) then \n return premake.swift \n else \n return premake.valac \n end \n end \n function premake.project.getvpath(prj, a "
" bspath) \n local vpath = abspath \n local fname = path.getname(abspath) \n local max = abspath:len() - fname:len() \n \n -- First check for an exact match from the inverse vpaths \n if prj.inversevpaths and prj.inversevpaths[abspath] then \n return path.join(prj.inversevpaths[abspath], fname) \n end \n local matches = {} \n for replacement, patterns in pairs(prj.vpaths or {}) do \n for _, pattern in ipairs(patterns) do \n local i = abspath:find(path.wildcards(pattern)) \n if i == 1 then \n i = pattern:find( \" * \" , 1, true) or (pattern:len() + 1) \n local leaf \n if i < max then \n leaf = abspath:sub(i) \n else \n leaf = fname \n end \n if leaf:startswith( \" / \" ) then \n leaf = leaf:sub(2) \n end \n local stem = \" \" \n if replacement:len() > 0 then \n stem, stars = replacement:gsub( \" %* \" , \" \" ) \n if stars == 0 then \n leaf = path.getname(leaf) \n end \n else \n leaf = path.getname(leaf) \n end \n table.insert(matches, path.join(stem, leaf)) \n end \n end \n end \n \n if #matches > 0 then \n -- for the sake "
" of determinism, return the first alphabetically \n table.sort(matches) \n vpath = matches[1] \n end \n return path.trimdots(vpath) \n end \n function premake.hascppproject(sln) \n for prj in premake.solution.eachproject(sln) do \n if premake.iscppproject(prj) then \n return true \n end \n end \n end \n function premake.hasdotnetproject(sln) \n for prj in premake.solution.eachproject(sln) do \n if premake.isdotnetproject(prj) then \n return true \n end \n end \n end \n function premake.project.iscproject(prj) \n return prj.language == \" C \" \n end \n function premake.iscppproject(prj) \n return (prj.language == \" C \" or prj.language == \" C++ \" ) \n end \n function premake.isdotnetproject(prj) \n return (prj.language == \" C# \" ) \n end \n function premake.isvalaproject(prj) \n return (prj.language == \" Vala \" ) \n end \n function premake.isswiftproject(prj) \n return (prj.language == \" Swift \" ) \n end \n " ,
" = \" link \" \n and not cfg.flags.NoImportLib \n then \n kind = \" StaticLib \" \n end \n if namestyle == \" posix \" and system == \" windows \" and kind ~= \" StaticLib \" then \n namestyle = \" windows \" \n end \n end \n local field = \" build \" \n if direction == \" link \" and cfg.kind == \" SharedLib \" then \n field = \" implib \" \n end \n local name = cfg[field.. \" name \" ] or cfg.targetname or cfg.project.name \n local dir = cfg[field.. \" dir \" ] or cfg.targetdir or path.getrelative(cfg.location, cfg.basedir) \n local subdir = cfg[field.. \" subdir \" ] or cfg.targetsubdir or \" . \" \n local prefix = \" \" \n local suffix = \" \" \n local ext = \" \" \n local bundlepath, bundlename \n dir = path.join(dir, subdir) \n if namestyle == \" windows \" then \n if kind == \" ConsoleApp \" or kind == \" WindowedApp \" then \n ext = \" .exe \" \n elseif kind == \" SharedLib \" then \n ext = \" .dll \" \n elseif kind == \" StaticLib \" then \n ext = \" .lib \" \n end \n elseif namestyle == \" posix \" then \n if kind == \" WindowedApp \" and system == \" macosx \" and not cfg.options.SkipBundling then \n bu "
" ndlename = name .. \" .app \" \n bundlepath = path.join(dir, bundlename) \n dir = path.join(bundlepath, \" Contents/MacOS \" ) \n elseif (kind == \" ConsoleApp \" or kind == \" WindowedApp \" ) and system == \" os2 \" then \n ext = \" .exe \" \n elseif kind == \" SharedLib \" then \n prefix = \" lib \" \n ext = iif(system == \" macosx \" , \" .dylib \" , \" .so \" ) \n elseif kind == \" StaticLib \" then \n prefix = \" lib \" \n ext = \" .a \" \n end \n elseif namestyle == \" PS3 \" then \n if kind == \" ConsoleApp \" or kind == \" WindowedApp \" then \n ext = \" .elf \" \n elseif kind == \" StaticLib \" then \n prefix = \" lib \" \n ext = \" .a \" \n end \n elseif namestyle == \" Orbis \" then \n if kind == \" ConsoleApp \" or kind == \" WindowedApp \" then \n ext = \" .elf \" \n elseif kind == \" StaticLib \" then \n prefix = \" lib \" \n ext = \" .a \" \n elseif kind == \" SharedLib \" then \n ext = \" .prx \" \n end \n elseif namestyle == \" TegraAndroid \" then \n if kind == \" ConsoleApp \" or kind == \" WindowedApp \" or kind == \" SharedLib \" then \n prefix = \" lib \" \n ext = \" .so \" \n elseif kind == \" StaticLib \" then \n prefix = \" lib "
" \" \n ext = \" .a \" \n end \n elseif namestyle == \" NX \" then \n if kind == \" ConsoleApp \" or kind == \" WindowedApp \" then \n ext = \" .nspd_root \" \n elseif kind == \" StaticLib \" then \n ext = \" .a \" \n elseif kind == \" SharedLib \" then \n ext = \" .nro \" \n end \n elseif namestyle == \" Emscripten \" then \n if kind == \" ConsoleApp \" or kind == \" WindowedApp \" then \n ext = \" .html \" \n elseif kind == \" StaticLib \" then \n ext = \" .bc \" \n elseif kind == \" SharedLib \" then \n ext = \" .js \" \n end \n end \n prefix = cfg[field.. \" prefix \" ] or cfg.targetprefix or prefix \n suffix = cfg[field.. \" suffix \" ] or cfg.targetsuffix or suffix \n ext = cfg[field.. \" extension \" ] or cfg.targetextension or ext \n local result = { } \n result.basename = name .. suffix \n result.name = prefix .. name .. suffix .. ext \n result.directory = dir \n result.subdirectory = subdir \n result.prefix = prefix \n result.suffix = suffix \n result.fullpath = path.join(result.directory, result.name) \n result.bundlepath = bundlepath or result.fullpath \n if pathstyle == "
" \" windows \" then \n result.directory = path.translate(result.directory, \" \\ \\ \" ) \n result.subdirectory = path.translate(result.subdirectory, \" \\ \\ \" ) \n result.fullpath = path.translate(result.fullpath, \" \\ \\ \" ) \n end \n return result \n end \n function premake.gettool(cfg) \n if premake.iscppproject(cfg) then \n if _OPTIONS.cc then \n return premake[_OPTIONS.cc] \n end \n local action = premake.action.current() \n if action.valid_tools then \n return premake[action.valid_tools.cc[1]] \n end \n return premake.gcc \n elseif premake.isdotnetproject(cfg) then \n return premake.dotnet \n elseif premake.isswiftproject(cfg) then \n return premake.swift \n else \n return premake.valac \n end \n end \n function premake.project.getvpath(prj, abspath) \n local vpath = abspath \n local fname = path.getname(abspath) \n local max = abspath:len() - fname:len() \n \n -- First check for an exact match from the inverse vpaths \n if prj.inversevpaths and prj.inversevpaths[abspath] then \n return path.join(prj.inversevpaths[abspath], fname) \n "
" end \n local matches = {} \n for replacement, patterns in pairs(prj.vpaths or {}) do \n for _, pattern in ipairs(patterns) do \n local i = abspath:find(path.wildcards(pattern)) \n if i == 1 then \n i = pattern:find( \" * \" , 1, true) or (pattern:len() + 1) \n local leaf \n if i < max then \n leaf = abspath:sub(i) \n else \n leaf = fname \n end \n if leaf:startswith( \" / \" ) then \n leaf = leaf:sub(2) \n end \n local stem = \" \" \n if replacement:len() > 0 then \n stem, stars = replacement:gsub( \" %* \" , \" \" ) \n if stars == 0 then \n leaf = path.getname(leaf) \n end \n else \n leaf = path.getname(leaf) \n end \n table.insert(matches, path.join(stem, leaf)) \n end \n end \n end \n \n if #matches > 0 then \n -- for the sake of determinism, return the first alphabetically \n table.sort(matches) \n vpath = matches[1] \n end \n return path.trimdots(vpath) \n end \n function premake.hascppproject(sln) \n for prj in premake.solution.eachproject(sln) do \n if premake.iscppproject(prj) then \n return true \n end \n end \n end \n functio "
" n premake.hasdotnetproject(sln) \n for prj in premake.solution.eachproject(sln) do \n if premake.isdotnetproject(prj) then \n return true \n end \n end \n end \n function premake.project.iscproject(prj) \n return prj.language == \" C \" \n end \n function premake.iscppproject(prj) \n return (prj.language == \" C \" or prj.language == \" C++ \" ) \n end \n function premake.isdotnetproject(prj) \n return (prj.language == \" C# \" ) \n end \n function premake.isvalaproject(prj) \n return (prj.language == \" Vala \" ) \n end \n function premake.isswiftproject(prj) \n return (prj.language == \" Swift \" ) \n end \n " ,
/* base/config.lua */
" premake.config = { } \n local config = premake.config \n function premake.config.isdebugbuild(cfg) \n if cfg.flags.DebugRuntime then \n return true \n end \n if cfg.flags.ReleaseRuntime then \n return false \n end \n if cfg.flags.Optimize or cfg.flags.OptimizeSize or cfg.flags.OptimizeSpeed then \n return false \n end \n if not cfg.flags.Symbols then \n return false \n end \n return true \n end \n function premake.config.eachfile(cfg) \n local i = 0 \n local t = cfg.files \n return function () \n i = i + 1 \n if (i <= #t) then \n local fcfg = cfg.__fileconfigs[t[i]] \n fcfg.vpath = premake.project.getvpath(cfg.project, fcfg.name) \n return fcfg \n end \n end \n end \n function premake.config.isincrementallink(cfg) \n if cfg.kind == \" StaticLib \" \n or config.isoptimizedbuild(cfg.flags) \n or cfg.flags.NoIncrementalLink then \n return false \n end \n return true \n end \n function premake.config.isoptimizedbuild(flags) \n return flags.Optimize or flags.OptimizeSize or flags.OptimizeSpeed \n end \n " ,
" premake.config = { } \n local config = premake.config \n function premake.config.isdebugbuild(cfg) \n if cfg.flags.DebugRuntime then \n return true \n end \n if cfg.flags.ReleaseRuntime then \n return false \n end \n if cfg.flags.Optimize or cfg.flags.OptimizeSize or cfg.flags.OptimizeSpeed then \n return false \n end \n if not cfg.flags.Symbols then \n return false \n end \n return true \n end \n function premake.config.eachfile(cfg) \n local i = 0 \n local t = cfg.files \n return function () \n i = i + 1 \n if (i <= #t) then \n local fcfg = cfg.__fileconfigs[t[i]] \n fcfg.vpath = premake.project.getvpath(cfg.project, fcfg.name) \n return fcfg \n end \n end \n end \n function premake.config.isincrementallink(cfg) \n if cfg.kind == \" StaticLib \" then \n return false \n end \n return not config.islinkeroptimizedbuild(cfg.flags) and not cfg.flags.NoIncrementalLink \n end \n function premake.config.isoptimizedbuild(flags) \n return flags.Optimize or flags.OptimizeSize or flags.OptimizeSpeed \n end \n function premake.config.islinkeroptimizedbuild(flags) \n return config.isoptimizedbuild(fl "
" ags) and not flags.NoOptimizeLink \n end \n function premake.config.iseditandcontinue(cfg) \n if cfg.flags.NoEditAndContinue \n or cfg.flags.Managed \n or (cfg.kind ~= \" StaticLib \" and not config.isincrementallink(cfg)) \n or config.islinkeroptimizedbuild(cfg.flags) then \n return false \n end \n return true \n end \n " ,
/* base/bake.lua */
" premake.bake = { } \n local bake = premake.bake \n local nocopy = \n { \n blocks = true, \n keywords = true, \n projects = true, \n __configs = true, \n } \n local nocascade = \n { \n makesettings = true, \n } \n local keeprelative = \n { \n basedir = true, \n location = true, \n } \n function premake.getactiveterms( )\n local terms = { _action = _ACTION:lower(), os = os.get() } \n for key, value in pairs(_OPTIONS) do \n if value ~= \" \" then \n table.insert(terms, value:lower()) \n else \n table.insert(terms, key:lower()) \n end \n end \n return terms \n end \n function premake.iskeywordmatch(keyword, terms) \n if keyword:startswith( \" not \" ) then \n return not premake.iskeywordmatch(keyword:sub(5), terms) \n end \n for _, pattern in ipairs(keyword:explode( \" or \" )) do \n for termkey, term in pairs(terms) do \n if term:match(pattern) == term then \n return termkey \n end \n end \n end \n end \n function premake.iskeywordsmatch(keywords, terms) \n local hasrequired = false \n for _, keyword in ipairs(keywords) do \n local matched = premake.iskeywordmatch(keyword, terms) \n if not matched the "
" n\n return false \n end \n if matched == \" required \" then \n hasrequired = true \n end \n end \n if terms.required and not hasrequired then \n return false \n else \n return true \n end \n end \n local function adjustpaths(location, obj) \n function adjustpathlist(list) \n for i, p in ipairs(list) do \n list[i] = path.getrelative(location, p) \n end \n end \n if obj.allfiles ~= nil then \n adjustpathlist(obj.allfiles) \n end \n for name, value in pairs(obj) do \n local field = premake.fields[name] \n if field and value and not keeprelative[name] then \n if field.kind == \" path \" then \n obj[name] = path.getrelative(location, value) \n elseif field.kind == \" dirlist \" or field.kind == \" filelist \" then \n adjustpathlist(value) \n elseif field.kind == \" keypath \" then \n for k,v in pairs(value) do \n adjustpathlist(v) \n end \n end \n end \n end \n end \n local function removevalue(tbl, remove) \n for index, item in ipairs(tbl) do \n if item == remove then \n table.remove(tbl, index) \n break \n end \n end \n end \n local function removevalues(tbl, removes) \n for k, v in pairs(tbl) do \n for _, pat ter "
" n in ipairs(removes) do\n if pattern == tbl[k] then \n if type(k) == \" number \" then \n table.remove(tbl, k) \n else \n tbl[k] = nil \n end \n break \n end \n end \n end \n end \n local function mergefield(kind, dest, src, mergecopiestotail) \n local tbl = dest or { } \n if kind == \" keyvalue \" or kind == \" keypath \" then \n for key, value in pairs(src) do \n tbl[key] = mergefield( \" list \" , tbl[key], value, mergecopiestotail) \n end \n else \n for _, item in ipairs(src) do \n if tbl[item] then \n if mergecopiestotail then \n removevalue(tbl, item) \n table.insert(tbl, item) \n tbl[item] = item \n end \n else \n table.insert(tbl, item) \n tbl[item] = item \n end \n end \n end \n return tbl \n end \n local function mergeobject(dest, src) \n if not src then \n return \n end \n for fieldname, value in pairs(src) do \n if not nocopy[fieldname] then \n local field = premake.fields[fieldname] \n if field then \n if type(value) == \" table \" then \n dest[fieldname] = mergefield(field.kind, dest[fieldname], value, field.mergecopiestotail) \n if src.removes then \n removes = src.removes[fieldname] \n if rem ove "
" s then\n removevalues(dest[fieldname], removes) \n end \n end \n else \n dest[fieldname] = value \n end \n else \n dest[fieldname] = value \n end \n end \n end \n end \n local function merge(dest, obj, basis, terms, cfgname, pltname) \n local key = cfgname or \" \" \n pltname = pltname or \" Native \" \n if pltname ~= \" Native \" then \n key = key .. pltname \n end \n terms.config = (cfgname or \" \" ):lower() \n terms.platform = pltname:lower() \n local cfg = {} \n mergeobject(cfg, basis[key]) \n adjustpaths(obj.location, cfg) \n mergeobject(cfg, obj) \n if (cfg.kind) then \n terms['kind']=cfg.kind:lower() \n end \n for _, blk in ipairs(obj.blocks) do \n if (premake.iskeywordsmatch(blk.keywords, terms))then \n mergeobject(cfg, blk) \n if (cfg.kind and not cfg.terms.kind) then \n cfg.terms['kind'] = cfg.kind:lower() \n terms['kind'] = cfg.kind:lower() \n end \n end \n end \n cfg.name = cfgname \n cfg.platform = pltname \n for k,v in pairs(terms) do \n cfg.terms[k] =v \n end \n dest[key] = cfg \n end \n local function collapse(obj, basis) \n local result = {} \n basis = basis or {} \n local sln = ob j.s "
" olution or obj\n local terms = premake.getactiveterms( )\n merge(result, obj, basis, terms)--this adjusts terms \n for _, cfgname in ipairs(sln.configurations) do \n local terms_local = {} \n for k,v in pairs(terms)do terms_local[k]=v end \n merge(result, obj, basis, terms_local, cfgname, \" Native \" )--terms cam also be adjusted here \n for _, pltname in ipairs(sln.platforms or {}) do \n if pltname ~= \" Native \" then \n merge(result, obj, basis,terms_local, cfgname, pltname)--terms also here \n end \n end \n end \n return result \n end \n local function builduniquedirs() \n local num_variations = 4 \n local cfg_dirs = {} \n local hit_counts = {} \n for sln in premake.solution.each() do \n for _, prj in ipairs(sln.projects) do \n for _, cfg in pairs(prj.__configs) do \n local dirs = { } \n dirs[1] = path.getabsolute(path.join(cfg.location, cfg.objdir or cfg.project.objdir or \" obj \" )) \n dirs[2] = path.join(dirs[1], iif(cfg.platform == \" Native \" , \" \" , cfg.platform)) \n dirs[3] = path.join(dirs[2], cfg.name) \n dirs[4] = path.join(dirs[3], cfg.project.nam e)\n cf "
" g_dirs[cfg] = dirs\n local start = iif(cfg.name, 2, 1) \n for v = start, num_variations do \n local d = dirs[v] \n hit_counts[d] = (hit_counts[d] or 0) + 1 \n end \n end \n end \n end \n for sln in premake.solution.each() do \n for _, prj in ipairs(sln.projects) do \n for _, cfg in pairs(prj.__configs) do \n local dir \n local start = iif(cfg.name, 2, 1) \n for v = start, iif(cfg.flags.SingleOutputDir==true,num_variations-1,num_variations) do \n dir = cfg_dirs[cfg][v] \n if hit_counts[dir] == 1 then break end \n end \n cfg.objectsdir = path.getrelative(cfg.location, dir) \n end \n end \n end \n end \n local function buildtargets() \n for sln in premake.solution.each() do \n for _, prj in ipairs(sln.projects) do \n for _, cfg in pairs(prj.__configs) do \n local pathstyle = premake.getpathstyle(cfg) \n local namestyle = premake.getnamestyle(cfg) \n cfg.buildtarget = premake.gettarget(cfg, \" build \" , pathstyle, namestyle, cfg.system) \n cfg.linktarget = premake.gettarget(cfg, \" link \" , pathstyle, namestyle, cfg.system) \n if pathstyle == \" windows \" then \n cfg.objec tsdir "
" = path.translate(cfg.objectsdir, \" \\ \\ \" ) \n end \n end \n end \n end \n end \n local function getCfgKind(cfg) \n if(cfg.kind) then \n return cfg.kind; \n end \n if(cfg.project.__configs[ \" \" ] and cfg.project.__configs[ \" \" ].kind) then \n return cfg.project.__configs[ \" \" ].kind; \n end \n return nil \n end \n local function getprojrec(dstArray, foundList, cfg, cfgname, searchField, bLinkage) \n if(not cfg) then return end \n local foundUsePrjs = {}; \n for _, useName in ipairs(cfg[searchField]) do \n local testName = useName:lower(); \n if((not foundList[testName])) then \n local theProj = nil; \n local theUseProj = nil; \n for _, prj in ipairs(cfg.project.solution.projects) do \n if (prj.name:lower() == testName) then \n if(prj.usage) then \n theUseProj = prj; \n else \n theProj = prj; \n end \n end \n end \n --Must connect to a usage project. \n if(theUseProj) then \n foundList[testName] = true; \n local prjEntry = { \n name = testName, \n proj = theProj, \n usageProj = theUseProj, \n bLinkageOnly = bLinkage, \n }; \n "
" dstArray[testName] = prjEntry;\n table.insert(foundUsePrjs, theUseProj); \n end \n end \n end \n for _, usePrj in ipairs(foundUsePrjs) do \n --Links can only recurse through static libraries. \n if((searchField ~= \" links \" ) or \n (getCfgKind(usePrj.__configs[cfgname]) == \" StaticLib \" )) then \n getprojrec(dstArray, foundList, usePrj.__configs[cfgname], \n cfgname, searchField, bLinkage); \n end \n end \n end \n -- \n -- This function will recursively get all projects that the given configuration has in its \" uses \" \n -- field. The return values are a list of tables. Each table in that list contains the following: \n --name = The lowercase name of the project. \n --proj = The project. Can be nil if it is usage-only. \n --usageProj = The usage project. Can't be nil, as using a project that has no \n -- usage project is not put into the list. \n --bLinkageOnly = If this is true, then only the linkage information should be copied. \n -- The recursion will only look at the \" uses \" field on *usage* proje cts.\n "
" -- This function will also add projects to the list that are mentioned in the \" links \" \n -- field of usage projects. These will only copy linker information, but they will recurse. \n -- through other \" links \" fields. \n -- \n local function getprojectsconnections(cfg, cfgname) \n local dstArray = {}; \n local foundList = {}; \n foundList[cfg.project.name:lower()] = true; \n --First, follow the uses recursively. \n getprojrec(dstArray, foundList, cfg, cfgname, \" uses \" , false); \n --Next, go through all of the usage projects and recursively get their links. \n --But only if they're not already there. Get the links as linkage-only. \n local linkArray = {}; \n for prjName, prjEntry in pairs(dstArray) do \n getprojrec(linkArray, foundList, prjEntry.usageProj.__configs[cfgname], cfgname, \n \" links \" , true); \n end \n --Copy from linkArray into dstArray. \n for prjName, prjEntry in pairs(linkArray) do \n dstArray[prjName] = prjEntry; \n end \n return dstArray; \n end \n local function isnameofproj(cfg, strNam "
" e)\n local sln = cfg.project.solution; \n local strTest = strName:lower(); \n for prjIx, prj in ipairs(sln.projects) do \n if (prj.name:lower() == strTest) then \n return true; \n end \n end \n return false; \n end \n -- \n -- Copies the field from dstCfg to srcCfg. \n -- \n local function copydependentfield(srcCfg, dstCfg, strSrcField) \n local srcField = premake.fields[strSrcField]; \n local strDstField = strSrcField; \n if type(srcCfg[strSrcField]) == \" table \" then \n --handle paths. \n if (srcField.kind == \" dirlist \" or srcField.kind == \" filelist \" ) and \n (not keeprelative[strSrcField]) then \n for i,p in ipairs(srcCfg[strSrcField]) do \n table.insert(dstCfg[strDstField], \n path.rebase(p, srcCfg.project.location, dstCfg.project.location)) \n end \n else \n if(strSrcField == \" links \" ) then \n for i,p in ipairs(srcCfg[strSrcField]) do \n if(not isnameofproj(dstCfg, p)) then \n table.insert(dstCfg[strDstField], p) \n else \n printf( \" Failed to copy '%s' from proj '%s'. \" , \n p, srcCfg.project.nam e);\n "
" end\n end \n else \n for i,p in ipairs(srcCfg[strSrcField]) do \n table.insert(dstCfg[strDstField], p) \n end \n end \n end \n else \n if(srcField.kind == \" path \" and (not keeprelative[strSrcField])) then \n dstCfg[strDstField] = path.rebase(srcCfg[strSrcField], \n prj.location, dstCfg.project.location); \n else \n dstCfg[strDstField] = srcCfg[strSrcField]; \n end \n end \n end \n -- \n -- This function will take the list of project entries and apply their usage project data \n -- to the given configuration. It will copy compiling information for the projects that are \n -- not listed as linkage-only. It will copy the linking information for projects only if \n -- the source project is not a static library. It won't copy linking information \n -- if the project is in this solution; instead it will add that project to the configuration's \n -- links field, expecting that Premake will handle the rest. \n -- \n local function copyusagedata(cfg, cfgname, linkToProjs) \n local myPrj = cfg.project; \n local bIsSt "
" aticLib = (getCfgKind(cfg) == \" StaticLib \" ); \n for prjName, prjEntry in pairs(linkToProjs) do \n local srcPrj = prjEntry.usageProj; \n local srcCfg = srcPrj.__configs[cfgname]; \n for name, field in pairs(premake.fields) do \n if(srcCfg[name]) then \n if(field.usagecopy) then \n if(not prjEntry.bLinkageOnly) then \n copydependentfield(srcCfg, cfg, name) \n end \n elseif(field.linkagecopy) then \n --Copy the linkage data if we're building a non-static thing \n --and this is a pure usage project. If it's not pure-usage, then \n --we will simply put the project's name in the links field later. \n if((not bIsStaticLib) and (not prjEntry.proj)) then \n copydependentfield(srcCfg, cfg, name) \n end \n end \n end \n end \n if((not bIsStaticLib) and prjEntry.proj) then \n table.insert(cfg.links, prjEntry.proj.name); \n end \n end \n end \n local function inverseliteralvpaths() \n for sln in premake.solution.each() do \n for _,prj in ipairs(sln.projects) do \n prj.inversevpaths = {}\n "
" for replacement, patterns in pairs(prj.vpaths or {}) do\n for _, pattern in ipairs(patterns) do \n if string.find(pattern, \" * \" ) == nil then \n prj.inversevpaths[pattern] = replacement \n end \n end \n end \n end \n end \n end \n function premake.bake.buildconfigs() \n for sln in premake.solution.each() do \n for _, prj in ipairs(sln.projects) do \n prj.location = prj.location or sln.location or prj.basedir \n adjustpaths(prj.location, prj) \n for _, blk in ipairs(prj.blocks) do \n adjustpaths(prj.location, blk) \n end \n end \n sln.location = sln.location or sln.basedir \n end \n -- convert paths for imported projects to be relative to solution location \n for sln in premake.solution.each() do \n for _, iprj in ipairs(sln.importedprojects) do \n iprj.location = path.getabsolute(iprj.location) \n end \n end \n inverseliteralvpaths() \n for sln in premake.solution.each() do \n local "
" basis = collapse(sln)\n for _, prj in ipairs(sln.projects) do \n prj.__configs = collapse(prj, basis) \n for _, cfg in pairs(prj.__configs) do \n bake.postprocess(prj, cfg) \n end \n end \n end \n for sln in premake.solution.each() do \n for prjIx, prj in ipairs(sln.projects) do \n if(not prj.usage) then \n for cfgname, cfg in pairs(prj.__configs) do \n local usesPrjs = getprojectsconnections(cfg, cfgname); \n copyusagedata(cfg, cfgname, usesPrjs) \n end \n end \n end \n end \n for sln in premake.solution.each() do \n for prjIx, prj in ipairs(sln.projects) do \n for cfgName, cfg in pairs(prj.__configs) do \n cfg.build = true \n local removes = nil \n if cfg.removes ~= nil then \n removes = cfg.removes[ \" platforms \" ]; \n end \n if removes ~= nil then \n for _,p in ipairs(removes) do \n if p == cfg.platform then \n cfg.build = false \n end \n end \n end \n end \n end \n end \n for sln in premake.solution.each() do \n local removeList = {}; \n for index, prj in ipairs(sln.projects) do \n if(prj.usage) then \n table.insert(removeList, 1, index); --Add in reverse order. \n end \n end \n for _, ind "
" ex in ipairs(removeList) do\n table.remove(sln.projects, index); \n end \n end \n builduniquedirs() \n buildtargets(cfg) \n end \n function premake.bake.postprocess(prj, cfg) \n cfg.project = prj \n cfg.shortname = premake.getconfigname(cfg.name, cfg.platform, true) \n cfg.longname = premake.getconfigname(cfg.name, cfg.platform) \n cfg.location = cfg.location or cfg.basedir \n local platform = premake.platforms[cfg.platform] \n if platform.iscrosscompiler then \n cfg.system = cfg.platform \n else \n cfg.system = os.get() \n end \n if cfg.kind == \" Bundle \" and not _ACTION:match(\" xcode[0-9] \" ) then \n cfg.kind = \" SharedLib \" \n end \n if cfg.kind == \" SharedLib \" and platform.nosharedlibs then \n cfg.kind = \" StaticLib \" \n end \n local removefiles = cfg.removefiles \n if _ACTION == 'gmake' or _ACTION == 'ninja' then \n removefiles = table.join(removefiles, cfg.excludes) \n end \n local removefilesDict = {} \n for _, fname in ipairs(removefiles) do \n removefilesDict[fname] = true \n end \n local files = {} \n for _, fname in ipairs(cfg.files) do \n if removefilesDict[fna "
" me] == nil then\n table.insert(files, fname) \n end \n end \n cfg.files = files \n local allfiles = {} \n local allfilesDict = {} \n for _, fname in ipairs(cfg.allfiles) do \n if allfilesDict[fname] == nil then \n if removefilesDict[fname] == nil then \n allfilesDict[fname] = true \n table.insert(allfiles, fname) \n end \n end \n end \n cfg.allfiles = allfiles \n for name, field in pairs(premake.fields) do \n if field.isflags then \n local values = cfg[name] \n for _, flag in ipairs(values) do values[flag] = true end \n end \n end \n local cfgfields = { \n { \" __fileconfigs \" , cfg.files}, \n { \" __allfileconfigs \" , cfg.allfiles}, \n } \n for _, cfgfield in ipairs(cfgfields) do \n local fieldname = cfgfield[1] \n local field = cfgfield[2] \n cfg[fieldname] = { } \n for _, fname in ipairs(field) do \n local fcfg = {} \n if premake._filelevelconfig then \n cfg.terms.required = fname:lower() \n for _, blk in ipairs(cfg.project. blocks) do\n if (premake.iskeywordsmatch(blk.keywords, cfg.terms)) then \n mergeobject(fcfg, blk) \n end \n end \n end \n fcfg.name = fname \n cfg[fieldname][fname "
" ] = fcfg\n table.insert(cfg[fieldname], fcfg) \n end \n end \n end \n " ,
" premake.bake = { } \n local bake = premake.bake \n local nocopy = \n { \n blocks = true, \n keywords = true, \n projects = true, \n __configs = true, \n } \n local nocascade = \n { \n makesettings = true, \n } \n local keeprelative = \n { \n basedir = true, \n location = true, \n } \n function premake.getactiveterms( obj )\n local terms = { _action = _ACTION:lower(), os = os.get() } \n for key, value in pairs(_OPTIONS) do \n if value ~= \" \" then \n table.insert(terms, value:lower()) \n else \n table.insert(terms, key:lower()) \n end \n end \n return terms \n end \n function premake.iskeywordmatch(keyword, terms) \n if keyword:startswith( \" not \" ) then \n return not premake.iskeywordmatch(keyword:sub(5), terms) \n end \n for _, pattern in ipairs(keyword:explode( \" or \" )) do \n for termkey, term in pairs(terms) do \n if term:match(pattern) == term then \n return termkey \n end \n end \n end \n end \n function premake.iskeywordsmatch(keywords, terms) \n local hasrequired = false \n for _, keyword in ipairs(keywords) do \n local matched = premake.iskeywordmatch(keyword, terms) \n if not matched "
" the n\n return false \n end \n if matched == \" required \" then \n hasrequired = true \n end \n end \n if terms.required and not hasrequired then \n return false \n else \n return true \n end \n end \n local function adjustpaths(location, obj) \n function adjustpathlist(list) \n for i, p in ipairs(list) do \n list[i] = path.getrelative(location, p) \n end \n end \n if obj.allfiles ~= nil then \n adjustpathlist(obj.allfiles) \n end \n for name, value in pairs(obj) do \n local field = premake.fields[name] \n if field and value and not keeprelative[name] then \n if field.kind == \" path \" then \n obj[name] = path.getrelative(location, value) \n elseif field.kind == \" dirlist \" or field.kind == \" filelist \" then \n adjustpathlist(value) \n elseif field.kind == \" keypath \" then \n for k,v in pairs(value) do \n adjustpathlist(v) \n end \n end \n end \n end \n end \n local function removevalue(tbl, remove) \n for index, item in ipairs(tbl) do \n if item == remove then \n table.remove(tbl, index) \n break \n end \n end \n end \n local function removevalues(tbl, removes) \n for k, v in pairs(tbl) do \n for _, pat "
" ter n in ipairs(removes) do\n if pattern == tbl[k] then \n if type(k) == \" number \" then \n table.remove(tbl, k) \n else \n tbl[k] = nil \n end \n break \n end \n end \n end \n end \n local function mergefield(kind, dest, src, mergecopiestotail) \n local tbl = dest or { } \n if kind == \" keyvalue \" or kind == \" keypath \" then \n for key, value in pairs(src) do \n tbl[key] = mergefield( \" list \" , tbl[key], value, mergecopiestotail) \n end \n else \n for _, item in ipairs(src) do \n if tbl[item] then \n if mergecopiestotail then \n removevalue(tbl, item) \n table.insert(tbl, item) \n tbl[item] = item \n end \n else \n table.insert(tbl, item) \n tbl[item] = item \n end \n end \n end \n return tbl \n end \n local function mergeobject(dest, src) \n if not src then \n return \n end \n for fieldname, value in pairs(src) do \n if not nocopy[fieldname] then \n local field = premake.fields[fieldname] \n if field then \n if type(value) == \" table \" then \n dest[fieldname] = mergefield(field.kind, dest[fieldname], value, field.mergecopiestotail) \n if src.removes then \n removes = src.removes[fieldname] \n if rem "
" ove s then\n removevalues(dest[fieldname], removes) \n end \n end \n else \n dest[fieldname] = value \n end \n else \n dest[fieldname] = value \n end \n end \n end \n end \n local function merge(dest, obj, basis, terms, cfgname, pltname) \n local key = cfgname or \" \" \n pltname = pltname or \" Native \" \n if pltname ~= \" Native \" then \n key = key .. pltname \n end \n terms.config = (cfgname or \" \" ):lower() \n terms.platform = pltname:lower() \n local cfg = {} \n mergeobject(cfg, basis[key]) \n adjustpaths(obj.location, cfg) \n mergeobject(cfg, obj) \n if (cfg.kind) then \n terms['kind']=cfg.kind:lower() \n end \n for _, blk in ipairs(obj.blocks) do \n if (premake.iskeywordsmatch(blk.keywords, terms))then \n mergeobject(cfg, blk) \n if (cfg.kind and not cfg.terms.kind) then \n cfg.terms['kind'] = cfg.kind:lower() \n terms['kind'] = cfg.kind:lower() \n end \n end \n end \n cfg.name = cfgname \n cfg.platform = pltname \n for k,v in pairs(terms) do \n cfg.terms[k] =v \n end \n dest[key] = cfg \n end \n local function collapse(obj, basis) \n local result = {} \n basis = basis or {} \n local sln = ob "
" j.s olution or obj\n local terms = premake.getactiveterms( obj )\n merge(result, obj, basis, terms)--this adjusts terms \n for _, cfgname in ipairs(sln.configurations) do \n local terms_local = {} \n for k,v in pairs(terms)do terms_local[k]=v end \n merge(result, obj, basis, terms_local, cfgname, \" Native \" )--terms cam also be adjusted here \n for _, pltname in ipairs(sln.platforms or {}) do \n if pltname ~= \" Native \" then \n merge(result, obj, basis,terms_local, cfgname, pltname)--terms also here \n end \n end \n end \n return result \n end \n local function builduniquedirs() \n local num_variations = 4 \n local cfg_dirs = {} \n local hit_counts = {} \n for sln in premake.solution.each() do \n for _, prj in ipairs(sln.projects) do \n for _, cfg in pairs(prj.__configs) do \n local dirs = { } \n dirs[1] = path.getabsolute(path.join(cfg.location, cfg.objdir or cfg.project.objdir or \" obj \" )) \n dirs[2] = path.join(dirs[1], iif(cfg.platform == \" Native \" , \" \" , cfg.platform)) \n dirs[3] = path.join(dirs[2], cfg.name) \n dirs[4] = path.join(dirs[3], cfg.project.nam "
" e)\n cf g_dirs[cfg] = dirs\n local start = iif(cfg.name, 2, 1) \n for v = start, num_variations do \n local d = dirs[v] \n hit_counts[d] = (hit_counts[d] or 0) + 1 \n end \n end \n end \n end \n for sln in premake.solution.each() do \n for _, prj in ipairs(sln.projects) do \n for _, cfg in pairs(prj.__configs) do \n local dir \n local start = iif(cfg.name, 2, 1) \n for v = start, iif(cfg.flags.SingleOutputDir==true,num_variations-1,num_variations) do \n dir = cfg_dirs[cfg][v] \n if hit_counts[dir] == 1 then break end \n end \n cfg.objectsdir = path.getrelative(cfg.location, dir) \n end \n end \n end \n end \n local function buildtargets() \n for sln in premake.solution.each() do \n for _, prj in ipairs(sln.projects) do \n for _, cfg in pairs(prj.__configs) do \n local pathstyle = premake.getpathstyle(cfg) \n local namestyle = premake.getnamestyle(cfg) \n cfg.buildtarget = premake.gettarget(cfg, \" build \" , pathstyle, namestyle, cfg.system) \n cfg.linktarget = premake.gettarget(cfg, \" link \" , pathstyle, namestyle, cfg.system) \n if pathstyle == \" windows \" then \n cfg.objec "
" tsdir = path.translate(cfg.objectsdir, \" \\ \\ \" ) \n end \n end \n end \n end \n end \n local function getCfgKind(cfg) \n if(cfg.kind) then \n return cfg.kind; \n end \n if(cfg.project.__configs[ \" \" ] and cfg.project.__configs[ \" \" ].kind) then \n return cfg.project.__configs[ \" \" ].kind; \n end \n return nil \n end \n local function getprojrec(dstArray, foundList, cfg, cfgname, searchField, bLinkage) \n if(not cfg) then return end \n local foundUsePrjs = {}; \n for _, useName in ipairs(cfg[searchField]) do \n local testName = useName:lower(); \n if((not foundList[testName])) then \n local theProj = nil; \n local theUseProj = nil; \n for _, prj in ipairs(cfg.project.solution.projects) do \n if (prj.name:lower() == testName) then \n if(prj.usage) then \n theUseProj = prj; \n else \n theProj = prj; \n end \n end \n end \n --Must connect to a usage project. \n if(theUseProj) then \n foundList[testName] = true; \n local prjEntry = { \n name = testName, \n proj = theProj, \n usageProj = theUseProj, \n bLinkageOnly = bLinkage, \n "
" };\n dstArray[testName] = prjEntry;\n table.insert(foundUsePrjs, theUseProj); \n end \n end \n end \n for _, usePrj in ipairs(foundUsePrjs) do \n --Links can only recurse through static libraries. \n if((searchField ~= \" links \" ) or \n (getCfgKind(usePrj.__configs[cfgname]) == \" StaticLib \" )) then \n getprojrec(dstArray, foundList, usePrj.__configs[cfgname], \n cfgname, searchField, bLinkage); \n end \n end \n end \n -- \n -- This function will recursively get all projects that the given configuration has in its \" uses \" \n -- field. The return values are a list of tables. Each table in that list contains the following: \n --name = The lowercase name of the project. \n --proj = The project. Can be nil if it is usage-only. \n --usageProj = The usage project. Can't be nil, as using a project that has no \n -- usage project is not put into the list. \n --bLinkageOnly = If this is true, then only the linkage information should be copied. \n -- The recursion will only look at the \" uses \" field on *usage* proje "
" cts.\n -- This function will also add projects to the list that are mentioned in the \" links \" \n -- field of usage projects. These will only copy linker information, but they will recurse. \n -- through other \" links \" fields. \n -- \n local function getprojectsconnections(cfg, cfgname) \n local dstArray = {}; \n local foundList = {}; \n foundList[cfg.project.name:lower()] = true; \n --First, follow the uses recursively. \n getprojrec(dstArray, foundList, cfg, cfgname, \" uses \" , false); \n --Next, go through all of the usage projects and recursively get their links. \n --But only if they're not already there. Get the links as linkage-only. \n local linkArray = {}; \n for prjName, prjEntry in pairs(dstArray) do \n getprojrec(linkArray, foundList, prjEntry.usageProj.__configs[cfgname], cfgname, \n \" links \" , true); \n end \n --Copy from linkArray into dstArray. \n for prjName, prjEntry in pairs(linkArray) do \n dstArray[prjName] = prjEntry; \n end \n return dstArray; \n end \n local function isnameofproj(cfg, "
" strNam e)\n local sln = cfg.project.solution; \n local strTest = strName:lower(); \n for prjIx, prj in ipairs(sln.projects) do \n if (prj.name:lower() == strTest) then \n return true; \n end \n end \n return false; \n end \n -- \n -- Copies the field from dstCfg to srcCfg. \n -- \n local function copydependentfield(srcCfg, dstCfg, strSrcField) \n local srcField = premake.fields[strSrcField]; \n local strDstField = strSrcField; \n if type(srcCfg[strSrcField]) == \" table \" then \n --handle paths. \n if (srcField.kind == \" dirlist \" or srcField.kind == \" filelist \" ) and \n (not keeprelative[strSrcField]) then \n for i,p in ipairs(srcCfg[strSrcField]) do \n table.insert(dstCfg[strDstField], \n path.rebase(p, srcCfg.project.location, dstCfg.project.location)) \n end \n else \n if(strSrcField == \" links \" ) then \n for i,p in ipairs(srcCfg[strSrcField]) do \n if(not isnameofproj(dstCfg, p)) then \n table.insert(dstCfg[strDstField], p) \n else \n printf( \" Failed to copy '%s' from proj '%s'. \" , \n p, srcCfg.project.nam "
" e);\n end\n end \n else \n for i,p in ipairs(srcCfg[strSrcField]) do \n table.insert(dstCfg[strDstField], p) \n end \n end \n end \n else \n if(srcField.kind == \" path \" and (not keeprelative[strSrcField])) then \n dstCfg[strDstField] = path.rebase(srcCfg[strSrcField], \n prj.location, dstCfg.project.location); \n else \n dstCfg[strDstField] = srcCfg[strSrcField]; \n end \n end \n end \n -- \n -- This function will take the list of project entries and apply their usage project data \n -- to the given configuration. It will copy compiling information for the projects that are \n -- not listed as linkage-only. It will copy the linking information for projects only if \n -- the source project is not a static library. It won't copy linking information \n -- if the project is in this solution; instead it will add that project to the configuration's \n -- links field, expecting that Premake will handle the rest. \n -- \n local function copyusagedata(cfg, cfgname, linkToProjs) \n local myPrj = cfg.project; \n local "
" bIsSt aticLib = (getCfgKind(cfg) == \" StaticLib \" ); \n for prjName, prjEntry in pairs(linkToProjs) do \n local srcPrj = prjEntry.usageProj; \n local srcCfg = srcPrj.__configs[cfgname]; \n for name, field in pairs(premake.fields) do \n if(srcCfg[name]) then \n if(field.usagecopy) then \n if(not prjEntry.bLinkageOnly) then \n copydependentfield(srcCfg, cfg, name) \n end \n elseif(field.linkagecopy) then \n --Copy the linkage data if we're building a non-static thing \n --and this is a pure usage project. If it's not pure-usage, then \n --we will simply put the project's name in the links field later. \n if((not bIsStaticLib) and (not prjEntry.proj)) then \n copydependentfield(srcCfg, cfg, name) \n end \n end \n end \n end \n if((not bIsStaticLib) and prjEntry.proj) then \n table.insert(cfg.links, prjEntry.proj.name); \n end \n end \n end \n local function inverseliteralvpaths() \n for sln in premake.solution.each() do \n for _,prj in ipairs(sln.projects) do \n prj.inversevpaths = "
" {}\n for replacement, patterns in pairs(prj.vpaths or {}) do\n for _, pattern in ipairs(patterns) do \n if string.find(pattern, \" * \" ) == nil then \n prj.inversevpaths[pattern] = replacement \n end \n end \n end \n end \n end \n end \n function premake.bake.buildconfigs() \n for sln in premake.solution.each() do \n for _, prj in ipairs(sln.projects) do \n prj.location = prj.location or sln.location or prj.basedir \n adjustpaths(prj.location, prj) \n for _, blk in ipairs(prj.blocks) do \n adjustpaths(prj.location, blk) \n end \n end \n sln.location = sln.location or sln.basedir \n end \n -- convert paths for imported projects to be relative to solution location \n for sln in premake.solution.each() do \n for _, iprj in ipairs(sln.importedprojects) do \n iprj.location = path.getabsolute(iprj.location) \n end \n end \n inverseliteralvpaths() \n for sln in premake.solution.each() do \n "
" local basis = collapse(sln)\n for _, prj in ipairs(sln.projects) do \n prj.__configs = collapse(prj, basis) \n for _, cfg in pairs(prj.__configs) do \n bake.postprocess(prj, cfg) \n end \n end \n end \n for sln in premake.solution.each() do \n for prjIx, prj in ipairs(sln.projects) do \n if(not prj.usage) then \n for cfgname, cfg in pairs(prj.__configs) do \n local usesPrjs = getprojectsconnections(cfg, cfgname); \n copyusagedata(cfg, cfgname, usesPrjs) \n end \n end \n end \n end \n for sln in premake.solution.each() do \n for prjIx, prj in ipairs(sln.projects) do \n for cfgName, cfg in pairs(prj.__configs) do \n cfg.build = true \n local removes = nil \n if cfg.removes ~= nil then \n removes = cfg.removes[ \" platforms \" ]; \n end \n if removes ~= nil then \n for _,p in ipairs(removes) do \n if p == cfg.platform then \n cfg.build = false \n end \n end \n end \n end \n end \n end \n for sln in premake.solution.each() do \n local removeList = {}; \n for index, prj in ipairs(sln.projects) do \n if(prj.usage) then \n table.insert(removeList, 1, index); --Add in reverse order. \n end \n end \n for "
" _, ind ex in ipairs(removeList) do\n table.remove(sln.projects, index); \n end \n end \n builduniquedirs() \n buildtargets(cfg) \n end \n function premake.bake.postprocess(prj, cfg) \n cfg.project = prj \n cfg.shortname = premake.getconfigname(cfg.name, cfg.platform, true) \n cfg.longname = premake.getconfigname(cfg.name, cfg.platform) \n cfg.location = cfg.location or cfg.basedir \n local platform = premake.platforms[cfg.platform] \n if platform.iscrosscompiler then \n cfg.system = cfg.platform \n else \n cfg.system = os.get() \n end \n if cfg.kind == \" Bundle \" \n and _ACTION ~= \" gmake \" \n and (_ACTION ~= \" ninja \" and (not prj.options or not prj.options.SkipBundling))\n and not _ACTION:match(\" xcode[0-9] \" ) then \n cfg.kind = \" SharedLib \" \n end \n if cfg.kind == \" SharedLib \" and platform.nosharedlibs then \n cfg.kind = \" StaticLib \" \n end \n local removefiles = cfg.removefiles \n if _ACTION == 'gmake' or _ACTION == 'ninja' then \n removefiles = table.join(removefiles, cfg.excludes) \n end \n local removefilesDict = {} \n for _, fname in ipairs(removefiles) do "
" \n removefilesDict[fname] = true\n end \n local files = {} \n for _, fname in ipairs(cfg.files) do \n if removefilesDict[fna me] == nil then\n table.insert(files, fname) \n end \n end \n cfg.files = files \n local allfiles = {} \n local allfilesDict = {} \n if cfg.allfiles ~= nil then \n for _, fname in ipairs(cfg.allfiles) do \n if allfilesDict[fname] == nil then \n if removefilesDict[fname] == nil then \n allfilesDict[fname] = true \n table.insert(allfiles, fname) \n end \n end \n end \n end \n cfg.allfiles = allfiles \n for name, field in pairs(premake.fields) do \n if field.isflags then \n local values = cfg[name] \n for _, flag in ipairs(values) do values[flag] = true end \n end \n end \n local cfgfields = { \n { \" __fileconfigs \" , cfg.files}, \n { \" __allfileconfigs \" , cfg.allfiles}, \n } \n for _, cfgfield in ipairs(cfgfields) do \n local fieldname = cfgfield[1] \n local field = cfgfield[2] \n cfg[fieldname] = { } \n for _, fname in ipairs(field) do \n local fcfg = {} \n if premake._filelevelconfig then \n cfg.terms.required = fname:lower() \n for _, blk in ipairs(cfg.project. "
" blocks) do\n if (premake.iskeywordsmatch(blk.keywords, cfg.terms)) then \n mergeobject(fcfg, blk) \n end \n end \n end \n fcfg.name = fname \n cfg[fieldname][fname ] = fcfg\n table.insert(cfg[fieldname], fcfg) \n end \n end \n end \n " ,
/* base/api.lua */
" premake.fields = \n { \n archivesplit_size = \n { \n kind = \" string \" , \n scope = \" config \" , \n }, \n basedir = \n { \n kind = \" path \" , \n scope = \" container \" , \n }, \n buildaction = \n { \n kind = \" string \" , \n scope = \" config \" , \n allowed = { \n \" Compile \" , \n \" Copy \" , \n \" Embed \" , \n \" None \" \n } \n }, \n buildoptions = \n { \n kind = \" list \" , \n scope = \" config \" , \n }, \n buildoptions_asm = \n { \n kind = \" list \" , \n scope = \" config \" , \n }, \n buildoptions_c = \n { \n kind = \" list \" , \n scope = \" config \" , \n }, \n buildoptions_cpp = \n { \n kind = \" list \" , \n scope = \" config \" , \n }, \n buildoptions_objc = \n { \n kind = \" list \" , \n scope = \" config \" , \n }, \n buildoptions_objcpp = \n { \n kind = \" list \" , \n scope = \" config \" , \n }, \n buildoptions_vala = \n { \n kind = \" list \" , \n scope = \" config \" , \n }, \n clrreferences = \n { \n kind = \" list \" , \n scope = \" container \" , \n }, \n configurations = \n { \n kind = \" list \" , \n scope = \" solution \" , \n }, \n custombuildtask = \n { \n kind = \" table \" , \n scope = \" config \" , \n }, \n debugargs = \n { \n kind = \" list \" , \n scope = \" config \" , \n }, \n debugdir = \n { \n kind "
" = \" path \" , \n scope = \" config \" , \n }, \n debugenvs = \n { \n kind = \" list \" , \n scope = \" config \" , \n }, \n defines = \n { \n kind = \" list \" , \n scope = \" config \" , \n }, \n deploymentoptions = \n { \n kind = \" list \" , \n scope = \" config \" , \n usagecopy = true, \n }, \n dependency = \n { \n kind = \" table \" , \n scope = \" config \" , \n }, \n deploymode = \n { \n kind = \" string \" , \n scope = \" config \" , \n }, \n excludes = \n { \n kind = \" filelist \" , \n scope = \" config \" , \n }, \n forcenative = \n { \n kind = \" filelist \" , \n scope = \" config \" , \n }, \n nopch = \n { \n kind = \" filelist \" , \n scope = \" config \" , \n }, \n files = \n { \n kind = \" filelist \" , \n scope = \" config \" , \n }, \n removefiles = \n { \n kind = \" filelist \" , \n scope = \" config \" , \n }, \n flags = \n { \n kind = \" list \" , \n scope = \" config \" , \n isflags = true, \n usagecopy = true, \n allowed = function(value) \n local allowed_flags = { \n ATL = 1, \n C7DebugInfo = 1, \n DebugEnvsDontMerge = 1, \n DebugEnvsInherit = 1, \n DeploymentContent = 1, \n EnableMinimalRebuild = 1, \n EnableSSE = 1, \n EnableSSE2 = 1, \n EnableAVX = 1, \n EnableAVX2 = 1, \n PedanticWa "
" rnings = 1, \n ExtraWarnings = 1, \n FatalWarnings = 1, \n FloatFast = 1, \n FloatStrict = 1, \n Managed = 1, \n MinimumWarnings = 1, \n MFC = 1, \n NativeWChar = 1, \n No64BitChecks = 1, \n NoBufferSecurityCheck = 1, \n NoEditAndContinue = 1, \n NoExceptions = 1, \n NoFramePointer = 1, \n NoImportLib = 1, \n NoIncrementalLink = 1, \n NoManifest = 1, \n NoMultiProcessorCompilation = 1, \n NoNativeWChar = 1, \n NoPCH = 1, \n NoRTTI = 1, \n NoWinMD = 1, -- explicitly disables Windows Metadata \n NoWinRT = 1, -- explicitly disables Windows Runtime Extension \n FastCall = 1, \n StdCall = 1, \n SingleOutputDir = 1, \n ObjcARC = 1, \n Optimize = 1, \n OptimizeSize = 1, \n OptimizeSpeed = 1, \n DebugRuntime = 1, \n ReleaseRuntime = 1, \n SEH = 1, \n StaticATL = 1, \n StaticRuntime = 1, \n Symbols = 1, \n Unicode = 1, \n Unsafe = 1, \n UnsignedChar = 1, \n UseFullPaths = 1, \n WinMain = 1, \n } \n local englishToAmericanSpelling = \n { \n optimise = 'optimize', \n optimisesize = 'optimizesize', \n optimisespeed = 'optimizespeed', \n } \n local lowervalue = value:lower() \n lowervalue = englishToAmericanSpell "
" ing[lowervalue] or lowervalue \n for v, _ in pairs(allowed_flags) do \n if v:lower() == lowervalue then \n return v \n end \n end \n return nil, \" invalid flag \" \n end, \n }, \n framework = \n { \n kind = \" string \" , \n scope = \" container \" , \n allowed = { \n \" 1.0 \" , \n \" 1.1 \" , \n \" 2.0 \" , \n \" 3.0 \" , \n \" 3.5 \" , \n \" 4.0 \" , \n \" 4.5 \" , \n \" 4.5.1 \" , \n \" 4.5.2 \" , \n \" 4.6 \" , \n \" 4.6.1 \" , \n \" 4.6.2 \" , \n } \n }, \n windowstargetplatformversion = \n { \n kind = \" string \" , \n scope = \" project \" , \n }, \n windowstargetplatformminversion = \n { \n kind = \" string \" , \n scope = \" project \" , \n }, \n forcedincludes = \n { \n kind = \" list \" , \n scope = \" config \" , \n }, \n imagepath = \n { \n kind = \" path \" , \n scope = \" config \" , \n }, \n imageoptions = \n { \n kind = \" list \" , \n scope = \" config \" , \n }, \n implibdir = \n { \n kind = \" path \" , \n scope = \" config \" , \n }, \n implibextension = \n { \n kind = \" string \" , \n scope = \" config \" , \n }, \n implibname = \n { \n kind = \" string \" , \n scope = \" config \" , \n }, \n implibprefix = \n { \n kind = \" string \" , \n scope = \" config \" , \n }, \n implibsuffix = \n { \n kind = \" string \" , \n scope = "
" \" config \" , \n }, \n includedirs = \n { \n kind = \" dirlist \" , \n scope = \" config \" , \n usagecopy = true, \n }, \n userincludedirs = \n { \n kind = \" dirlist \" , \n scope = \" config \" , \n usagecopy = true, \n }, \n usingdirs = \n { \n kind = \" dirlist \" , \n scope = \" config \" , \n usagecopy = true, \n }, \n kind = \n { \n kind = \" string \" , \n scope = \" config \" , \n allowed = { \n \" ConsoleApp \" , \n \" WindowedApp \" , \n \" StaticLib \" , \n \" SharedLib \" , \n \" Bundle \" , \n } \n }, \n language = \n { \n kind = \" string \" , \n scope = \" container \" , \n allowed = { \n \" C \" , \n \" C++ \" , \n \" C# \" , \n \" Vala \" , \n \" Swift \" , \n } \n }, \n libdirs = \n { \n kind = \" dirlist \" , \n scope = \" config \" , \n linkagecopy = true, \n }, \n linkoptions = \n { \n kind = \" list \" , \n scope = \" config \" , \n }, \n links = \n { \n kind = \" list \" , \n scope = \" config \" , \n allowed = function(value) \n if value:find('/', nil, true) then \n value = path.getabsolute(value) \n end \n return value \n end, \n linkagecopy = true, \n mergecopiestotail = true, \n }, \n location = \n { \n kind = \" path \" , \n scope = \" container \" , \n }, \n makesettings = \n { \n kind = \" list \" , \n sc "
" ope = \" config \" , \n }, \n messageskip = \n { \n kind = \" list \" , \n scope = \" solution \" , \n isflags = true, \n usagecopy = true, \n allowed = function(value) \n local allowed_messages = { \n SkipCreatingMessage = 1, \n SkipBuildingMessage = 1, \n SkipCleaningMessage = 1, \n } \n local lowervalue = value:lower() \n for v, _ in pairs(allowed_messages) do \n if v:lower() == lowervalue then \n return v \n end \n end \n return nil, \" invalid message to skip \" \n end, \n }, \n msgarchiving = \n { \n kind = \" string \" , \n scope = \" config \" , \n }, \n msgcompile = \n { \n kind = \" string \" , \n scope = \" config \" , \n }, \n msgprecompile = \n { \n kind = \" string \" , \n scope = \" config \" , \n }, \n msgcompile_objc = \n { \n kind = \" string \" , \n scope = \" config \" , \n }, \n msgresource = \n { \n kind = \" string \" , \n scope = \" config \" , \n }, \n msglinking = \n { \n kind = \" string \" , \n scope = \" config \" , \n }, \n objdir = \n { \n kind = \" path \" , \n scope = \" config \" , \n }, \n options = \n { \n kind = \" list \" , \n scope = \" container \" , \n isflags = true, \n usagecopy = true, \n allowed = function(value) \n local allowed_options = { "
" \n ForceCPP = 1, \n ArchiveSplit = 1 \n } \n local lowervalue = value:lower() \n for v, _ in pairs(allowed_options) do \n if v:lower() == lowervalue then \n return v \n end \n end \n return nil, \" invalid option \" \n end, \n }, \n pchheader = \n { \n kind = \" string \" , \n scope = \" config \" , \n }, \n pchsource = \n { \n kind = \" path \" , \n scope = \" config \" , \n }, \n platforms = \n { \n kind = \" list \" , \n scope = \" solution \" , \n allowed = table.keys(premake.platforms), \n }, \n postbuildcommands = \n { \n kind = \" list \" , \n scope = \" config \" , \n }, \n prebuildcommands = \n { \n kind = \" list \" , \n scope = \" config \" , \n }, \n postcompiletasks = \n { \n kind = \" list \" , \n scope = \" config \" , \n }, \n prelinkcommands = \n { \n kind = \" list \" , \n scope = \" config \" , \n }, \n propertysheets = \n { \n kind = \" dirlist \" , \n scope = \" config \" , \n }, \n pullmappingfile = \n { \n kind = \" path \" , \n scope = \" config \" , \n }, \n resdefines = \n { \n kind = \" list \" , \n scope = \" config \" , \n }, \n resincludedirs = \n { \n kind = \" dirlist \" , \n scope = \" config \" , \n }, \n resoptions = \n { \n kind = \" list \" , \n scope = \" config \" , \n }, \n s "
" dkreferences = \n { \n kind = \" list \" , \n scope = \" config \" , \n }, \n startproject = \n { \n kind = \" string \" , \n scope = \" solution \" , \n }, \n targetdir = \n { \n kind = \" path \" , \n scope = \" config \" , \n }, \n targetsubdir = \n { \n kind = \" string \" , \n scope = \" config \" , \n }, \n targetextension = \n { \n kind = \" string \" , \n scope = \" config \" , \n }, \n targetname = \n { \n kind = \" string \" , \n scope = \" config \" , \n }, \n targetprefix = \n { \n kind = \" string \" , \n scope = \" config \" , \n }, \n targetsuffix = \n { \n kind = \" string \" , \n scope = \" config \" , \n }, \n trimpaths = \n { \n kind = \" dirlist \" , \n scope = \" config \" , \n }, \n uuid = \n { \n kind = \" string \" , \n scope = \" container \" , \n allowed = function(value) \n local ok = true \n if (#value ~= 36) then ok = false end \n for i=1,36 do \n local ch = value:sub(i,i) \n if (not ch:find( \" [ABCDEFabcdef0123456789-] \" )) then ok = false end \n end \n if (value:sub(9,9) ~= \" - \" ) then ok = false end \n if (value:sub(14,14) ~= \" - \" ) then ok = false end \n if (value:sub(19,19) ~= \" - \" ) then ok = false end \n if (value:sub(24,24) ~= \" - \" ) then "
" ok = false end \n if (not ok) then \n return nil, \" invalid UUID \" \n end \n return value:upper() \n end \n }, \n uses = \n { \n kind = \" list \" , \n scope = \" config \" , \n }, \n vapidirs = \n { \n kind = \" dirlist \" , \n scope = \" config \" , \n }, \n vpaths = \n { \n kind = \" keypath \" , \n scope = \" container \" , \n }, \n vsimportreferences = \n { \n kind = \" filelist \" , \n scope = \" container \" , \n }, \n swiftmodulemaps = \n { \n kind = \" filelist \" , \n scope = \" config \" , \n }, \n buildoptions_swift = \n { \n kind = \" list \" , \n scope = \" config \" , \n }, \n linkoptions_swift = \n { \n kind = \" list \" , \n scope = \" config \" , \n }, \n } \n premake.check_paths = false \n function premake.checkvalue(value, allowed) \n if (allowed) then \n if (type(allowed) == \" function \" ) then \n return allowed(value) \n else \n for _,v in ipairs(allowed) do \n if (value:lower() == v:lower()) then \n return v \n end \n end \n return nil, \" invalid value ' \" .. value .. \" ' \" \n end \n else \n return value \n end \n end \n function premake.getobject(t) \n local container \n if (t == \" container \" or t == \" solution \" ) then \n container = premake.Curr "
" entContainer \n else \n container = premake.CurrentConfiguration \n end \n if t == \" solution \" then \n if typex(container) == \" project \" then \n container = container.solution \n end \n if typex(container) ~= \" solution \" then \n container = nil \n end \n end \n local msg \n if (not container) then \n if (t == \" container \" ) then \n msg = \" no active solution or project \" \n elseif (t == \" solution \" ) then \n msg = \" no active solution \" \n else \n msg = \" no active solution, project, or configuration \" \n end \n end \n return container, msg \n end \n function premake.setarray(obj, fieldname, value, allowed) \n obj[fieldname] = obj[fieldname] or {} \n local function add(value, depth) \n if type(value) == \" table \" then \n for _,v in ipairs(value) do \n add(v, depth + 1) \n end \n else \n value, err = premake.checkvalue(value, allowed) \n if not value then \n error(err, depth) \n end \n table.insert(obj[fieldname], value) \n end \n end \n if value then \n add(value, 5) \n end \n return obj[fieldname] \n end \n function premake.settable(obj, fieldname, value, allowed) \n obj[fieldname] = obj[fieldn "
" ame] or {} \n table.insert(obj[fieldname], value) \n return obj[fieldname] \n end \n local function domatchedarray(fields, value, matchfunc) \n local result = { } \n function makeabsolute(value, depth) \n if (type(value) == \" table \" ) then \n for _, item in ipairs(value) do \n makeabsolute(item, depth + 1) \n end \n elseif type(value) == \" string \" then \n if value:find( \" * \" ) then \n local arr = matchfunc(value); \n if (premake.check_paths) and (#arr == 0) then \n error( \" Can't find matching files for pattern : \" .. value) \n end \n makeabsolute(arr, depth + 1) \n else \n table.insert(result, path.getabsolute(value)) \n end \n else \n error( \" Invalid value in list: expected string, got \" .. type(value), depth) \n end \n end \n makeabsolute(value, 3) \n local retval = {} \n for index, field in ipairs(fields) do \n local ctype = field[1] \n local fieldname = field[2] \n local array = premake.setarray(ctype, fieldname, result) \n if index == 1 then \n retval = array \n end \n end \n return retval \n end \n function premake.setdirarray(fields, value) \n return domatchedarray(fields, val "
" ue, os.matchdirs) \n end \n function premake.setfilearray(fields, value) \n return domatchedarray(fields, value, os.matchfiles) \n end \n function premake.setkeyvalue(ctype, fieldname, values) \n local container, err = premake.getobject(ctype) \n if not container then \n error(err, 4) \n end \n if not container[fieldname] then \n container[fieldname] = {} \n end \n if type(values) ~= \" table \" then \n error( \" invalid value; table expected \" , 4) \n end \n local field = container[fieldname] \n for key,value in pairs(values) do \n if not field[key] then \n field[key] = {} \n end \n table.insertflat(field[key], value) \n end \n return field \n end \n function premake.setstring(ctype, fieldname, value, allowed) \n local container, err = premake.getobject(ctype) \n if (not container) then \n error(err, 4) \n end \n if (value) then \n value, err = premake.checkvalue(value, allowed) \n if (not value) then \n error(err, 4) \n end \n container[fieldname] = value \n end \n return container[fieldname] \n end \n function premake.remove(fieldname, value) \n local cfg = premake.CurrentConfiguration \n cfg "
" .removes = cfg.removes or {} \n cfg.removes[fieldname] = premake.setarray(cfg.removes, fieldname, value) \n end \n local function accessor(name, value) \n local kind = premake.fields[name].kind \n local scope = premake.fields[name].scope \n local allowed = premake.fields[name].allowed \n if (kind == \" string \" or kind == \" path \" ) and value then \n if type(value) ~= \" string \" then \n error( \" string value expected \" , 3) \n end \n end \n local container, err = premake.getobject(scope) \n if (not container) then \n error(err, 3) \n end \n if kind == \" string \" then \n return premake.setstring(scope, name, value, allowed) \n elseif kind == \" path \" then \n if value then value = path.getabsolute(value) end \n return premake.setstring(scope, name, value) \n elseif kind == \" list \" then \n return premake.setarray(container, name, value, allowed) \n elseif kind == \" table \" then \n return premake.settable(container, name, value, allowed) \n elseif kind == \" dirlist \" then \n return premake.setdirarray({{container, name}}, value) \n elseif kind == \" filelist \" or ki "
" nd == \" absolutefilelist \" then \n local fields = {{container, name}} \n if name == \" files \" then \n local prj, err = premake.getobject( \" container \" ) \n if (not prj) then \n error(err, 2) \n end \n table.insert(fields, {prj.blocks[1], \" allfiles \" }) \n end \n return premake.setfilearray(fields, value) \n elseif kind == \" keyvalue \" or kind == \" keypath \" then \n return premake.setkeyvalue(scope, name, value) \n end \n end \n for name, info in pairs(premake.fields) do \n _G[name] = function(value) \n return accessor(name, value) \n end \n if info.kind == \" list \" \n or info.kind == \" dirlist \" \n or info.kind == \" filelist \" \n or info.kind == \" absolutefilelist \" \n then \n if name ~= \" removefiles \" \n and name ~= \" files \" then \n _G[ \" remove \" ..name] = function(value) \n premake.remove(name, value) \n end \n end \n end \n end \n function configuration(terms) \n if not terms then \n return premake.CurrentConfiguration \n end \n local container, err = premake.getobject( \" container \" ) \n if (not container) then \n error(err, 2) \n end \n local cfg = { } \n cfg.terms = table.flatten({te "
" rms}) \n table.insert(container.blocks, cfg) \n premake.CurrentConfiguration = cfg \n cfg.keywords = { } \n for _, word in ipairs(cfg.terms) do \n table.insert(cfg.keywords, path.wildcards(word):lower()) \n end \n for name, field in pairs(premake.fields) do \n if (field.kind ~= \" string \" and field.kind ~= \" path \" ) then \n cfg[name] = { } \n end \n end \n return cfg \n end \n local function creategroup(name, sln, curpath, parent, inpath) \n local group = {} \n setmetatable(group, { \n __type = \" group \" \n }) \n table.insert(sln.groups, group) \n sln.groups[inpath] = group \n if parent ~= nil then \n table.insert(parent.groups, group) \n end \n group.solution = sln \n group.name = name \n group.uuid = os.uuid(curpath) \n group.parent = parent \n group.projects = { } \n group.groups = { } \n return group \n end \n local function creategroupsfrompath(inpath, sln) \n if inpath == nil then return nil end \n inpath = path.translate(inpath, \" / \" ) \n local groups = string.explode(inpath, \" / \" ) \n local curpath = \" \" \n local lastgroup = nil \n for i, v in ipairs(groups) do \n curpath = cur "
" path .. \" / \" .. v:lower() \n local group = sln.groups[curpath] \n if group == nil then \n group = creategroup(v, sln, curpath, lastgroup, curpath) \n end \n lastgroup = group \n end \n return lastgroup \n end \n local function createproject(name, sln, isUsage) \n local prj = {} \n setmetatable(prj, { \n __type = \" project \" , \n }) \n table.insert(sln.projects, prj) \n if(isUsage) then \n if(sln.projects[name]) then \n sln.projects[name].usageProj = prj; \n else \n sln.projects[name] = prj \n end \n else \n if(sln.projects[name]) then \n prj.usageProj = sln.projects[name]; \n end \n sln.projects[name] = prj \n end \n local group = creategroupsfrompath(premake.CurrentGroup, sln) \n if group ~= nil then \n table.insert(group.projects, prj) \n end \n prj.solution = sln \n prj.name = name \n prj.basedir = os.getcwd() \n prj.uuid = os.uuid(prj.name) \n prj.blocks = { } \n prj.usage = isUsage \n prj.group = group \n return prj; \n end \n function usage(name) \n if (not name) then \n if(typex(premake.CurrentContainer) ~= \" project \" ) then re "
" turn nil end \n if(not premake.CurrentContainer.usage) then return nil end \n return premake.CurrentContainer \n end \n local sln \n if (typex(premake.CurrentContainer) == \" project \" ) then \n sln = premake.CurrentContainer.solution \n else \n sln = premake.CurrentContainer \n end \n if (typex(sln) ~= \" solution \" ) then \n error( \" no active solution \" , 2) \n end \n if((not sln.projects[name]) or \n ((not sln.projects[name].usage) and (not sln.projects[name].usageProj))) then \n premake.CurrentContainer = createproject(name, sln, true) \n else \n premake.CurrentContainer = iff(sln.projects[name].usage, \n sln.projects[name], sln.projects[name].usageProj) \n end \n configuration { } \n return premake.CurrentContainer \n end \n function project(name) \n if (not name) then \n if(typex(premake.CurrentContainer) ~= \" project \" ) then return nil end \n if(premake.CurrentContainer.usage) then return nil end \n return premake.CurrentContainer \n end \n local sln \n if (typex(premake.CurrentContainer) == \" project \" ) then \n sln = premake.CurrentContainer.solution \n else \n sln = prem "
" ake.CurrentContainer \n end \n if (typex(sln) ~= \" solution \" ) then \n error( \" no active solution \" , 2) \n end \n if((not sln.projects[name]) or sln.projects[name].usage) then \n premake.CurrentContainer = createproject(name, sln) \n else \n premake.CurrentContainer = sln.projects[name]; \n end \n configuration { } \n return premake.CurrentContainer \n end \n function solution(name) \n if not name then \n if typex(premake.CurrentContainer) == \" project \" then \n return premake.CurrentContainer.solution \n else \n return premake.CurrentContainer \n end \n end \n premake.CurrentContainer = premake.solution.get(name) \n if (not premake.CurrentContainer) then \n premake.CurrentContainer = premake.solution.new(name) \n end \n configuration { } \n return premake.CurrentContainer \n end \n function group(name) \n if not name then \n return premake.CurrentGroup \n end \n premake.CurrentGroup = name \n return premake.CurrentGroup \n end \n function importvsproject(location) \n if string.find(_ACTION, \" vs \" ) ~= 1 then \n error( \" Only available for visual studio actions \" ) \n end \n sln, err = pr "
" emake.getobject( \" solution \" ) \n if not sln then \n error(err) \n end \n local group = creategroupsfrompath(premake.CurrentGroup, sln) \n local project = {} \n project.location = location \n project.group = group \n project.flags = {} \n table.insert(sln.importedprojects, project) \n end \n function newaction(a) \n premake.action.add(a) \n end \n function newoption(opt) \n premake.option.add(opt) \n end \n function enablefilelevelconfig() \n premake._filelevelconfig = true \n end \n " ,
" premake.fields = {} \n premake.check_paths = false \n function premake.checkvalue(value, allowed) \n if (allowed) then \n if (type(allowed) == \" function \" ) then \n return allowed(value) \n else \n for _,v in ipairs(allowed) do \n if (value:lower() == v:lower()) then \n return v \n end \n end \n return nil, \" invalid value ' \" .. value .. \" ' \" \n end \n else \n return value \n end \n end \n function premake.getobject(t) \n local container \n if (t == \" container \" or t == \" solution \" ) then \n container = premake.CurrentContainer \n else \n container = premake.CurrentConfiguration \n end \n if t == \" solution \" then \n if typex(container) == \" project \" then \n container = container.solution \n end \n if typex(container) ~= \" solution \" then \n container = nil \n end \n end \n local msg \n if (not container) then \n if (t == \" container \" ) then \n msg = \" no active solution or project \" \n elseif (t == \" solution \" ) then \n msg = \" no active solution \" \n else \n msg = \" no active solution, project, or configuration \" \n end \n end \n return container, msg \n end \n function premake.setarray(obj, "
" fieldname, value, allowed) \n obj[fieldname] = obj[fieldname] or {} \n local function add(value, depth) \n if type(value) == \" table \" then \n for _,v in ipairs(value) do \n add(v, depth + 1) \n end \n else \n value, err = premake.checkvalue(value, allowed) \n if not value then \n error(err, depth) \n end \n table.insert(obj[fieldname], value) \n end \n end \n if value then \n add(value, 5) \n end \n return obj[fieldname] \n end \n function premake.settable(obj, fieldname, value, allowed) \n obj[fieldname] = obj[fieldname] or {} \n table.insert(obj[fieldname], value) \n return obj[fieldname] \n end \n local function domatchedarray(fields, value, matchfunc) \n local result = { } \n function makeabsolute(value, depth) \n if (type(value) == \" table \" ) then \n for _, item in ipairs(value) do \n makeabsolute(item, depth + 1) \n end \n elseif type(value) == \" string \" then \n if value:find( \" * \" ) then \n local arr = matchfunc(value); \n if (premake.check_paths) and (#arr == 0) then \n error( \" Can't find matching files for pattern : \" .. value) \n end \n makeabsolute(arr, depth + 1) \n else \n t "
" able.insert(result, path.getabsolute(value)) \n end \n else \n error( \" Invalid value in list: expected string, got \" .. type(value), depth) \n end \n end \n makeabsolute(value, 3) \n local retval = {} \n for index, field in ipairs(fields) do \n local ctype = field[1] \n local fieldname = field[2] \n local array = premake.setarray(ctype, fieldname, result) \n if index == 1 then \n retval = array \n end \n end \n return retval \n end \n function premake.setdirarray(fields, value) \n return domatchedarray(fields, value, os.matchdirs) \n end \n function premake.setfilearray(fields, value) \n return domatchedarray(fields, value, os.matchfiles) \n end \n function premake.setkeyvalue(ctype, fieldname, values) \n local container, err = premake.getobject(ctype) \n if not container then \n error(err, 4) \n end \n if not container[fieldname] then \n container[fieldname] = {} \n end \n if type(values) ~= \" table \" then \n error( \" invalid value; table expected \" , 4) \n end \n local field = container[fieldname] \n for key,value in pairs(values) do \n if not field[key] then \n field[key] = {} \n end "
" \n table.insertflat(field[key], value) \n end \n return field \n end \n function premake.setstring(ctype, fieldname, value, allowed) \n local container, err = premake.getobject(ctype) \n if (not container) then \n error(err, 4) \n end \n if (value) then \n value, err = premake.checkvalue(value, allowed) \n if (not value) then \n error(err, 4) \n end \n container[fieldname] = value \n end \n return container[fieldname] \n end \n function premake.remove(fieldname, value) \n local cfg = premake.CurrentConfiguration \n cfg.removes = cfg.removes or {} \n cfg.removes[fieldname] = premake.setarray(cfg.removes, fieldname, value) \n end \n local function accessor(name, value) \n local kind = premake.fields[name].kind \n local scope = premake.fields[name].scope \n local allowed = premake.fields[name].allowed \n if (kind == \" string \" or kind == \" path \" ) and value then \n if type(value) ~= \" string \" then \n error( \" string value expected \" , 3) \n end \n end \n local container, err = premake.getobject(scope) \n if (not container) then \n error(err, 3) \n end \n if kind == \" string \" then "
" \n return premake.setstring(scope, name, value, allowed) \n elseif kind == \" path \" then \n if value then value = path.getabsolute(value) end \n return premake.setstring(scope, name, value) \n elseif kind == \" list \" then \n return premake.setarray(container, name, value, allowed) \n elseif kind == \" table \" then \n return premake.settable(container, name, value, allowed) \n elseif kind == \" dirlist \" then \n return premake.setdirarray({{container, name}}, value) \n elseif kind == \" filelist \" or kind == \" absolutefilelist \" then \n local fields = {{container, name}} \n if name == \" files \" then \n local prj, err = premake.getobject( \" container \" ) \n if (not prj) then \n error(err, 2) \n end \n table.insert(fields, {prj.blocks[1], \" allfiles \" }) \n end \n return premake.setfilearray(fields, value) \n elseif kind == \" keyvalue \" or kind == \" keypath \" then \n return premake.setkeyvalue(scope, name, value) \n end \n end \n function configuration(terms) \n if not terms then \n return premake.CurrentConfiguration \n end \n local container, err = premake.getobject( \" cont "
" ainer \" ) \n if (not container) then \n error(err, 2) \n end \n local cfg = { } \n cfg.terms = table.flatten({terms}) \n table.insert(container.blocks, cfg) \n premake.CurrentConfiguration = cfg \n cfg.keywords = { } \n for _, word in ipairs(cfg.terms) do \n table.insert(cfg.keywords, path.wildcards(word):lower()) \n end \n for name, field in pairs(premake.fields) do \n if (field.kind ~= \" string \" and field.kind ~= \" path \" ) then \n cfg[name] = { } \n end \n end \n return cfg \n end \n local function creategroup(name, sln, curpath, parent, inpath) \n local group = {} \n setmetatable(group, { \n __type = \" group \" \n }) \n table.insert(sln.groups, group) \n sln.groups[inpath] = group \n if parent ~= nil then \n table.insert(parent.groups, group) \n end \n group.solution = sln \n group.name = name \n group.uuid = os.uuid(curpath) \n group.parent = parent \n group.projects = { } \n group.groups = { } \n return group \n end \n local function creategroupsfrompath(inpath, sln) \n if inpath == nil then return nil end \n inpath = path.translate(inpath, \" / \" ) \n local groups = string.explode(inpa "
" th, \" / \" ) \n local curpath = \" \" \n local lastgroup = nil \n for i, v in ipairs(groups) do \n curpath = curpath .. \" / \" .. v:lower() \n local group = sln.groups[curpath] \n if group == nil then \n group = creategroup(v, sln, curpath, lastgroup, curpath) \n end \n lastgroup = group \n end \n return lastgroup \n end \n local function createproject(name, sln, isUsage) \n local prj = {} \n setmetatable(prj, { \n __type = \" project \" , \n }) \n table.insert(sln.projects, prj) \n if(isUsage) then \n if(sln.projects[name]) then \n sln.projects[name].usageProj = prj; \n else \n sln.projects[name] = prj \n end \n else \n if(sln.projects[name]) then \n prj.usageProj = sln.projects[name]; \n end \n sln.projects[name] = prj \n end \n local group = creategroupsfrompath(premake.CurrentGroup, sln) \n if group ~= nil then \n table.insert(group.projects, prj) \n end \n prj.solution = sln \n prj.name = name \n prj.basedir = os.getcwd() \n prj.uuid = os.uuid(prj.name) \n prj.blocks = { } \n prj.usage = isUsage \n prj.group = group \n return prj; \n end "
" \n function usage(name) \n if (not name) then \n if(typex(premake.CurrentContainer) ~= \" project \" ) then return nil end \n if(not premake.CurrentContainer.usage) then return nil end \n return premake.CurrentContainer \n end \n local sln \n if (typex(premake.CurrentContainer) == \" project \" ) then \n sln = premake.CurrentContainer.solution \n else \n sln = premake.CurrentContainer \n end \n if (typex(sln) ~= \" solution \" ) then \n error( \" no active solution \" , 2) \n end \n if((not sln.projects[name]) or \n ((not sln.projects[name].usage) and (not sln.projects[name].usageProj))) then \n premake.CurrentContainer = createproject(name, sln, true) \n else \n premake.CurrentContainer = iff(sln.projects[name].usage, \n sln.projects[name], sln.projects[name].usageProj) \n end \n configuration { } \n return premake.CurrentContainer \n end \n function project(name) \n if (not name) then \n if(typex(premake.CurrentContainer) ~= \" project \" ) then return nil end \n if(premake.CurrentContainer.usage) then return nil end \n return premake.CurrentContainer \n end \n local sln \n if (typex(pre "
" make.CurrentContainer) == \" project \" ) then \n sln = premake.CurrentContainer.solution \n else \n sln = premake.CurrentContainer \n end \n if (typex(sln) ~= \" solution \" ) then \n error( \" no active solution \" , 2) \n end \n if((not sln.projects[name]) or sln.projects[name].usage) then \n premake.CurrentContainer = createproject(name, sln) \n else \n premake.CurrentContainer = sln.projects[name]; \n end \n configuration { } \n return premake.CurrentContainer \n end \n function solution(name) \n if not name then \n if typex(premake.CurrentContainer) == \" project \" then \n return premake.CurrentContainer.solution \n else \n return premake.CurrentContainer \n end \n end \n premake.CurrentContainer = premake.solution.get(name) \n if (not premake.CurrentContainer) then \n premake.CurrentContainer = premake.solution.new(name) \n end \n configuration { } \n return premake.CurrentContainer \n end \n function group(name) \n if not name then \n return premake.CurrentGroup \n end \n premake.CurrentGroup = name \n return premake.CurrentGroup \n end \n function importvsproject(location) \n if string.fi "
" nd(_ACTION, \" vs \" ) ~= 1 then \n error( \" Only available for visual studio actions \" ) \n end \n sln, err = premake.getobject( \" solution \" ) \n if not sln then \n error(err) \n end \n local group = creategroupsfrompath(premake.CurrentGroup, sln) \n local project = {} \n project.location = location \n project.group = group \n project.flags = {} \n table.insert(sln.importedprojects, project) \n end \n function newaction(a) \n premake.action.add(a) \n end \n function newoption(opt) \n premake.option.add(opt) \n end \n function enablefilelevelconfig() \n premake._filelevelconfig = true \n end \n function newapifield(field) \n premake.fields[field.name] = field \n _G[field.name] = function(value) \n return accessor(field.name, value) \n end \n if field.kind == \" list \" \n or field.kind == \" dirlist \" \n or field.kind == \" filelist \" \n or field.kind == \" absolutefilelist \" \n then \n if field.name ~= \" removefiles \" \n and field.name ~= \" files \" then \n _G[ \" remove \" ..field.name] = function(value) \n premake.remove(field.name, value) \n end \n end \n end \n end \n newapifield { \n name = \" arc "
" hivesplit_size \" , \n kind = \" string \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" basedir \" , \n kind = \" path \" , \n scope = \" container \" , \n } \n newapifield { \n name = \" buildaction \" , \n kind = \" string \" , \n scope = \" config \" , \n allowed = { \n \" Compile \" , \n \" Copy \" , \n \" Embed \" , \n \" None \" \n } \n } \n newapifield { \n name = \" buildoptions \" , \n kind = \" list \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" buildoptions_asm \" , \n kind = \" list \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" buildoptions_c \" , \n kind = \" list \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" buildoptions_cpp \" , \n kind = \" list \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" buildoptions_objc \" , \n kind = \" list \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" buildoptions_objcpp \" , \n kind = \" list \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" buildoptions_vala \" , \n kind = \" list \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" clrreferences \" , \n kind = \" list \" , \n scope = \" container \" , \n } \n newapifield { \n name "
" = \" configurations \" , \n kind = \" list \" , \n scope = \" solution \" , \n } \n newapifield { \n name = \" custombuildtask \" , \n kind = \" table \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" debugcmd \" , \n kind = \" string \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" debugargs \" , \n kind = \" list \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" debugdir \" , \n kind = \" path \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" debugenvs \" , \n kind = \" list \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" defines \" , \n kind = \" list \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" deploymentoptions \" , \n kind = \" list \" , \n scope = \" config \" , \n usagecopy = true, \n } \n newapifield { \n name = \" dependency \" , \n kind = \" table \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" deploymode \" , \n kind = \" string \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" excludes \" , \n kind = \" filelist \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" forcenative \" , \n kind = \" filelist \" , \n scope = \" config \" , \n } \n newapifield "
" { \n name = \" nopch \" , \n kind = \" filelist \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" files \" , \n kind = \" filelist \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" removefiles \" , \n kind = \" filelist \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" flags \" , \n kind = \" list \" , \n scope = \" config \" , \n isflags = true, \n usagecopy = true, \n allowed = function(value) \n local allowed_flags = { \n AntBuildDebuggable = 1, \n ATL = 1, \n C7DebugInfo = 1, \n Cpp11 = 1, \n Cpp14 = 1, \n Cpp17 = 1, \n CppLatest = 1, \n DebugEnvsDontMerge = 1, \n DebugEnvsInherit = 1, \n DeploymentContent = 1, \n EnableMinimalRebuild = 1, \n EnableSSE = 1, \n EnableSSE2 = 1, \n EnableAVX = 1, \n EnableAVX2 = 1, \n PedanticWarnings = 1, \n ExtraWarnings = 1, \n FatalWarnings = 1, \n FloatFast = 1, \n FloatStrict = 1, \n FullSymbols = 1, \n Hotpatchable = 1, \n LinkSupportCircularDependencies = 1, \n Managed = 1, \n MinimumWarnings = 1, \n MFC = 1, \n NativeWChar = 1, \n No64BitChecks = 1, \n NoBufferSecurityCheck = 1, \n NoEditAndContinue = 1, \n NoExceptions = 1, \n NoFramePointer = 1, \n NoIm "
" portLib = 1, \n NoIncrementalLink = 1, \n NoJMC = 1, \n NoManifest = 1, \n NoMultiProcessorCompilation = 1, \n NoNativeWChar = 1, \n NoOptimizeLink = 1, \n NoPCH = 1, \n NoRTTI = 1, \n NoRuntimeChecks = 1, \n NoWinMD = 1, -- explicitly disables Windows Metadata \n NoWinRT = 1, -- explicitly disables Windows Runtime Extension \n FastCall = 1, \n StdCall = 1, \n SingleOutputDir = 1, \n ObjcARC = 1, \n Optimize = 1, \n OptimizeSize = 1, \n OptimizeSpeed = 1, \n DebugRuntime = 1, \n ReleaseRuntime = 1, \n SEH = 1, \n StaticATL = 1, \n StaticRuntime = 1, \n Symbols = 1, \n Unicode = 1, \n UnitySupport = 1, \n Unsafe = 1, \n UnsignedChar = 1, \n UseFullPaths = 1, \n UseLDResponseFile = 1, \n UseObjectResponseFile = 1, \n WinMain = 1 \n } \n local englishToAmericanSpelling = \n { \n nooptimiselink = 'nooptimizelink', \n optimise = 'optimize', \n optimisesize = 'optimizesize', \n optimisespeed = 'optimizespeed', \n } \n local lowervalue = value:lower() \n lowervalue = englishToAmericanSpelling[lowervalue] or lowervalue \n for v, _ in pairs(allowed_flags) do \n if v:lower() == lowervalue then \n retur "
" n v \n end \n end \n return nil, \" invalid flag \" \n end, \n } \n newapifield { \n name = \" framework \" , \n kind = \" string \" , \n scope = \" container \" , \n allowed = { \n \" 1.0 \" , \n \" 1.1 \" , \n \" 2.0 \" , \n \" 3.0 \" , \n \" 3.5 \" , \n \" 4.0 \" , \n \" 4.5 \" , \n \" 4.5.1 \" , \n \" 4.5.2 \" , \n \" 4.6 \" , \n \" 4.6.1 \" , \n \" 4.6.2 \" , \n } \n } \n newapifield { \n name = \" iostargetplatformversion \" , \n kind = \" string \" , \n scope = \" project \" , \n } \n newapifield { \n name = \" macostargetplatformversion \" , \n kind = \" string \" , \n scope = \" project \" , \n } \n newapifield { \n name = \" tvostargetplatformversion \" , \n kind = \" string \" , \n scope = \" project \" , \n } \n newapifield { \n name = \" windowstargetplatformversion \" , \n kind = \" string \" , \n scope = \" project \" , \n } \n newapifield { \n name = \" windowstargetplatformminversion \" , \n kind = \" string \" , \n scope = \" project \" , \n } \n newapifield { \n name = \" forcedincludes \" , \n kind = \" list \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" imagepath \" , \n kind = \" path \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" imageoptions \" , \n kind = \" list \" , "
" \n scope = \" config \" , \n } \n newapifield { \n name = \" implibdir \" , \n kind = \" path \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" implibextension \" , \n kind = \" string \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" implibname \" , \n kind = \" string \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" implibprefix \" , \n kind = \" string \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" implibsuffix \" , \n kind = \" string \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" includedirs \" , \n kind = \" dirlist \" , \n scope = \" config \" , \n usagecopy = true, \n } \n newapifield { \n name = \" systemincludedirs \" , \n kind = \" dirlist \" , \n scope = \" config \" , \n usagecopy = true, \n } \n newapifield { \n name = \" userincludedirs \" , \n kind = \" dirlist \" , \n scope = \" config \" , \n usagecopy = true, \n } \n newapifield { \n name = \" usingdirs \" , \n kind = \" dirlist \" , \n scope = \" config \" , \n usagecopy = true, \n } \n newapifield { \n name = \" kind \" , \n kind = \" string \" , \n scope = \" config \" , \n allowed = { \n \" ConsoleApp \" , \n \" WindowedApp \" , \n \" StaticLib "
" \" , \n \" SharedLib \" , \n \" Bundle \" , \n } \n } \n newapifield { \n name = \" language \" , \n kind = \" string \" , \n scope = \" container \" , \n allowed = { \n \" C \" , \n \" C++ \" , \n \" C# \" , \n \" Vala \" , \n \" Swift \" , \n } \n } \n newapifield { \n name = \" libdirs \" , \n kind = \" dirlist \" , \n scope = \" config \" , \n linkagecopy = true, \n } \n newapifield { \n name = \" linkoptions \" , \n kind = \" list \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" links \" , \n kind = \" list \" , \n scope = \" config \" , \n allowed = function(value) \n if value:find('/', nil, true) then \n value = path.getabsolute(value) \n end \n return value \n end, \n linkagecopy = true, \n mergecopiestotail = true, \n } \n newapifield { \n name = \" location \" , \n kind = \" path \" , \n scope = \" container \" , \n } \n newapifield { \n name = \" makesettings \" , \n kind = \" list \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" messageskip \" , \n kind = \" list \" , \n scope = \" solution \" , \n isflags = true, \n usagecopy = true, \n allowed = function(value) \n local allowed_messages = { \n SkipCreatingMessage = 1, \n SkipBuildingMessage = 1, \n Skip "
" CleaningMessage = 1, \n } \n local lowervalue = value:lower() \n for v, _ in pairs(allowed_messages) do \n if v:lower() == lowervalue then \n return v \n end \n end \n return nil, \" invalid message to skip \" \n end, \n } \n newapifield { \n name = \" msgarchiving \" , \n kind = \" string \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" msgcompile \" , \n kind = \" string \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" msgprecompile \" , \n kind = \" string \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" msgcompile_objc \" , \n kind = \" string \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" msgresource \" , \n kind = \" string \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" msglinking \" , \n kind = \" string \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" objdir \" , \n kind = \" path \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" options \" , \n kind = \" list \" , \n scope = \" container \" , \n isflags = true, \n usagecopy = true, \n allowed = function(value) \n local allowed_options = { \n ForceCPP = 1, \n ArchiveSplit = 1, \n SkipBundling = 1, \n "
" XcodeLibrarySchemes = 1, \n XcodeSchemeNoConfigs = 1, \n } \n local lowervalue = value:lower() \n for v, _ in pairs(allowed_options) do \n if v:lower() == lowervalue then \n return v \n end \n end \n return nil, \" invalid option \" \n end, \n } \n newapifield { \n name = \" pchheader \" , \n kind = \" string \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" pchsource \" , \n kind = \" path \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" platforms \" , \n kind = \" list \" , \n scope = \" solution \" , \n allowed = table.keys(premake.platforms), \n } \n newapifield { \n name = \" postbuildcommands \" , \n kind = \" list \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" prebuildcommands \" , \n kind = \" list \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" postcompiletasks \" , \n kind = \" list \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" prelinkcommands \" , \n kind = \" list \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" propertysheets \" , \n kind = \" dirlist \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" pullmappingfile \" , \n kind = \" path \" , \n "
" scope = \" config \" , \n } \n newapifield { \n name = \" applicationdatadir \" , \n kind = \" path \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" finalizemetasource \" , \n kind = \" path \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" resdefines \" , \n kind = \" list \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" resincludedirs \" , \n kind = \" dirlist \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" resoptions \" , \n kind = \" list \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" sdkreferences \" , \n kind = \" list \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" startproject \" , \n kind = \" string \" , \n scope = \" solution \" , \n } \n newapifield { \n name = \" targetdir \" , \n kind = \" path \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" targetsubdir \" , \n kind = \" string \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" targetextension \" , \n kind = \" string \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" targetname \" , \n kind = \" string \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" targetprefix \" , \n ki "
" nd = \" string \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" targetsuffix \" , \n kind = \" string \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" trimpaths \" , \n kind = \" dirlist \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" uuid \" , \n kind = \" string \" , \n scope = \" container \" , \n allowed = function(value) \n local ok = true \n if (#value ~= 36) then ok = false end \n for i=1,36 do \n local ch = value:sub(i,i) \n if (not ch:find( \" [ABCDEFabcdef0123456789-] \" )) then ok = false end \n end \n if (value:sub(9,9) ~= \" - \" ) then ok = false end \n if (value:sub(14,14) ~= \" - \" ) then ok = false end \n if (value:sub(19,19) ~= \" - \" ) then ok = false end \n if (value:sub(24,24) ~= \" - \" ) then ok = false end \n if (not ok) then \n return nil, \" invalid UUID \" \n end \n return value:upper() \n end \n } \n newapifield { \n name = \" uses \" , \n kind = \" list \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" vapidirs \" , \n kind = \" dirlist \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" vpaths \" , \n kind = \" keypath \" , \n scope = \" container \" , \n "
" } \n newapifield { \n name = \" vsimportreferences \" , \n kind = \" filelist \" , \n scope = \" container \" , \n } \n newapifield { \n name = \" dpiawareness \" , \n kind = \" string \" , \n scope = \" config \" , \n allowed = { \n \" None \" , \n \" High \" , \n \" HighPerMonitor \" , \n } \n } \n newapifield { \n name = \" xcodeprojectopts \" , \n kind = \" table \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" xcodetargetopts \" , \n kind = \" table \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" xcodescriptphases \" , \n kind = \" table \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" xcodecopyresources \" , \n kind = \" table \" , \n scope = \" project \" , \n } \n newapifield { \n name = \" xcodecopyframeworks \" , \n kind = \" filelist \" , \n scope = \" project \" , \n } \n newapifield { \n name = \" wholearchive \" , \n kind = \" list \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" swiftmodulemaps \" , \n kind = \" filelist \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" buildoptions_swift \" , \n kind = \" list \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" linkoptions_swift \" , \n kind = "
" \" list \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" androidtargetapi \" , \n kind = \" string \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" androidminapi \" , \n kind = \" string \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" androidarch \" , \n kind = \" string \" , \n scope = \" config \" , \n allowed = { \n \" armv7-a \" , \n \" armv7-a-hard \" , \n \" arm64-v8a \" , \n \" x86 \" , \n \" x86_64 \" , \n } \n } \n newapifield { \n name = \" androidndktoolchainversion \" , \n kind = \" string \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" androidstltype \" , \n kind = \" string \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" androidcppstandard \" , \n kind = \" string \" , \n scope = \" config \" , \n allowed = { \n \" c++98 \" , \n \" c++11 \" , \n \" c++1y \" , \n \" gnu++98 \" , \n \" gnu++11 \" , \n \" gnu++1y \" , \n } \n } \n newapifield { \n name = \" androidlinker \" , \n kind = \" string \" , \n scope = \" config \" , \n allowed = { \n \" bfd \" , \n \" gold \" , \n } \n } \n newapifield { \n name = \" androiddebugintentparams \" , \n kind = \" list \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" antbuildjavasourcedi "
" rs \" , \n kind = \" dirlist \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" antbuildjardirs \" , \n kind = \" dirlist \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" antbuildjardependencies \" , \n kind = \" list \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" antbuildnativelibdirs \" , \n kind = \" dirlist \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" antbuildnativelibdependencies \" , \n kind = \" list \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" antbuildassetsdirs \" , \n kind = \" dirlist \" , \n scope = \" config \" , \n } \n newapifield { \n name = \" postsolutioncallbacks \" , \n kind = \" list \" , \n scope = \" solution \" , \n } \n newapifield { \n name = \" postprojectcallbacks \" , \n kind = \" list \" , \n scope = \" project \" , \n } \n " ,
/* base/cmdline.lua */
" newoption \n { \n trigger = \" cc \" , \n value = \" VALUE \" , \n description = \" Choose a C/C++ compiler set \" , \n allowed = { \n { \" gcc \" , \" GNU GCC (gcc/g++) \" }, \n { \" ow \" , \" OpenWatcom \" }, \n { \" ghs \" , \" Green Hills Software \" }, \n } \n } \n newoption \n { \n trigger = \" dotnet \" , \n value = \" VALUE \" , \n description = \" Choose a .NET compiler set \" , \n allowed = { \n { \" msnet \" , \" Microsoft .NET (csc) \" }, \n { \" mono \" , \" Novell Mono (mcs) \" }, \n { \" pnet \" , \" Portable.NET (cscc) \" }, \n } \n } \n newoption \n { \n trigger = \" file \" , \n value = \" FILE \" , \n description = \" Read FILE as a Premake script; default is 'premake4.lua' \" \n } \n newoption \n { \n trigger = \" help \" , \n description = \" Display this information \" \n } \n newoption \n { \n trigger = \" os \" , \n value = \" VALUE \" , \n description = \" Generate files for a different operating system \" , \n allowed = { \n { \" bsd \" , \" OpenBSD, NetBSD, or FreeBSD \" }, \n { \" linux \" , \" Linux \" }, \n { \" macosx \" , \" Apple Mac OS X \" }, \n { \" solaris \" , \" Sola "
@ -134,16 +142,17 @@ const char* builtin_scripts[] = {
" _time] = 2, \n [_profiler._internal_profile_by_call] = 2, \n [_profiler_hook_wrapper_by_time] = 2, \n [_profiler_hook_wrapper_by_call] = 2, \n [_profiler.prevent] = 2, \n [_profiler._get_func_rec] = 2, \n [_profiler.report] = 2, \n [_profiler.lua_report] = 2, \n [_profiler._pretty_name] = 2 \n } \n " ,
/* tools/dotnet.lua */
" premake.dotnet = { } \n premake.dotnet.namestyle = \" windows \" \n local flags = \n { \n FatalWarning = \" /warnaserror \" , \n Optimize = \" /optimize \" , \n OptimizeSize = \" /optimize \" , \n OptimizeSpeed = \" /optimize \" , \n Symbols = \" /debug \" , \n Unsafe = \" /unsafe \" \n } \n function premake.dotnet.getbuildaction(fcfg) \n local ext = path.getextension(fcfg.name):lower() \n if fcfg.buildaction == \" Compile \" or ext == \" .cs \" then \n return \" Compile \" \n elseif fcfg.buildaction == \" Embed \" or ext == \" .resx \" then \n return \" EmbeddedResource \" \n elseif fcfg.buildaction == \" Copy \" or ext == \" .asax \" or ext == \" .aspx \" then \n return \" Content \" \n else \n return \" None \" \n end \n end \n function premake.dotnet.getcompilervar(cfg) \n if (_OPTIONS.dotnet == \" msnet \" ) then \n return \" csc \" \n elseif (_OPTIONS.dotnet == \" mono \" ) then \n if (cfg.framework <= \" 1.1 \" ) then \n return \" mcs \" \n else if (cfg.framework >= \" 4.0 \" ) then \n return \" dmcs \" \n else \n return \" gmcs \" \n end \n else \n return \" cscc \" \n end \n end \n function premake.dotnet.getfla "
" gs(cfg)\n local result = table.translate(cfg.flags, flags) \n return result \n end \n function premake.dotnet.getkind(cfg) \n if (c fg.kind == \" ConsoleApp \" ) then \n return \" Exe \" \n elseif (cfg.kind == \" WindowedApp \" ) then \n return \" WinExe \" \n elseif (cfg.kind == \" SharedLib \" ) then \n return \" Library \" \n end \n end " ,
" premake.dotnet = { } \n premake.dotnet.namestyle = \" windows \" \n local flags = \n { \n FatalWarning = \" /warnaserror \" , \n Optimize = \" /optimize \" , \n OptimizeSize = \" /optimize \" , \n OptimizeSpeed = \" /optimize \" , \n Symbols = \" /debug \" , \n Unsafe = \" /unsafe \" \n } \n function premake.dotnet.getbuildaction(fcfg) \n local ext = path.getextension(fcfg.name):lower() \n if fcfg.buildaction == \" Compile \" or ext == \" .cs \" then \n return \" Compile \" \n elseif fcfg.buildaction == \" Embed \" or ext == \" .resx \" then \n return \" EmbeddedResource \" \n elseif fcfg.buildaction == \" Copy \" or ext == \" .asax \" or ext == \" .aspx \" then \n return \" Content \" \n else \n return \" None \" \n end \n end \n function premake.dotnet.getcompilervar(cfg) \n if (_OPTIONS.dotnet == \" msnet \" ) then \n return \" csc \" \n elseif (_OPTIONS.dotnet == \" mono \" ) then \n return \" mcs \" \n else \n return \" cscc \" \n end \n end \n function premake.dotnet.getflags(cfg) \n local result = table.translate(cfg.flags, flags) \n return result \n end \n function premake.dotnet.getkind(cfg) \n if (c "
" fg.kind == \" ConsoleApp \" ) then \n return \" Exe \" \n elseif (cfg.kind == \" WindowedApp \" ) then \n return \" WinExe \" \n elseif (cfg.kind == \" SharedLib \" ) then \n return \" Library \" \n end \n end \n " ,
/* tools/gcc.lua */
" premake.gcc = { } \n premake.gcc.cc = \" gcc \" \n premake.gcc.cxx = \" g++ \" \n premake.gcc.ar = \" ar \" \n premake.gcc.rc = \" windres \" \n premake.gcc.llvm = false \n local cflags = \n { \n EnableSSE = \" -msse \" , \n EnableSSE2 = \" -msse2 \" , \n EnableAVX = \" -mavx \" , \n EnableAVX2 = \" -mavx2 \" , \n PedanticWarnings = \" -Wall -Wextra -pedantic \" , \n ExtraWarnings = \" -Wall -Wextra \" , \n FatalWarnings = \" -Werror \" , \n FloatFast = \" -ffast-math \" , \n FloatStrict = \" -ffloat-store \" , \n NoFramePointer = \" -fomit-frame-pointer \" , \n Optimize = \" -O2 \" , \n OptimizeSize = \" -Os \" , \n OptimizeSpeed = \" -O3 \" , \n Symbols = \" -g \" , \n } \n local cxxflags = \n { \n NoExceptions = \" -fno-exceptions \" , \n NoRTTI = \" -fno-rtti \" , \n UnsignedChar = \" -funsigned-char \" , \n } \n local objcflags = \n { \n ObjcARC = \" -fobjc-arc \" , \n } \n premake.gcc.platforms = \n { \n Native = { \n cppflags = \" -MMD -MP \" , \n }, \n x32 = { \n cppflags = \" -MMD -MP \" , \n flags = \" -m32 \" , \n }, \n x64 = { \n cppflags = \" -MMD "
" -MP \" , \n flags = \" -m64 \" , \n }, \n Universal = { \n ar = \" libtool \" , \n cppflags = \" -MMD -MP \" , \n flags = \" -arch i386 -arch x86_64 -arch ppc -arch ppc64 \" , \n }, \n Universal32 = { \n ar = \" libtool \" , \n cppflags = \" -MMD -MP \" , \n flags = \" -arch i386 -arch ppc \" , \n }, \n Universal64 = { \n ar = \" libtool \" , \n cppflags = \" -MMD -MP \" , \n flags = \" -arch x86_64 -arch ppc64 \" , \n }, \n PS3 = { \n cc = \" ppu-lv2-g++ \" , \n cxx = \" ppu-lv2-g++ \" , \n ar = \" ppu-lv2-ar \" , \n cppflags = \" -MMD -MP \" , \n }, \n WiiDev = { \n cppflags = \" -MMD -MP -I$(LIBOGC_INC) $(MACHDEP) \" , \n ldflags= \" -L$(LIBOGC_LIB) $(MACHDEP) \" , \n cfgsettings = [[ \n ifeq ($(strip $(DEVKITPPC)),) \n $(error \" DEVKITPPC environment variable is not set \" )' \n endif \n include $(DEVKITPPC)/wii_rules']], \n }, \n Orbis = { \n cc = \" orbis-clang \" , \n cxx = \" orbis-clang++ \" , \n ar = \" orbis-ar \" , \n cppflags = \" -MMD -MP \" , \n } \n } \n local platforms = premake.gcc.platforms \n function premake.gcc.getcppflags(cfg) \n local flags "
" = { } \n table.insert(flags, platforms[cfg.platform].cppflags) \n if flags[1]:startswith( \" -MMD \" ) then \n table.insert(flags, \" -MP \" ) \n end \n return flags \n end \n function premake.gcc.getcflags(cfg) \n local result = table.translate(cfg.flags, cflags) \n table.insert(result, platforms[cfg.platform].flags) \n if cfg.system ~= \" windows \" and cfg.kind == \" SharedLib \" then \n table.insert(result, \" -fPIC \" ) \n end \n return result \n end \n function premake.gcc.getcxxflags(cfg) \n local result = table.translate(cfg.flags, cxxflags) \n return result \n end \n function premake.gcc.getobjcflags(cfg) \n return table.translate(cfg.flags, objcflags) \n end \n function premake.gcc.getldflags(cfg) \n local result = { } \n if not cfg.flags.Symbols then \n if cfg.system == \" macosx \" then \n else \n table.insert(result, \" -s \" ) \n end \n end \n if cfg.kind == \" SharedLib \" then \n if cfg.system == \" macosx \" then \n table.insert(result, \" -dynamiclib \" ) \n else \n table.insert(result, \" -shared \" ) \n end \n if cfg.system == \" windows \" and not cfg.flags.NoImportLib then \n table.insert(r "
" esult, '-Wl,--out-implib= \" ' .. cfg.linktarget.fullpath .. ' \" ') \n end \n end \n if cfg.kind == \" WindowedApp \" and cfg.system == \" windows \" then \n table.insert(result, \" -mwindows \" ) \n end \n local platform = platforms[cfg.platform] \n table.insert(result, platform.flags) \n table.insert(result, platform.ldflags) \n return result \n end \n function premake.gcc.getlibdirflags(cfg) \n local result = { } \n for _, value in ipairs(premake.getlinks(cfg, \" all \" , \" directory \" )) do \n table.insert(result, '-L' .. _MAKE.esc(value)) \n end \n return result \n end \n function premake.gcc.islibfile(p) \n if path.getextension(p) == \" .a \" then \n return true \n end \n return false \n end \n function premake.gcc.getlibfiles(cfg) \n local result = {} \n for _, value in ipairs(premake.getlinks(cfg, \" system \" , \" fullpath \" )) do \n if premake.gcc.islibfile(value) then \n table.insert(result, _MAKE.esc(value)) \n end \n end \n return result \n end \n function premake.gcc.getlinkflags(cfg) \n local result = {} \n for _, value in ipairs(premake.getlinks(cfg, \" system \" , \" fullpath \" )) do \n if "
" premake.gcc.islibfile(value) then \n value = path.rebase(value, cfg.project.location, cfg.location) \n table.insert(result, _MAKE.esc(value)) \n elseif path.getextension(value) == \" .framework \" then \n table.insert(result, '-framework ' .. _MAKE.esc(path.getbasename(value))) \n else \n table.insert(result, '-l' .. _MAKE.esc(path.getname(value))) \n end \n end \n return result \n end \n function premake.gcc.getarchiveflags(prj, cfg, ndx) \n local result = {} \n if cfg.platform:startswith( \" Universal \" ) then \n if prj.options.ArchiveSplit then \n error( \" gcc tool 'Universal*' platforms do not support split archives \" ) \n end \n table.insert(result, '-o') \n else \n if (not prj.options.ArchiveSplit) then \n if premake.gcc.llvm then \n table.insert(result, 'rcs') \n else \n table.insert(result, '-rcs') \n end \n else \n if premake.gcc.llvm then \n if (not ndx) then \n table.insert(result, 'qc') \n else \n table.insert(result, 'cs') \n end \n else \n if (not ndx) then \n table.insert(result, '-qc') \n else \n table.insert(result, '-cs') \n end \n end \n end \n end \n return result \n end \n functi "
" on premake.gcc.getdefines(defines) \n local result = { } \n for _,def in ipairs(defines) do \n table.insert(result, \" -D \" .. def) \n end \n return result \n end \n function premake.gcc.getincludedirs(includedirs) \n local result = { } \n for _,dir in ipairs(includedirs) do \n table.insert(result, \" -I \\ \" \" .. dir .. \" \\ \" \" ) \n end \n return result \n end \n function premake.gcc.getquoteincludedirs(includedirs) \n local result = { } \n for _,dir in ipairs(includedirs) do \n table.insert(result, \" -iquote \\ \" \" .. dir .. \" \\ \" \" ) \n end \n return result \n end \n function premake.gcc.getcfgsettings(cfg) \n return platforms[cfg.platform].cfgsettings \n end \n " ,
" premake.gcc = { } \n premake.gcc.cc = \" gcc \" \n premake.gcc.cxx = \" g++ \" \n premake.gcc.ar = \" ar \" \n premake.gcc.rc = \" windres \" \n premake.gcc.llvm = false \n local cflags = \n { \n EnableSSE = \" -msse \" , \n EnableSSE2 = \" -msse2 \" , \n EnableAVX = \" -mavx \" , \n EnableAVX2 = \" -mavx2 \" , \n PedanticWarnings = \" -Wall -Wextra -pedantic \" , \n ExtraWarnings = \" -Wall -Wextra \" , \n FatalWarnings = \" -Werror \" , \n FloatFast = \" -ffast-math \" , \n FloatStrict = \" -ffloat-store \" , \n NoFramePointer = \" -fomit-frame-pointer \" , \n Optimize = \" -O2 \" , \n OptimizeSize = \" -Os \" , \n OptimizeSpeed = \" -O3 \" , \n Symbols = \" -g \" , \n } \n local cxxflags = \n { \n Cpp11 = \" -std=c++11 \" , \n Cpp14 = \" -std=c++14 \" , \n Cpp17 = \" -std=c++17 \" , \n CppLatest = \" -std=c++2a \" , \n NoExceptions = \" -fno-exceptions \" , \n NoRTTI = \" -fno-rtti \" , \n UnsignedChar = \" -funsigned-char \" , \n } \n local objcflags = \n { \n ObjcARC = \" -fobjc-arc \" , \n } \n premake.gcc.platforms = \n { \n Native = { \n "
" cppflags = \" -MMD -MP \" , \n }, \n x32 = { \n cppflags = \" -MMD -MP \" , \n flags = \" -m32 \" , \n }, \n x64 = { \n cppflags = \" -MMD -MP \" , \n flags = \" -m64 \" , \n }, \n Universal = { \n ar = \" libtool \" , \n cppflags = \" -MMD -MP \" , \n flags = \" -arch i386 -arch x86_64 -arch ppc -arch ppc64 \" , \n }, \n Universal32 = { \n ar = \" libtool \" , \n cppflags = \" -MMD -MP \" , \n flags = \" -arch i386 -arch ppc \" , \n }, \n Universal64 = { \n ar = \" libtool \" , \n cppflags = \" -MMD -MP \" , \n flags = \" -arch x86_64 -arch ppc64 \" , \n }, \n PS3 = { \n cc = \" ppu-lv2-g++ \" , \n cxx = \" ppu-lv2-g++ \" , \n ar = \" ppu-lv2-ar \" , \n cppflags = \" -MMD -MP \" , \n }, \n WiiDev = { \n cppflags = \" -MMD -MP -I$(LIBOGC_INC) $(MACHDEP) \" , \n ldflags= \" -L$(LIBOGC_LIB) $(MACHDEP) \" , \n cfgsettings = [[ \n ifeq ($(strip $(DEVKITPPC)),) \n $(error \" DEVKITPPC environment variable is not set \" )' \n endif \n include $(DEVKITPPC)/wii_rules']], \n }, \n Orbis = { \n cc = \" orbis-clang \" , \n cxx = \" orbis-clang++ \" , \n ar = \" orbis-ar \" , \n cppflag "
" s = \" -MMD -MP \" , \n }, \n Emscripten = { \n cc = \" $(EMSCRIPTEN)/emcc \" , \n cxx = \" $(EMSCRIPTEN)/em++ \" , \n ar = \" $(EMSCRIPTEN)/emar \" , \n cppflags = \" -MMD -MP \" , \n } \n } \n local platforms = premake.gcc.platforms \n function premake.gcc.getcppflags(cfg) \n local flags = { } \n table.insert(flags, platforms[cfg.platform].cppflags) \n if flags[1]:startswith( \" -MMD \" ) then \n table.insert(flags, \" -MP \" ) \n end \n return flags \n end \n function premake.gcc.getcflags(cfg) \n local result = table.translate(cfg.flags, cflags) \n table.insert(result, platforms[cfg.platform].flags) \n if cfg.system ~= \" windows \" and cfg.kind == \" SharedLib \" then \n table.insert(result, \" -fPIC \" ) \n end \n return result \n end \n function premake.gcc.getcxxflags(cfg) \n local result = table.translate(cfg.flags, cxxflags) \n return result \n end \n function premake.gcc.getobjcflags(cfg) \n return table.translate(cfg.flags, objcflags) \n end \n function premake.gcc.getldflags(cfg) \n local result = { } \n if not cfg.flags.Symbols then \n if cfg.system == \" macosx \" then "
" \n else \n table.insert(result, \" -s \" ) \n end \n end \n if cfg.kind == \" Bundle \" then \n table.insert(result, \" -bundle \" ) \n end \n if cfg.kind == \" SharedLib \" then \n if cfg.system == \" macosx \" then \n table.insert(result, \" -dynamiclib \" ) \n else \n table.insert(result, \" -shared \" ) \n end \n if cfg.system == \" windows \" and not cfg.flags.NoImportLib then \n table.insert(result, '-Wl,--out-implib= \" ' .. cfg.linktarget.fullpath .. ' \" ') \n end \n end \n if cfg.kind == \" WindowedApp \" and cfg.system == \" windows \" then \n table.insert(result, \" -mwindows \" ) \n end \n local platform = platforms[cfg.platform] \n table.insert(result, platform.flags) \n table.insert(result, platform.ldflags) \n return result \n end \n function premake.gcc.getlibdirflags(cfg) \n local result = { } \n for _, value in ipairs(premake.getlinks(cfg, \" all \" , \" directory \" )) do \n table.insert(result, '-L \\ \" ' .. value .. ' \\ \" ') \n end \n return result \n end \n function premake.gcc.islibfile(p) \n if path.getextension(p) == \" .a \" then \n return true \n end \n return false \n end \n function premake.gcc.ge "
" tlibfiles(cfg) \n local result = {} \n for _, value in ipairs(premake.getlinks(cfg, \" system \" , \" fullpath \" )) do \n if premake.gcc.islibfile(value) then \n table.insert(result, _MAKE.esc(value)) \n end \n end \n return result \n end \n function premake.gcc.getlinkflags(cfg) \n local result = {} \n for _, value in ipairs(premake.getlinks(cfg, \" system \" , \" fullpath \" )) do \n if premake.gcc.islibfile(value) then \n value = path.rebase(value, cfg.project.location, cfg.location) \n table.insert(result, _MAKE.esc(value)) \n elseif path.getextension(value) == \" .framework \" then \n table.insert(result, '-framework ' .. _MAKE.esc(path.getbasename(value))) \n else \n table.insert(result, '-l' .. _MAKE.esc(path.getname(value))) \n end \n end \n return result \n end \n function premake.gcc.wholearchive(lib) \n if premake.gcc.llvm then \n return { \" -force_load \" , lib} \n else \n return { \" -Wl,--whole-archive \" , lib, \" -Wl,--no-whole-archive \" } \n end \n end \n function premake.gcc.getarchiveflags(prj, cfg, ndx) \n local result = {} \n if cfg.platform:startswith( \" Universal \" ) then \n "
" if prj.options.ArchiveSplit then \n error( \" gcc tool 'Universal*' platforms do not support split archives \" ) \n end \n table.insert(result, '-o') \n else \n if (not prj.options.ArchiveSplit) then \n if premake.gcc.llvm then \n table.insert(result, 'rcs') \n else \n table.insert(result, '-rcs') \n end \n else \n if premake.gcc.llvm then \n if (not ndx) then \n table.insert(result, 'qc') \n else \n table.insert(result, 'cs') \n end \n else \n if (not ndx) then \n table.insert(result, '-qc') \n else \n table.insert(result, '-cs') \n end \n end \n end \n end \n return result \n end \n function premake.gcc.getdefines(defines) \n local result = { } \n for _,def in ipairs(defines) do \n table.insert(result, \" -D \" .. def) \n end \n return result \n end \n function premake.gcc.getincludedirs(includedirs) \n local result = { } \n for _,dir in ipairs(includedirs) do \n table.insert(result, \" -I \\ \" \" .. dir .. \" \\ \" \" ) \n end \n return result \n end \n function premake.gcc.getquoteincludedirs(includedirs) \n local result = { } \n for _,dir in ipairs(includedirs) do \n table.insert(result, \" -iquote \\ \" \" .. "
" dir .. \" \\ \" \" ) \n end \n return result \n end \n function premake.gcc.getsystemincludedirs(includedirs) \n local result = { } \n for _,dir in ipairs(includedirs) do \n table.insert(result, \" -isystem \\ \" \" .. dir .. \" \\ \" \" ) \n end \n return result \n end \n function premake.gcc.getcfgsettings(cfg) \n return platforms[cfg.platform].cfgsettings \n end \n " ,
/* tools/ghs.lua */
" premake.ghs = { } \n premake.ghs.namestyle = \" PS3 \" \n premake.ghs.cc = \" ccppc \" \n premake.ghs.cxx = \" cxppc \" \n premake.ghs.ar = \" cxppc \" \n local cflags = \n { \n FatalWarnings = \" --quit_after_warnings \" , \n Optimize = \" -Ogeneral \" , \n OptimizeSize = \" -Osize \" , \n OptimizeSpeed = \" -Ospeed \" , \n Symbols = \" -g \" , \n } \n local cxxflags = \n { \n NoExceptions = \" --no_exceptions \" , \n NoRTTI = \" --no_rtti \" , \n UnsignedChar = \" --unsigned_chars \" , \n } \n premake.ghs.platforms = \n { \n Native = { \n cppflags = \" -MMD \" , \n }, \n PowerPC = { \n cc = \" ccppc \" , \n cxx = \" cxppc \" , \n ar = \" cxppc \" , \n cppflags = \" -MMD \" , \n arflags = \" -archive -o \" , \n }, \n ARM = { \n cc = \" ccarm \" , \n cxx = \" cxarm \" , \n ar = \" cxarm \" , \n cppflags = \" -MMD \" , \n arflags = \" -archive -o \" , \n } \n } \n local platforms = premake.ghs.platforms \n function premake.ghs.getcppflags(cfg) \n local flags = { } \n table.insert(flags, platforms[cfg.platform].cppflags) \n return flags \n end \n function premake.ghs.getcf "
@ -181,8 +190,8 @@ const char* builtin_scripts[] = {
" function premake.showhelp() \n printf( \" \" ) \n printf( \" Usage: genie [options] action [arguments] \" ) \n printf( \" \" ) \n printf( \" OPTIONS \" ) \n printf( \" \" ) \n for option in premake.option.each() do \n local trigger = option.trigger \n local description = option.description \n if (option.value) then trigger = trigger .. \" = \" .. option.value end \n if (option.allowed) then description = description .. \" ; one of: \" end \n printf( \" --%-15s %s \" , trigger, description) \n if (option.allowed) then \n for _, value in ipairs(option.allowed) do \n printf( \" %-14s %s \" , value[1], value[2]) \n end \n end \n printf( \" \" ) \n end \n printf( \" ACTIONS \" ) \n printf( \" \" ) \n for action in premake.action.each() do \n printf( \" %-17s %s \" , action.trigger, action.description) \n end \n printf( \" \" ) \n printf( \" For additional information, see https://github.com/bkaradzic/genie \" ) \n end \n " ,
/* base/premake.lua */
" premake._filelevelconfig = false \n premake._checkgenerate = true \n function premake.generate(obj, filename, callback) \n filename = premake.project.getfilename(obj, filename)\n if (premake._checkgenerate) then \n io.capture() \n callback(obj) \n local new = io.endcapture() \n local delta = false \n local f, err = io.open(filename, \" rb \" ) \n if (not f) then \n if string.find(err, \" No such file or directory \" ) then \n delta = true \n else \n error(err, 0) \n end \n else \n local existing = f:read( \" *all \" ) \n if existing ~= new then \n delta = true \n end \n f:close() \n end \n if delta then \n printf( \" Generating %s... \" , filename) \n local f, err = io.open(filename, \" wb \" ) \n if (not f) then \n error(err, 0) \n end \n f:write(new) \n f:close() \n premake.stats.num_generated = premake.stats.num_generated + 1 \n else \n premake.stats.num_skipped = premake.stats.num_skipped + 1 \n end \n else \n printf( \" Generating %s... \" , filename) \n local f, err = io.open(filename, \" wb \" ) \n if (not f) then \n error(err, 0) \n end \n io.output(f) \n callback(obj) \n f:close() \n premake.stats.num_generate "
" d = premake.stats.num_generated + 1\n end \n end \n function premake.findDefaultScript(dir, search_upwards) \n search_upwards = search_upwards or true \n local last = \" \" \n while dir ~= last do \n for _, name in ipairs({ \" genie.lua \" , \" solution.lua \" , \" premake4.lua \" }) do \n local script0 = dir .. \" / \" .. name \n if (os.isfile(script0)) then \n return dir, name \n end \n local script1 = dir .. \" /scripts/ \" .. name \n if (os.isfile(script1)) then \n return dir .. \" /scripts/ \" , name \n end \n end \n last = dir \n dir = path.getabsolute(dir .. \" /.. \" ) \n if dir == \" . \" or not search_upwards then break end \n end \n return nil, nil \n end \n " ,
" premake._filelevelconfig = false \n premake._checkgenerate = true \n function premake.generate(obj, filename, callback) \n local prev = io.capture()\n local abort = (callback(obj) == false) \n local new = io.endcapture(prev) \n if abort then \n premake.stats.num_skipped = premake.stats.num_skipped + 1 \n return \n end \n filename = premake.project.getfilename(obj, filename)\n if (premake._checkgenerate) then \n local delta = false \n local f, err = io.open(filename, \" rb \" ) \n if (not f) then \n if string.find(err, \" No such file or directory \" ) then \n delta = true \n else \n error(err, 0) \n end \n else \n local existing = f:read( \" *all \" ) \n if existing ~= new then \n delta = true \n end \n f:close() \n end \n if delta then \n printf( \" Generating %s... \" , filename) \n local f, err = io.open(filename, \" wb \" ) \n if (not f) then \n error(err, 0) \n end \n f:write(new) \n f:close() \n premake.stats.num_generated = premake.stats.num_generated + 1 \n else \n premake.stats.num_skipped = premake.stats.num_skipped + 1 \n end \n else \n printf( \" Generating %s... \" , filename) \n local f, err "
" = io.open(filename, \" wb \" ) \n if (not f) then \n error(err, 0) \n end \n f:write(new) \n f:close() \n premake.stats.num_generate d = premake.stats.num_generated + 1\n end \n end \n function premake.findDefaultScript(dir, search_upwards) \n search_upwards = search_upwards or true \n local last = \" \" \n while dir ~= last do \n for _, name in ipairs({ \" genie.lua \" , \" solution.lua \" , \" premake4.lua \" }) do \n local script0 = dir .. \" / \" .. name \n if (os.isfile(script0)) then \n return dir, name \n end \n local script1 = dir .. \" /scripts/ \" .. name \n if (os.isfile(script1)) then \n return dir .. \" /scripts/ \" , name \n end \n end \n last = dir \n dir = path.getabsolute(dir .. \" /.. \" ) \n if dir == \" . \" or not search_upwards then break end \n end \n return nil, nil \n end \n " ,
/* base/iter.lua */
" iter = {} \n function iter.sortByKeys(arr, f) \n local a = table.keys(arr) \n table.sort(a, f) \n local i = 0 \n return function() \n i = i + 1 \n if a[i] ~= nil then \n return a[i], arr[a[i]] \n end \n end \n end \n " ,
@ -199,50 +208,53 @@ const char* builtin_scripts[] = {
/* actions/cmake/cmake_project.lua */
" local cmake = premake.cmake \n local tree = premake.tree \n local includestr = 'include_directories(../%s)' \n local definestr = 'add_definitions(-D%s)' \n local function is_excluded(prj, cfg, file) \n if table.icontains(prj.excludes, file) then \n return true \n end \n if table.icontains(cfg.excludes, file) then \n return true \n end \n return false \n end \n function cmake.excludedFiles(prj, cfg, src) \n for _, v in ipairs(src) do \n if (is_excluded(prj, cfg, v)) then \n _p(1, 'list(REMOVE_ITEM source_list ../%s)', v) \n end \n end \n end \n function cmake.list(value) \n if #value > 0 then \n return \" \" .. table.concat(value, \" \" ) \n else \n return \" \" \n end \n end \n function cmake.files(prj) \n local ret = {} \n local tr = premake.project.buildsourcetree(prj) \n tree.traverse(tr, { \n onbranchenter = function(node, depth) \n end, \n onbranchexit = function(node, depth) \n end, \n onleaf = function(node, depth) \n "
" table.insert(ret, node.cfg.name)\n _p(1, '../%s', node.cfg.name)\n end, \n }, true, 1) \n return ret \n end \n function cmake.header(prj) \n _p('# %s project autogenerated by GENie', premake.action.current().shortname) \n _p('cmake_minimum_required(VERSION 2.8.4)') \n _p('') \n _p('project(%s)', premake.esc(prj.name)) \n end \n function cmake.customtasks(prj) \n local dirs = {} \n local tasks = {} \n for _, custombuildtask in ipairs(prj.custombuildtask or {}) do \n for _, buildtask in ipairs(custombuildtask or {}) do \n table.insert(tasks, buildtask) \n local d = string.format( \" ${CMAKE_CURRENT_SOURCE_DIR}/../%s \" , path.getdirectory(path.getrelative(prj.location, buildtask[2]))) \n if not table.contains(dirs, d) then \n table.insert(dirs, d) \n _p('file(MAKE_DIRECTORY \\ \" %s \\ \" )', d) \n end \n end\n end \n _p('') \n for _, buildtask in ipairs(tasks) do \n local deps = string.format( \" ${ "
" CMAKE_CURRENT_SOURCE_DIR}/../%s \" , path.getrelative(prj.location, buildtask[1])) \n local outputs = string.format( \" ${CMAKE_CURRENT_SOURCE_DIR}/../%s \" , path.getrelative(prj.location, buildtask[2])) \n local msg = \" \" \n for _, depdata in ipairs(buildtask[3] or {}) do \n deps = deps .. string.format( \" ${CMAKE_CURRENT_SOURCE_DIR}/../%s \" , path.getrelative(prj.location, depdata)) \n end \n _p('add_custom_command(') \n _p(1, 'OUTPUT %s', outputs) \n _p(1, 'DEPENDS %s', deps) \n for _, cmdline in ipairs(buildtask[4] or {}) do \n if (cmdline:sub(1, 1) ~= \" @ \" ) then \n local cmd = cmdline \n local num = 1 \n for _, depdata in ipairs(buildtask[3] or {}) do \n cmd = string.gsub(cmd, \" %$%( \" .. num .. \" %) \" , string.format( \" ${CMAKE_CURRENT_SOURCE_DIR}/../%s \" , path.getrelative(pr j.location, depdata)))\n num = num + 1 \n end \n cmd = string "
" .gsub(cmd, \" %$%(<%) \" , string.format( \" ${CMAKE_CURRENT_SOURCE_DIR}/../%s \" , path.getrelative(prj.location, buildtask[1]))) \n cmd = string.gsub(cmd, \" %$%(@%) \" , outputs) \n _p(1, 'COMMAND %s', cmd) \n else \n msg = cmdline \n end \n end \n _p(1, 'COMMENT \\ \" %s \\ \" ', msg) \n _p(')') \n _p('') \n end \n end \n function cmake.depRules(prj) \n local maintable = {} \n for _, dependency in ipairs(prj.dependency) do \n for _, dep in ipairs(dependency) do \n if path.issourcefile(dep[1]) then \n local dep1 = premake.esc(path.getrelative(prj.location, dep[1])) \n local dep2 = premake.esc(path.getrelative(prj.location, dep[2])) \n if not maintable[dep1] then maintable[dep1] = {} end \n table.insert(maintable[dep1], dep2) \n end \n end \n end\n for key, _ in pairs(maintable) do \n local deplist = {} \n local depsname = string.fo "
" rmat('%s_deps', path.getname(key))\n for _, d2 in pairs(maintable[key]) do \n table.insert(deplist, d2) \n end \n _p('set(') \n _p(1, depsname) \n for _, v in pairs(deplist) do \n _p(1, '${CMAKE_CURRENT_SOURCE_DIR}/../%s', v) \n end \n _p(')') \n _p('') \n _p('set_source_files_properties(') \n _p(1, ' \\ \" ${CMAKE_CURRENT_SOURCE_DIR}/../%s \\ \" ', key) \n _p(1, 'PROPERTIES OBJECT_DEPENDS \\ \" ${%s} \\ \" ', depsname) \n _p(')') \n _p('') \n end \n end \n function cmake.commonRules(conf, str) \n local Dupes = {} \n local t2 = {} \n for _, cfg in ipairs(conf) do \n local cfgd = iif(str == includestr, cfg.includedirs, cfg.defines) \n for _, v in ipairs(cfgd) do \n if(t2[v] == #conf - 1) then \n _p(str, v) \n table.insert(Dupes, v) \n end \n if n ot t2[v] then\n t2[v] = 1 \n else \n t2[v] = t2[v] + 1 \n e "
" nd\n end \n end \n return Dupes \n end \n function cmake.cfgRules(cfg, dupes, str) \n for _, v in ipairs(cfg) do \n if (not table.icontains(dupes, v)) then \n _p(1, str, v) \n end \n end \n end \n function cmake.removeCrosscompiler(platforms) \n for i = #platforms, 1, -1 do \n if premake.platforms[platforms[i]].iscrosscompiler then \n table.remove(platforms, i) \n end \n end \n end \n function cmake.project(prj) \n io.indent = \" \" \n cmake.header(prj) \n _p('set(') \n _p('source_list') \n local source_files = cmake.files(prj) \n _p(')') \n _p('') \n local nativeplatform = iif(os.is64bit(), \" x64 \" , \" x32 \" ) \n local cc = premake.gettool(prj) \n local platforms = premake.filterplatforms(prj.solution, cc.platforms, \" Native \" ) \n cmake.removeCrosscompiler(platforms) \n local configurations = {} \n for _, platform in ipairs(plat forms) do\n for cfg in premake.eachconfig(prj, platform) do \n -- TODO: Extend support for "
" 32-bit targets on 64-bit hosts\n if cfg.platform == nativeplatform then \n table.insert(configurations, cfg) \n end \n end \n end \n local commonIncludes = cmake.commonRules(configurations, includestr) \n local commonDefines = cmake.commonRules(configurations, definestr) \n _p('') \n for _, cfg in ipairs(configurations) do \n _p('if(CMAKE_BUILD_TYPE MATCHES \\ \" %s \\ \" )', cfg.name) \n -- list excluded files \n cmake.excludedFiles(prj, cfg, source_files) \n -- add includes directories \n cmake.cfgRules(cfg.includedirs, commonIncludes, includestr) \n -- add build defines \n cmake.cfgRules(cfg.defines, commonDefines, definestr) \n -- set CXX flags \n _p(1, 'set(CMAKE_CXX_FLAGS \\ \" ${CMAKE_CXX_FLAGS} %s \\ \" )', cmake.list(table.join(cc.getcppflags(cfg), cc.getcflags(cfg), cc.getcxxflags(cfg), cfg.buildoptio ns, cfg.buildoptions_cpp)))\n -- set C flags \n _p(1, 'set(CMAKE_C_FLAGS \\ \" ${CMAKE_C_FLAGS} % "
" s\\ \" )', cmake.list(table.join(cc.getcppflags(cfg), cc.getcflags(cfg), cfg.buildoptions, cfg.buildoptions_c))) \n _p('endif()') \n _p('') \n end \n -- force CPP if needed \n if (prj.options.ForceCPP) then \n _p('set_source_files_properties(${source_list} PROPERTIES LANGUAGE CXX)') \n end \n -- add custom tasks \n cmake.customtasks(prj) \n -- per-dependency build rules \n cmake.depRules(prj) \n for _, cfg in ipairs(configurations) do \n _p('if(CMAKE_BUILD_TYPE MATCHES \\ \" %s \\ \" )', cfg.name) \n if (prj.kind == 'StaticLib') then \n _p(1, 'add_library(%s STATIC ${source_list})', premake.esc(cfg.buildtarget.basename)) \n end \n if (prj.kind == 'SharedLib') then \n _p(1, 'add_library(%s SHARED ${source_list})', premake.esc(cfg.buildtarget.basename)) \n end \n if (prj.kind == 'ConsoleApp' or prj.kind == 'WindowedApp') t hen\n _p(1, 'add_executable(%s ${source_list})', premake.esc(cfg.buildtarget.basename)) \n "
" _p(1, 'target_link_libraries(%s%s%s)', premake.esc(cfg.buildtarget.basename), cmake.list(premake.esc(premake.getlinks(cfg, \" siblings \" , \" basename \" ))), cmake.list(cc.getlinkflags(cfg))) \n end \n _p('endif()') \n _p('') \n end \n end " ,
" assert(node, \" unexpected empty node \" ) \n if node.cfg then \n table.insert(ret, node.cfg.name)\n _p(1, '../%s', node.cfg.name)\n end \n end, \n }, true, 1) \n return ret \n end \n function cmake.header(prj) \n _p('# %s project autogenerated by GENie', premake.action.current().shortname) \n _p('cmake_minimum_required(VERSION 2.8.4)') \n _p('') \n _p('project(%s)', premake.esc(prj.name)) \n end \n function cmake.customtasks(prj) \n local dirs = {} \n local tasks = {} \n for _, custombuildtask in ipairs(prj.custombuildtask or {}) do \n for _, buildtask in ipairs(custombuildtask or {}) do \n table.insert(tasks, buildtask) \n local d = string.format( \" ${CMAKE_CURRENT_SOURCE_DIR}/../%s \" , path.getdirectory(path.getrelative(prj.location, buildtask[2]))) \n if not table.contains(dirs, d) then \n table.insert(dirs, d) \n _p('file(MAKE_DIRECTORY \\ \" %s \\ \" )', d) \n end \n "
" end\n end \n _p('') \n for _, buildtask in ipairs(tasks) do \n local deps = string.format( \" ${ CMAKE_CURRENT_SOURCE_DIR}/../%s \" , path.getrelative(prj.location, buildtask[1])) \n local outputs = string.format( \" ${CMAKE_CURRENT_SOURCE_DIR}/../%s \" , path.getrelative(prj.location, buildtask[2])) \n local msg = \" \" \n for _, depdata in ipairs(buildtask[3] or {}) do \n deps = deps .. string.format( \" ${CMAKE_CURRENT_SOURCE_DIR}/../%s \" , path.getrelative(prj.location, depdata)) \n end \n _p('add_custom_command(') \n _p(1, 'OUTPUT %s', outputs) \n _p(1, 'DEPENDS %s', deps) \n for _, cmdline in ipairs(buildtask[4] or {}) do \n if (cmdline:sub(1, 1) ~= \" @ \" ) then \n local cmd = cmdline \n local num = 1 \n for _, depdata in ipairs(buildtask[3] or {}) do \n cmd = string.gsub(cmd, \" %$%( \" .. num .. \" %) \" , string.format( \" ${CMAKE_CURRENT_SOURCE_DIR}/../%s \" , path.getrelative(pr "
" j.location, depdata)))\n num = num + 1 \n end \n cmd = string .gsub(cmd, \" %$%(<%) \" , string.format( \" ${CMAKE_CURRENT_SOURCE_DIR}/../%s \" , path.getrelative(prj.location, buildtask[1]))) \n cmd = string.gsub(cmd, \" %$%(@%) \" , outputs) \n _p(1, 'COMMAND %s', cmd) \n else \n msg = cmdline \n end \n end \n _p(1, 'COMMENT \\ \" %s \\ \" ', msg) \n _p(')') \n _p('') \n end \n end \n function cmake.depRules(prj) \n local maintable = {} \n for _, dependency in ipairs(prj.dependency) do \n for _, dep in ipairs(dependency) do \n if path.issourcefile(dep[1]) then \n local dep1 = premake.esc(path.getrelative(prj.location, dep[1])) \n local dep2 = premake.esc(path.getrelative(prj.location, dep[2])) \n if not maintable[dep1] then maintable[dep1] = {} end \n table.insert(maintable[dep1], dep2) \n end \n end \n "
" end\n for key, _ in pairs(maintable) do \n local deplist = {} \n local depsname = string.fo rmat('%s_deps', path.getname(key))\n for _, d2 in pairs(maintable[key]) do \n table.insert(deplist, d2) \n end \n _p('set(') \n _p(1, depsname) \n for _, v in pairs(deplist) do \n _p(1, '${CMAKE_CURRENT_SOURCE_DIR}/../%s', v) \n end \n _p(')') \n _p('') \n _p('set_source_files_properties(') \n _p(1, ' \\ \" ${CMAKE_CURRENT_SOURCE_DIR}/../%s \\ \" ', key) \n _p(1, 'PROPERTIES OBJECT_DEPENDS \\ \" ${%s} \\ \" ', depsname) \n _p(')') \n _p('') \n end \n end \n function cmake.commonRules(conf, str) \n local Dupes = {} \n local t2 = {} \n for _, cfg in ipairs(conf) do \n local cfgd = iif(str == includestr, cfg.includedirs, cfg.defines) \n for _, v in ipairs(cfgd) do \n if(t2[v] == #conf - 1) then \n _p(str, v) \n table.insert(Dupes, v) \n end \n if n "
" ot t2[v] then\n t2[v] = 1 \n else \n t2[v] = t2[v] + 1 \n e nd\n end \n end \n return Dupes \n end \n function cmake.cfgRules(cfg, dupes, str) \n for _, v in ipairs(cfg) do \n if (not table.icontains(dupes, v)) then \n _p(1, str, v) \n end \n end \n end \n function cmake.removeCrosscompiler(platforms) \n for i = #platforms, 1, -1 do \n if premake.platforms[platforms[i]].iscrosscompiler then \n table.remove(platforms, i) \n end \n end \n end \n function cmake.project(prj) \n io.indent = \" \" \n cmake.header(prj) \n _p('set(') \n _p('source_list') \n local source_files = cmake.files(prj) \n _p(')') \n _p('') \n local nativeplatform = iif(os.is64bit(), \" x64 \" , \" x32 \" ) \n local cc = premake.gettool(prj) \n local platforms = premake.filterplatforms(prj.solution, cc.platforms, \" Native \" ) \n cmake.removeCrosscompiler(platforms) \n local configurations = {} \n for _, platform in ipairs(plat "
" forms) do\n for cfg in premake.eachconfig(prj, platform) do \n -- TODO: Extend support for 32-bit targets on 64-bit hosts\n if cfg.platform == nativeplatform then \n table.insert(configurations, cfg) \n end \n end \n end \n local commonIncludes = cmake.commonRules(configurations, includestr) \n local commonDefines = cmake.commonRules(configurations, definestr) \n _p('') \n for _, cfg in ipairs(configurations) do \n _p('if(CMAKE_BUILD_TYPE MATCHES \\ \" %s \\ \" )', cfg.name) \n -- list excluded files \n cmake.excludedFiles(prj, cfg, source_files) \n -- add includes directories \n cmake.cfgRules(cfg.includedirs, commonIncludes, includestr) \n -- add build defines \n cmake.cfgRules(cfg.defines, commonDefines, definestr) \n -- set CXX flags \n _p(1, 'set(CMAKE_CXX_FLAGS \\ \" ${CMAKE_CXX_FLAGS} %s \\ \" )', cmake.list(table.join(cc.getcppflags(cfg), cc.getcflags(cfg), cc.getcxxflags(cfg), cfg.buildoptio "
" ns, cfg.buildoptions_cpp)))\n -- set C flags \n _p(1, 'set(CMAKE_C_FLAGS \\ \" ${CMAKE_C_FLAGS} % s\\ \" )', cmake.list(table.join(cc.getcppflags(cfg), cc.getcflags(cfg), cfg.buildoptions, cfg.buildoptions_c))) \n _p('endif()') \n _p('') \n end \n -- force CPP if needed \n if (prj.options.ForceCPP) then \n _p('set_source_files_properties(${source_list} PROPERTIES LANGUAGE CXX)') \n end \n -- add custom tasks \n cmake.customtasks(prj) \n -- per-dependency build rules \n cmake.depRules(prj) \n for _, cfg in ipairs(configurations) do \n _p('if(CMAKE_BUILD_TYPE MATCHES \\ \" %s \\ \" )', cfg.name) \n if (prj.kind == 'StaticLib') then \n _p(1, 'add_library(%s STATIC ${source_list})', premake.esc(cfg.buildtarget.basename)) \n end \n if (prj.kind == 'SharedLib') then \n _p(1, 'add_library(%s SHARED ${source_list})', premake.esc(cfg.buildtarget.basename)) \n end \n if (prj.kind == 'ConsoleApp' or prj.kind == 'WindowedApp') t "
" hen\n _p(1, 'add_executable(%s ${source_list})', premake.esc(cfg.buildtarget.basename)) \n _p(1, 'target_link_libraries(%s%s%s)', premake.esc(cfg.buildtarget.basename), cmake.list(premake.esc(premake.getlinks(cfg, \" siblings \" , \" basename \" ))), cmake.list(cc.getlinkflags(cfg))) \n end \n _p('endif()') \n _p('') \n end \n end " ,
/* actions/make/_make.lua */
" _MAKE = { } \n premake.make = { } \n local make = premake.make \n function _MAKE.esc(value) \n local result \n if (type(value) == \" table \" ) then \n result = { } \n for _,v in ipairs(value) do \n table.insert(result, _MAKE.esc(v)) \n end \n return result \n else \n result = value:gsub( \" \\ \\ \" , \" \\ \\ \\ \\ \" ) \n result = result:gsub( \" \" , \" \\ \\ \" ) \n result = result:gsub( \" %%( \" , \" \\ \\ %( \" ) \n result = result:gsub( \" %%) \" , \" \\ \\ %) \" ) \n result = result:gsub( \" $ \\ \\ %((.-) \\ \\ %) \" , \" $%(%1%) \" ) \n return result \n end \n end \n function premake.make_copyrule(source, target) \n _p('%s: %s', target, source) \n _p(' \\ t@echo Copying $(notdir %s)', target) \n _p(' \\ t-$(call COPY,%s,%s)', source, target) \n end \n function premake.make_mkdirrule(var) \n _p(' \\ t@echo Creating %s', var) \n _p(' \\ t-$(call MKDIR,%s)', var) \n _p('') \n end \n function make.list(value) \n if #value > 0 then \n return \" \" .. table.concat(value, \" \" ) \n else \n return \" \" \n end \n end \n function _MAKE.getmakefilename(this, searchprjs) \n local count = 0 \n for sln in premake.solution.each() do \n if (sln.loca "
" tion == this.location) then count = count + 1 end \n if (searchprjs) then \n for _,prj in ipairs(sln.projects) do \n if (prj.location == this.location) then count = count + 1 end \n end \n end \n end \n if (count == 1) then \n return \" Makefile \" \n else \n return this.name .. \" .make \" \n end \n end \n function _MAKE.getnames(tbl) \n local result = table.extract(tbl, \" name \" ) \n for k,v in pairs(result) do \n result[k] = _MAKE.esc(v) \n end \n return result \n end \n function make.settings(cfg, cc) \n if #cfg.makesettings > 0 then \n for _, value in ipairs(cfg.makesettings) do \n _p(value) \n end \n end \n local toolsettings = cc.platforms[cfg.platform].cfgsettings \n if toolsettings then \n _p(toolsettings) \n end \n end \n newaction { \n trigger = \" gmake \" , \n shortname = \" GNU Make \" , \n description = \" Generate GNU makefiles for POSIX, MinGW, and Cygwin \" , \n valid_kinds = { \" ConsoleApp \" , \" WindowedApp \" , \" StaticLib \" , \" SharedLib \" , \" Bundle \" }, \n valid_languages = { \" C \" , \" C++ \" , \" C# \" , \" Vala \" , \" Swift \" }, \n valid_tools = { \n cc = { "
" \" gcc \" , \" ghs \" }, \n dotnet = { \" mono \" , \" msnet \" , \" pnet \" }, \n valac = { \" valac \" }, \n swift = { \" swift \" }, \n }, \n onsolution = function(sln) \n premake.generate(sln, _MAKE.getmakefilename(sln, false), premake.make_solution) \n end, \n onproject = function(prj) \n local makefile = _MAKE.getmakefilename(prj, true) \n if premake.isdotnetproject(prj) then \n premake.generate(prj, makefile, premake.make_csharp) \n elseif premake.iscppproject(prj) then \n premake.generate(prj, makefile, premake.make_cpp) \n elseif premake.isswiftproject(prj) then \n premake.generate(prj, makefile, premake.make_swift) \n else \n premake.generate(prj, makefile, premake.make_vala) \n end \n end, \n oncleansolution = function(sln) \n premake.clean.file(sln, _MAKE.getmakefilename(sln, false)) \n end, \n oncleanproject = function(prj) \n premake.clean.file(prj, _MAKE.getmakefilename(prj, true)) \n end \n } \n " ,
" _MAKE = { } \n premake.make = { } \n local make = premake.make \n function _MAKE.esc(value) \n local result \n if (type(value) == \" table \" ) then \n result = { } \n for _,v in ipairs(value) do \n table.insert(result, _MAKE.esc(v)) \n end \n return result \n else \n result = value:gsub( \" \\ \\ \" , \" \\ \\ \\ \\ \" ) \n result = result:gsub( \" \" , \" \\ \\ \" ) \n result = result:gsub( \" %%( \" , \" \\ \\ %( \" ) \n result = result:gsub( \" %%) \" , \" \\ \\ %) \" ) \n result = result:gsub( \" $ \\ \\ %((.-) \\ \\ %) \" , \" $%(%1%) \" ) \n return result \n end \n end \n function _MAKE.escquote(value) \n local result \n if (type(value) == \" table \" ) then \n result = { } \n for _,v in ipairs(value) do \n table.insert(result, _MAKE.escquote(v)) \n end \n return result \n else \n result = value:gsub( \" \" , \" \\ \\ \" ) \n result = result:gsub( \" \\ \" \" , \" \\ \\ \\ \" \" ) \n return result \n end \n end \n function premake.make_copyrule(source, target) \n _p('%s: %s', target, source) \n _p(' \\ t@echo Copying $(notdir %s)', target) \n _p(' \\ t-$(call COPY,%s,%s)', source, target) \n end \n function premake.make_mkdirrule(var) \n _p(' \\ t@echo Cr "
" eating %s', var) \n _p(' \\ t-$(call MKDIR,%s)', var) \n _p('') \n end \n function make.list(value) \n if #value > 0 then \n return \" \" .. table.concat(value, \" \" ) \n else \n return \" \" \n end \n end \n function _MAKE.getmakefilename(this, searchprjs) \n local count = 0 \n for sln in premake.solution.each() do \n if (sln.location == this.location) then count = count + 1 end \n if (searchprjs) then \n for _,prj in ipairs(sln.projects) do \n if (prj.location == this.location) then count = count + 1 end \n end \n end \n end \n if (count == 1) then \n return \" Makefile \" \n else \n return this.name .. \" .make \" \n end \n end \n function _MAKE.getnames(tbl) \n local result = table.extract(tbl, \" name \" ) \n for k,v in pairs(result) do \n result[k] = _MAKE.esc(v) \n end \n return result \n end \n function make.settings(cfg, cc) \n if #cfg.makesettings > 0 then \n for _, value in ipairs(cfg.makesettings) do \n _p(value) \n end \n end \n local toolsettings = cc.platforms[cfg.platform].cfgsettings \n if toolsettings then \n _p(toolsettings) \n end \n end \n newaction { \n trigger = \" gmake \" , \n short "
" name = \" GNU Make \" , \n description = \" Generate GNU makefiles for POSIX, MinGW, and Cygwin \" , \n valid_kinds = { \" ConsoleApp \" , \" WindowedApp \" , \" StaticLib \" , \" SharedLib \" , \" Bundle \" }, \n valid_languages = { \" C \" , \" C++ \" , \" C# \" , \" Vala \" , \" Swift \" }, \n valid_tools = { \n cc = { \" gcc \" , \" ghs \" }, \n dotnet = { \" mono \" , \" msnet \" , \" pnet \" }, \n valac = { \" valac \" }, \n swift = { \" swift \" }, \n }, \n onsolution = function(sln) \n premake.generate(sln, _MAKE.getmakefilename(sln, false), premake.make_solution) \n end, \n onproject = function(prj) \n local makefile = _MAKE.getmakefilename(prj, true) \n if premake.isdotnetproject(prj) then \n premake.generate(prj, makefile, premake.make_csharp) \n elseif premake.iscppproject(prj) then \n premake.generate(prj, makefile, premake.make_cpp) \n elseif premake.isswiftproject(prj) then \n premake.generate(prj, makefile, premake.make_swift) \n else \n premake.generate(prj, makefile, premake.make_vala) \n end \n end, \n oncleansolution = function(sln) \n premake.clean.file(sln, _MAKE.ge "
" tmakefilename(sln, false)) \n end, \n oncleanproject = function(prj) \n premake.clean.file(prj, _MAKE.getmakefilename(prj, true)) \n end, \n gmake = {} \n } \n " ,
/* actions/make/make_solution.lua */
" function premake.make_solution(sln) \n local cc = premake[_OPTIONS.cc] \n local platforms = premake.filterplatforms(sln, cc.platforms, \" Native \" ) \n _p('# %s solution makefile autogenerated by GENie', premake.action.current().shortname) \n _p('# Type \" make help \" for usage help') \n _p('') \n _p('ifndef config') \n _p(' config=%s', _MAKE.esc(premake.getconfigname(sln.configurations[1], platforms[1], true))) \n _p('endif') \n _p('export config') \n _p('') \n local projects = table.extract(sln.projects, \" name \" ) \n table.sort(projects) \n _p('PROJECTS := %s', table.concat(_MAKE.esc(projects), \" \" )) \n _p('') \n _p('.PHONY: all clean help $(PROJECTS)') \n _p('') \n _p('all: $(PROJECTS)') \n _p('') \n for _, prj in ipairs(sln.projects) do \n _p('%s: %s', _MAKE.esc(prj.name), table.concat(_MAKE.esc(table.extract(premake.getdependencies(prj), \" name \" )), \" \" )) \n if (not sln.messageskip) or (not table.contains(sln.messageskip, \" SkipBuildingMessage \" )) then \n _p(' \\ t@echo \" ==== Building %s ($(config)) ==== \" ', prj.name) \n end \n _p(' \\ t@${MAKE} --no-pr "
" int-directory -C %s -f %s', _MAKE.esc(path.getrelative(sln.location, prj.location)), _MAKE.esc(_MAKE.getmakefilename(prj, true))) \n _p('') \n end \n _p('clean:') \n for _ ,prj in ipairs(sln.projects) do \n _p(' \\ t@${MAKE} --no-print-directory -C %s -f %s clean', _MAKE.esc(path.getrelative(sln.location, prj.location)), _MAKE.esc(_MAKE.getmakefilename(prj, true))) \n end \n _p('') \n _p('help:') \n _p(1,'@echo \" Usage: make [config=name] [target] \" ') \n _p(1,'@echo \" \" ') \n _p(1,'@echo \" CONFIGURATIONS: \" ') \n local cfgpairs = { } \n for _, platform in ipairs(platforms) do \n for _, cfgname in ipairs(sln.configurations) do \n _p(1,'@echo \" %s \" ', premake.getconfigname(cfgname, platform, true)) \n end \n end \n _p(1,'@echo \" \" ') \n _p(1,'@echo \" TARGETS: \" ') \n _p(1,'@echo \" all (default) \" ') \n _p(1,'@echo \" clean \" ') \n for _, prj in ipairs(sln.projects) do \n _p(1,'@echo \" %s \" ', prj.name) \n end \n _p(1,'@echo \" \" ') \n _p(1,'@echo \" For more information, see https://github.com/bkaradzic/genie \" ') \n end \n " ,
/* actions/make/make_cpp.lua */
" premake.make.cpp = { } \n premake.make.override = { } \n premake.make.makefile_ignore = false \n local cpp = premake.make.cpp \n local make = premake.make \n function premake.make_cpp(prj) \n local cc = premake.gettool(prj) \n local platforms = premake.filterplatforms(prj.solution, cc.platforms, \" Native \" ) \n premake.gmake_cpp_header(prj, cc, platforms) \n for _, platform in ipairs(platforms) do \n for cfg in premake.eachconfig(prj, platform) do \n premake.gmake_cpp_config(prj, cfg, cc) \n end \n end \n table.sort(prj.allfiles) \n local objdirs = {} \n local additionalobjdirs = {} \n for _, file in ipairs(prj.allfiles) do \n if path.issourcefile(file) then \n objdirs[_MAKE.esc(path.getdirectory(path.trimdots(file)))] = 1 \n end \n end \n for _, custombuildtask in ipairs(prj.custombuildtask or {}) do \n for _, buildtask in ipairs(custombuildtask or {}) do \n additionalobjdirs[_MAKE.esc(path.getdirectory(path.getrelative(prj.location,buildtask[2])))] = 1 \n end \n end \n _p('OBJDIRS := \\ \\ ') \n _p(' \\ t$(OBJDIR) \\ \\ ') \n for dir, _ in iter.sortByKeys(objdirs) do \n _p( "
" ' \\ t$(OBJDIR)/%s \\ \\ ', dir) \n end \n for dir, _ in iter.sortByKeys(additionalobjdirs) do \n _p(' \\ t%s \\ \\ ', dir) \n end \n _p('') \n _p('RESOURCES := \\ \\ ') \n for _, file in ipairs(prj.allfiles) do \n if path.isresourcefile(file) then \n _p(' \\ t$(OBJDIR)/%s.res \\ \\ ', _MAKE.esc(path.getbasename(file))) \n end \n end \n _p('') \n _p('.PHONY: clean prebuild prelink') \n _p('') \n if os.is( \" MacOSX \" ) and prj.kind == \" WindowedApp \" then \n _p('all: $(OBJDIRS) $(TARGETDIR) prebuild prelink $(TARGET) $(dir $(TARGETDIR))PkgInfo $(dir $(TARGETDIR))Info.plist') \n else \n _p('all: $(OBJDIRS) $(TARGETDIR) prebuild prelink $(TARGET)') \n end \n _p(' \\ t@:') \n _p('') \n if (prj.kind == \" StaticLib \" and prj.options.ArchiveSplit) then \n _p('define max_args') \n _p(' \\ t$(eval _args:=)') \n _p(' \\ t$(foreach obj,$3,$(eval _args+=$(obj))$(if $(word $2,$(_args)),$1$(_args)$(EOL)$(eval _args:=)))') \n _p(' \\ t$(if $(_args),$1$(_args))') \n _p('endef') \n _p('') \n _p('define EOL') \n _p('') \n _p('') \n _p('endef') \n _p('') \n end \n _p('$(TARGET): $(GCH) $(OBJECTS) $(LDDEPS) $(EXTERNAL_LIB "
" S) $(RESOURCES) | $(TARGETDIR) $(OBJDIRS)') \n if prj.kind == \" StaticLib \" then \n if prj.msgarchiving then \n _p(' \\ t@echo ' .. prj.msgarchiving) \n else \n _p(' \\ t@echo Archiving %s', prj.name) \n end \n if (not prj.archivesplit_size) then \n prj.archivesplit_size=200 \n end \n if (not prj.options.ArchiveSplit) then \n _p('ifeq (posix,$(SHELLTYPE))') \n _p(' \\ t$(SILENT) rm -f $(TARGET)') \n _p('else') \n _p(' \\ t$(SILENT) if exist $(subst /, \\ \\ \\ \\ ,$(TARGET)) del $(subst /, \\ \\ \\ \\ ,$(TARGET))') \n _p('endif') \n _p(' \\ t$(SILENT) $(LINKCMD) $(OBJECTS)' .. (os.is( \" MacOSX \" ) and \" 2>&1 > /dev/null | sed -e '/.o) has no symbols$$/d' \" or \" \" )) \n else \n _p(' \\ t$(call RM,$(TARGET))') \n _p(' \\ t@$(call max_args,$(LINKCMD),'.. prj.archivesplit_size ..',$(OBJECTS))' .. (os.is( \" MacOSX \" ) and \" 2>&1 > /dev/null | sed -e '/.o) has no symbols$$/d' \" or \" \" )) \n _p(' \\ t$(SILENT) $(LINKCMD_NDX)') \n end \n else \n if prj.msglinking then \n _p(' \\ t@echo ' .. prj.msglinking) \n else \n _p(' \\ t@echo Linking %s', prj.name) \n end \n _p(' \\ t$(SILENT) $(LINKCMD)') \n end \n _p( "
" ' \\ t$(POSTBUILDCMDS)') \n _p('') \n _p('$(TARGETDIR):') \n premake.make_mkdirrule( \" $(TARGETDIR) \" ) \n _p('$(OBJDIRS):') \n if (not prj.solution.messageskip) or (not table.contains(prj.solution.messageskip, \" SkipCreatingMessage \" )) then \n _p(' \\ t@echo Creating $(@)') \n end \n _p(' \\ t-$(call MKDIR,$@)') \n _p('') \n if os.is( \" MacOSX \" ) and prj.kind == \" WindowedApp \" then \n _p('$(dir $(TARGETDIR))PkgInfo:') \n _p('$(dir $(TARGETDIR))Info.plist:') \n _p('') \n end \n _p('clean:') \n if (not prj.solution.messageskip) or (not table.contains(prj.solution.messageskip, \" SkipCleaningMessage \" )) then \n _p(' \\ t@echo Cleaning %s', prj.name) \n end \n _p('ifeq (posix,$(SHELLTYPE))') \n _p(' \\ t$(SILENT) rm -f $(TARGET)') \n _p(' \\ t$(SILENT) rm -rf $(OBJDIR)') \n _p('else') \n _p(' \\ t$(SILENT) if exist $(subst /, \\ \\ \\ \\ ,$(TARGET)) del $(subst /, \\ \\ \\ \\ ,$(TARGET))') \n _p(' \\ t$(SILENT) if exist $(subst /, \\ \\ \\ \\ ,$(OBJDIR)) rmdir /s /q $(subst /, \\ \\ \\ \\ ,$(OBJDIR))') \n _p('endif') \n _p('') \n _p('prebuild:') \n _p(' \\ t$(PREBUILDCMDS)') \n _p('') \n _p('prelink:') \n _p(' \\ t "
" $(PRELINKCMDS)') \n _p('') \n cpp.pchrules(prj) \n cpp.fileRules(prj, cc) \n cpp.dependencyRules(prj) \n for _, custombuildtask in ipairs(prj.custombuildtask or {}) do \n for _, buildtask in ipairs(custombuildtask or {}) do \n local deps = string.format( \" %s \" ,path.getrelative(prj.location,buildtask[1])) \n for _, depdata in ipairs(buildtask[3] or {}) do \n deps = deps .. string.format( \" %s \" ,path.getrelative(prj.location,depdata)) \n end \n _p('%s: %s | $(TARGETDIR) $(OBJDIRS)' \n ,path.getrelative(prj.location,buildtask[2]) \n , deps \n ) \n for _, cmdline in ipairs(buildtask[4] or {}) do \n local cmd = cmdline \n local num = 1 \n for _, depdata in ipairs(buildtask[3] or {}) do \n cmd = string.gsub(cmd, \" %$%( \" .. num .. \" %) \" , string.format( \" %s \" ,path.getrelative(prj.location,depdata))) \n num = num + 1 \n end \n cmd = string.gsub(cmd, \" %$%(<%) \" , \" $< \" ) \n cmd = string.gsub(cmd, \" %$%(@%) \" , \" $@ \" ) \n _p(' \\ t$(SILENT) %s',cmd) \n end \n _p('') \n end \n end \n _p('-include $(OBJECTS:%%.o=%%.d)') \n _p('ifneq (,$(PCH))') \n _p(' -include $(OBJDIR)/$(notdir $( "
" PCH)).d') \n _p(' -include $(OBJDIR)/$(notdir $(PCH))_objc.d') \n _p('endif') \n end \n function premake.gmake_cpp_header(prj, cc, platforms) \n _p('# %s project makefile autogenerated by GENie', premake.action.current().shortname) \n _p('ifndef config') \n _p(' config=%s', _MAKE.esc(premake.getconfigname(prj.solution.configurations[1], platforms[1], true))) \n _p('endif') \n _p('') \n _p('ifndef verbose') \n _p(' SILENT = @') \n _p('endif') \n _p('') \n _p('SHELLTYPE := msdos') \n _p('ifeq (,$(ComSpec)$(COMSPEC))') \n _p(' SHELLTYPE := posix') \n _p('endif') \n _p('ifeq (/bin,$(findstring /bin,$(SHELL)))') \n _p(' SHELLTYPE := posix') \n _p('endif') \n _p('ifeq (/bin,$(findstring /bin,$(MAKESHELL)))') \n _p(' SHELLTYPE := posix') \n _p('endif') \n _p('') \n _p('ifeq (posix,$(SHELLTYPE))') \n _p(' MKDIR = $(SILENT) mkdir -p \" $(1) \" ') \n _p(' COPY = $(SILENT) cp -fR \" $(1) \" \" $(2) \" ') \n _p(' RM = $(SILENT) rm -f \" $(1) \" ') \n _p('else') \n _p(' MKDIR = $(SILENT) mkdir \" $(subst /, \\ \\ \\ \\ ,$(1)) \" 2> nul || exit 0') \n _p(' COPY = $(SILENT) copy /Y \" $(s "
" ubst /, \\ \\ \\ \\ ,$(1)) \" \" $(subst /, \\ \\ \\ \\ ,$(2)) \" ') \n _p(' RM = $(SILENT) del /F \" $(subst /, \\ \\ \\ \\ ,$(1)) \" 2> nul || exit 0') \n _p('endif') \n _p('') \n _p('CC = %s', cc.cc) \n _p('CXX = %s', cc.cxx) \n _p('AR = %s', cc.ar) \n _p('') \n _p('ifndef RESCOMP') \n _p(' ifdef WINDRES') \n _p(' RESCOMP = $(WINDRES)') \n _p(' else') \n _p(' RESCOMP = %s', cc.rc or 'windres') \n _p(' endif') \n _p('endif') \n _p('') \n if (not premake.make.makefile_ignore) then \n _p('MAKEFILE = %s', _MAKE.getmakefilename(prj, true)) \n _p('') \n end \n end \n local function is_excluded(prj, cfg, file) \n if table.icontains(prj.excludes, file) then \n return true \n end \n if table.icontains(cfg.excludes, file) then \n return true \n end \n return false \n end \n function premake.gmake_cpp_config(prj, cfg, cc) \n _p('ifeq ($(config),%s)', _MAKE.esc(cfg.shortname)) \n cpp.platformtools(cfg, cc) \n _p(' ' .. (table.contains(premake.make.override, \" OBJDIR \" ) and \" override \" or \" \" ) .. 'OBJDIR = %s', _MAKE.esc(cfg.objectsdir)) \n _p(' ' .. (table.contains(premak "
" e.make.override, \" TARGETDIR \" ) and \" override \" or \" \" ) .. 'TARGETDIR = %s', _MAKE.esc(cfg.buildtarget.directory)) \n _p(' ' .. (table.contains(premake.make.override, \" TARGET \" ) and \" override \" or \" \" ) .. 'TARGET = $(TARGETDIR)/%s', _MAKE.esc(cfg.buildtarget.name)) \n _p(' DEFINES +=%s', make.list(cc.getdefines(cfg.defines))) \n _p(' INCLUDES +=%s', make.list(cc.getincludedirs(cfg.includedirs))) \n _p(' INCLUDES +=%s', make.list(cc.getquoteincludedirs(cfg.userincludedirs))) \n cpp.pchconfig(cfg) \n cpp.flags(cfg, cc) \n cpp.linker(prj, cfg, cc) \n table.sort(cfg.files) \n _p(' OBJECTS := \\ \\ ') \n for _, file in ipairs(cfg.files) do \n if path.issourcefile(file) then \n if not is_excluded(prj, cfg, file) then \n _p(' \\ t$(OBJDIR)/%s.o \\ \\ ' \n , _MAKE.esc(path.trimdots(path.removeext(file))) \n ) \n end \n end \n end \n _p('') \n _p(' define PREBUILDCMDS') \n if #cfg.prebuildcommands > 0 then \n _p(' \\ t@echo Running pre-build commands') \n _p(' \\ t%s', table.implode(cfg.prebuildcommands, \" "
" \" , \" \" , \" \\ n \\ t \" )) \n end \n _p(' endef') \n _p(' define PRELINKCMDS') \n if #cfg.prelinkcommands > 0 then \n _p(' \\ t@echo Running pre-link commands') \n _p(' \\ t%s', table.implode(cfg.prelinkcommands, \" \" , \" \" , \" \\ n \\ t \" )) \n end \n _p(' endef') \n _p(' define POSTBUILDCMDS') \n if #cfg.postbuildcommands > 0 then \n _p(' \\ t@echo Running post-build commands') \n _p(' \\ t%s', table.implode(cfg.postbuildcommands, \" \" , \" \" , \" \\ n \\ t \" )) \n end \n _p(' endef') \n make.settings(cfg, cc) \n _p('endif') \n _p('') \n end \n function cpp.platformtools(cfg, cc) \n local platform = cc.platforms[cfg.platform] \n if platform.cc then \n _p(' CC = %s', platform.cc) \n end \n if platform.cxx then \n _p(' CXX = %s', platform.cxx) \n end \n if platform.ar then \n _p(' AR = %s', platform.ar) \n end \n end \n function cpp.flags(cfg, cc) \n if cfg.pchheader and not cfg.flags.NoPCH then \n _p(' FORCE_INCLUDE += -include $(OBJDIR)/$(notdir $(PCH))') \n _p(' FORCE_INCLUDE_OBJC += -include $(OBJDIR)/$(notdir $(PCH))_objc') \n end \n if #cfg.forcedincludes > 0 t "
" hen \n _p(' FORCE_INCLUDE += -include %s' \n ,_MAKE.esc(table.concat(cfg.forcedincludes, \" ; \" ))) \n end \n _p(' ALL_CPPFLAGS += $(CPPFLAGS) %s $(DEFINES) $(INCLUDES)', table.concat(cc.getcppflags(cfg), \" \" )) \n _p(' ALL_ASMFLAGS += $(ASMFLAGS) $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH)%s', make.list(table.join(cc.getcflags(cfg), cfg.buildoptions, cfg.buildoptions_asm))) \n _p(' ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH)%s', make.list(table.join(cc.getcflags(cfg), cfg.buildoptions, cfg.buildoptions_c))) \n _p(' ALL_CXXFLAGS += $(CXXFLAGS) $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH)%s', make.list(table.join(cc.getcflags(cfg), cc.getcxxflags(cfg), cfg.buildoptions, cfg.buildoptions_cpp))) \n _p(' ALL_OBJCFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH)%s', make.list(table.join(cc.getcflags(cfg), cc.getobjcflags(cfg), cfg.buildoptions, cfg.buildoptions_objc))) \n _p(' ALL_OBJCPPFLAGS += $(CXXFLAGS) $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH)%s', make.list(table.join(cc.getcflags(cfg), cc.getcxxflags(cfg), cc.geto "
" bjcflags(cfg), cfg.buildoptions, cfg.buildoptions_objcpp))) \n _p(' ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)%s', \n make.list(table.join(cc.getdefines(cfg.resdefines), \n cc.getincludedirs(cfg.resincludedirs), cfg.resoptions))) \n end \n function cpp.linker(prj, cfg, cc) \n _p(' ALL_LDFLAGS += $(LDFLAGS)%s', make.list(table.join(cc.getlibdirflags(cfg), cc.getldflags(cfg), cfg.linkoptions))) \n _p(' LDDEPS +=%s', make.list(_MAKE.esc(premake.getlinks(cfg, \" siblings \" , \" fullpath \" )))) \n _p(' LIBS += $(LDDEPS)%s', make.list(cc.getlinkflags(cfg))) \n _p(' EXTERNAL_LIBS +=%s', make.list(cc.getlibfiles(cfg))) \n if cfg.kind == \" StaticLib \" then \n if (not prj.options.ArchiveSplit) then \n _p(' LINKCMD = $(AR) %s $(TARGET)', make.list(cc.getarchiveflags(prj, cfg, false))) \n else \n _p(' LINKCMD = $(AR) %s $(TARGET)', make.list(cc.getarchiveflags(prj, cfg, false))) \n _p(' LINKCMD_NDX = $(AR) %s $(TARGET)', make "
" .list(cc.getarchiveflags(prj, cfg, true))) \n end \n else \n local tool = iif(cfg.language == \" C \" , \" CC \" , \" CXX \" ) \n _p(' LINKCMD = $(%s) -o $(TARGET) $(OBJECTS) $(RESOURCES) $(ARCH) $(ALL_LDFLAGS) $(LIBS)', tool) \n end \n end \n function cpp.pchconfig(cfg) \n if not cfg.pchheader or cfg.flags.NoPCH then \n return \n end \n local pch = cfg.pchheader \n for _, incdir in ipairs(cfg.includedirs) do \n local abspath = path.getabsolute(path.join(cfg.project.location, incdir)) \n local testname = path.join(abspath, pch) \n if os.isfile(testname) then \n pch = path.getrelative(cfg.location, testname) \n break \n end \n end \n _p(' PCH = %s', _MAKE.esc(pch)) \n _p(' GCH = $(OBJDIR)/$(notdir $(PCH)).gch') \n _p(' GCH_OBJC = $(OBJDIR)/$(notdir $(PCH))_objc.gch') \n end \n function cpp.pchrules(prj) \n _p('ifneq (,$(PCH))') \n _p('$(GCH): $(PCH) $(MAKEFILE) | $(OBJDIR)') \n if prj.msgprecompile then \n _p(' \\ t@echo ' .. prj.msgprecompile) \n else \n _p(' \\ t@echo $(notdir $<)') \n end \n local cmd = iif(prj.language == \" "
" C \" , \" $(CC) $(ALL_CFLAGS) -x c-header \" , \" $(CXX) $(ALL_CXXFLAGS) -x c++-header \" ) \n _p(' \\ t$(SILENT) %s $(DEFINES) $(INCLUDES) -o \" $@ \" -c \" $< \" ', cmd) \n _p('') \n _p('$(GCH_OBJC): $(PCH) $(MAKEFILE) | $(OBJDIR)') \n if prj.msgprecompile then \n _p(' \\ t@echo ' .. prj.msgprecompile) \n else \n _p(' \\ t@echo $(notdir $<)') \n end \n local cmd = iif(prj.language == \" C \" , \" $(CC) $(ALL_OBJCFLAGS) -x objective-c-header \" , \" $(CXX) $(ALL_OBJCPPFLAGS) -x objective-c++-header \" ) \n _p(' \\ t$(SILENT) %s $(DEFINES) $(INCLUDES) -o \" $@ \" -c \" $< \" ', cmd) \n _p('endif') \n _p('') \n end \n function cpp.fileRules(prj, cc) \n local platforms = premake.filterplatforms(prj.solution, cc.platforms, \" Native \" ) \n table.sort(prj.allfiles) \n for _, file in ipairs(prj.allfiles or {}) do \n if path.issourcefile(file) then \n if (path.isobjcfile(file)) then \n _p('$(OBJDIR)/%s.o: %s $(GCH_OBJC) $(MAKEFILE)' \n , _MAKE.esc(path.trimdots(path.removeext(file))) \n , _MAKE.esc(file) \n ) \n else \n _p('$(OBJDIR)/%s.o: %s $(GCH) $(MAKEFILE)' \n , _MAKE.esc(path.trimdots(path.removee "
" xt(file))) \n , _MAKE.esc(file) \n ) \n end \n if (path.isobjcfile(file) and prj.msgcompile_objc) then \n _p(' \\ t@echo ' .. prj.msgcompile_objc) \n elseif prj.msgcompile then \n _p(' \\ t@echo ' .. prj.msgcompile) \n else \n _p(' \\ t@echo $(notdir $<)') \n end \n if (path.isobjcfile(file)) then \n if (path.iscfile(file)) then \n _p(' \\ t$(SILENT) $(CXX) $(ALL_OBJCFLAGS) $(FORCE_INCLUDE_OBJC) -o \" $@ \" -c \" $< \" ') \n else \n _p(' \\ t$(SILENT) $(CXX) $(ALL_OBJCPPFLAGS) $(FORCE_INCLUDE_OBJC) -o \" $@ \" -c \" $< \" ') \n end \n elseif (path.isasmfile(file)) then \n _p(' \\ t$(SILENT) $(CC) $(ALL_ASMFLAGS) -o \" $@ \" -c \" $< \" ') \n else \n cpp.buildcommand(path.iscfile(file) and not prj.options.ForceCPP, \" o \" ) \n end \n for _, task in ipairs(prj.postcompiletasks or {}) do \n _p(' \\ t$(SILENT) %s', task) \n _p('') \n end \n _p('') \n elseif (path.getextension(file) == \" .rc \" ) then \n _p('$(OBJDIR)/%s.res: %s', _MAKE.esc(path.getbasename(file)), _MAKE.esc(file)) \n if prj.msgresource then \n _p(' \\ t@echo ' .. prj.msgresource) \n else \n _p(' \\ t@echo $(notdir $<)') \n end \n _p(' \\ t$(SILENT) $(R "
" ESCOMP) $< -O coff -o \" $@ \" $(ALL_RESFLAGS)') \n _p('') \n end \n end \n end \n function cpp.dependencyRules(prj) \n for _, dependency in ipairs(prj.dependency or {}) do \n for _, dep in ipairs(dependency or {}) do \n if (dep[3]==nil or dep[3]==false) then \n _p('$(OBJDIR)/%s.o: %s' \n , _MAKE.esc(path.trimdots(path.removeext(path.getrelative(prj.location, dep[1])))) \n , _MAKE.esc(path.getrelative(prj.location, dep[2])) \n ) \n else \n _p('%s: %s' \n , _MAKE.esc(dep[1]) \n , _MAKE.esc(path.getrelative(prj.location, dep[2])) \n ) \n end \n _p('') \n end \n end \n end \n function cpp.buildcommand(iscfile, objext) \n local flags = iif(iscfile, '$(CC) $(ALL_CFLAGS)', '$(CXX) $(ALL_CXXFLAGS)') \n _p(' \\ t$(SILENT) %s $(FORCE_INCLUDE) -o \" $@ \" -c \" $< \" ', flags, objext) \n end \n " ,
" -- -- \n premake.make.cpp = { } \n premake.make.override = { } \n premake.make.makefile_ignore = false \n local cpp = premake.make.cpp \n local make = premake.make \n function premake.make_cpp(prj) \n local cc = premake.gettool(prj) \n local platforms = premake.filterplatforms(prj.solution, cc.platforms, \" Native \" ) \n local action = premake.action.current() \n premake.gmake_cpp_header(prj, cc, platforms) \n premake.gmake_cpp_configs(prj, cc, platforms) \n table.sort(prj.allfiles) \n local objdirs = {} \n local additionalobjdirs = {} \n for _, file in ipairs(prj.allfiles) do \n if path.issourcefile(file) then \n objdirs[_MAKE.esc(path.getdirectory(path.trimdots(file)))] = 1 \n end \n end \n for _, custombuildtask in ipairs(prj.custombuildtask or {}) do \n for _, buildtask in ipairs(custombuildtask or {}) do \n additionalobjdirs[_MAKE.esc(path.getdirectory(path.getrelative(prj.location,buildtask[2])))] = 1 \n end \n end \n _p('OBJDIRS := \\ \\ ') \n _p(' \\ t$(OBJDIR) \\ \\ ') \n for dir, _ in iter.sortByKeys(objdirs) do \n _p(' \\ t$(OBJDIR)/%s \\ \\ ', dir) \n end \n for dir, _ "
" in iter.sortByKeys(additionalobjdirs) do \n _p(' \\ t%s \\ \\ ', dir) \n end \n _p('') \n _p('RESOURCES := \\ \\ ') \n for _, file in ipairs(prj.allfiles) do \n if path.isresourcefile(file) then \n _p(' \\ t$(OBJDIR)/%s.res \\ \\ ', _MAKE.esc(path.getbasename(file))) \n end \n end \n _p('') \n _p('.PHONY: clean prebuild prelink') \n _p('') \n if os.is( \" MacOSX \" ) and prj.kind == \" WindowedApp \" and not prj.options.SkipBundling then \n _p('all: $(OBJDIRS) $(TARGETDIR) prebuild prelink $(TARGET) $(dir $(TARGETDIR))PkgInfo $(dir $(TARGETDIR))Info.plist') \n else \n _p('all: $(OBJDIRS) $(TARGETDIR) prebuild prelink $(TARGET)') \n end \n _p(' \\ t@:') \n _p('') \n if (prj.kind == \" StaticLib \" and prj.options.ArchiveSplit) then \n _p('define max_args') \n _p(' \\ t$(eval _args:=)') \n _p(' \\ t$(foreach obj,$3,$(eval _args+=$(obj))$(if $(word $2,$(_args)),$1$(_args)$(EOL)$(eval _args:=)))') \n _p(' \\ t$(if $(_args),$1$(_args))') \n _p('endef') \n _p('') \n _p('define EOL') \n _p('') \n _p('') \n _p('endef') \n _p('') \n end \n _p('$(TARGET): $(GCH) $(OBJECTS) $(LIBDEPS) $(EXTERNAL_LIBS) $(RESOUR "
" CES) $(OBJRESP) $(LDRESP) | $(TARGETDIR) $(OBJDIRS)') \n if prj.kind == \" StaticLib \" then \n if prj.msgarchiving then \n _p(' \\ t@echo ' .. prj.msgarchiving) \n else \n _p(' \\ t@echo Archiving %s', prj.name) \n end \n if (not prj.archivesplit_size) then \n prj.archivesplit_size=200 \n end \n if (not prj.options.ArchiveSplit) then \n _p('ifeq (posix,$(SHELLTYPE))') \n _p(' \\ t$(SILENT) rm -f $(TARGET)') \n _p('else') \n _p(' \\ t$(SILENT) if exist $(subst /, \\ \\ \\ \\ ,$(TARGET)) del $(subst /, \\ \\ \\ \\ ,$(TARGET))') \n _p('endif') \n _p(' \\ t$(SILENT) $(LINKCMD) $(LINKOBJS)' .. (os.is( \" MacOSX \" ) and \" 2>&1 > /dev/null | sed -e '/.o) has no symbols$$/d' \" or \" \" )) \n else \n _p(' \\ t$(call RM,$(TARGET))') \n _p(' \\ t@$(call max_args,$(LINKCMD),'.. prj.archivesplit_size ..',$(LINKOBJS))' .. (os.is( \" MacOSX \" ) and \" 2>&1 > /dev/null | sed -e '/.o) has no symbols$$/d' \" or \" \" )) \n _p(' \\ t$(SILENT) $(LINKCMD_NDX)') \n end \n else \n if prj.msglinking then \n _p(' \\ t@echo ' .. prj.msglinking) \n else \n _p(' \\ t@echo Linking %s', prj.name) \n end \n _p(' \\ t$(SILENT) $(LINKCMD) "
" ') \n end \n _p(' \\ t$(POSTBUILDCMDS)') \n _p('') \n _p('$(TARGETDIR):') \n premake.make_mkdirrule( \" $(TARGETDIR) \" ) \n _p('$(OBJDIRS):') \n if (not prj.solution.messageskip) or (not table.contains(prj.solution.messageskip, \" SkipCreatingMessage \" )) then \n _p(' \\ t@echo Creating $(@)') \n end \n _p(' \\ t-$(call MKDIR,$@)') \n _p('') \n if os.is( \" MacOSX \" ) and prj.kind == \" WindowedApp \" and not prj.options.SkipBundling then \n _p('$(dir $(TARGETDIR))PkgInfo:') \n _p('$(dir $(TARGETDIR))Info.plist:') \n _p('') \n end \n _p('clean:') \n if (not prj.solution.messageskip) or (not table.contains(prj.solution.messageskip, \" SkipCleaningMessage \" )) then \n _p(' \\ t@echo Cleaning %s', prj.name) \n end \n _p('ifeq (posix,$(SHELLTYPE))') \n _p(' \\ t$(SILENT) rm -f $(TARGET)') \n _p(' \\ t$(SILENT) rm -rf $(OBJDIR)') \n _p('else') \n _p(' \\ t$(SILENT) if exist $(subst /, \\ \\ \\ \\ ,$(TARGET)) del $(subst /, \\ \\ \\ \\ ,$(TARGET))') \n _p(' \\ t$(SILENT) if exist $(subst /, \\ \\ \\ \\ ,$(OBJDIR)) rmdir /s /q $(subst /, \\ \\ \\ \\ ,$(OBJDIR))') \n _p('endif') \n _p('') \n _p('prebuild:') \n _p(' \\ t$(PRE "
" BUILDCMDS)') \n _p('') \n _p('prelink:') \n _p(' \\ t$(PRELINKCMDS)') \n _p('') \n cpp.pchrules(prj) \n cpp.fileRules(prj, cc) \n cpp.dependencyRules(prj) \n for _, custombuildtask in ipairs(prj.custombuildtask or {}) do \n for _, buildtask in ipairs(custombuildtask or {}) do \n local deps = string.format( \" %s \" ,path.getrelative(prj.location,buildtask[1])) \n for _, depdata in ipairs(buildtask[3] or {}) do \n deps = deps .. string.format( \" %s \" ,path.getrelative(prj.location,depdata)) \n end \n _p('%s: %s | $(TARGETDIR) $(OBJDIRS)' \n ,path.getrelative(prj.location,buildtask[2]) \n , deps \n ) \n for _, cmdline in ipairs(buildtask[4] or {}) do \n local cmd = cmdline \n local num = 1 \n for _, depdata in ipairs(buildtask[3] or {}) do \n cmd = string.gsub(cmd, \" %$%( \" .. num .. \" %) \" , string.format( \" %s \" ,path.getrelative(prj.location,depdata))) \n num = num + 1 \n end \n cmd = string.gsub(cmd, \" %$%(<%) \" , \" $< \" ) \n cmd = string.gsub(cmd, \" %$%(@%) \" , \" $@ \" ) \n _p(' \\ t$(SILENT) %s',cmd) \n end \n _p('') \n end \n end \n _p('-include $(OBJECTS:%%.o=%%.d)') \n _p('ifneq (,$( "
" PCH))') \n _p(' -include $(OBJDIR)/$(notdir $(PCH)).d') \n _p(' -include $(OBJDIR)/$(notdir $(PCH))_objc.d') \n _p('endif') \n end \n function premake.gmake_cpp_header(prj, cc, platforms) \n _p('# %s project makefile autogenerated by GENie', premake.action.current().shortname) \n _p('ifndef config') \n _p(' config=%s', _MAKE.esc(premake.getconfigname(prj.solution.configurations[1], platforms[1], true))) \n _p('endif') \n _p('') \n _p('ifndef verbose') \n _p(' SILENT = @') \n _p('endif') \n _p('') \n _p('SHELLTYPE := msdos') \n _p('ifeq (,$(ComSpec)$(COMSPEC))') \n _p(' SHELLTYPE := posix') \n _p('endif') \n _p('ifeq (/bin,$(findstring /bin,$(SHELL)))') \n _p(' SHELLTYPE := posix') \n _p('endif') \n _p('ifeq (/bin,$(findstring /bin,$(MAKESHELL)))') \n _p(' SHELLTYPE := posix') \n _p('endif') \n _p('') \n _p('ifeq (posix,$(SHELLTYPE))') \n _p(' MKDIR = $(SILENT) mkdir -p \" $(1) \" ') \n _p(' COPY = $(SILENT) cp -fR \" $(1) \" \" $(2) \" ') \n _p(' RM = $(SILENT) rm -f \" $(1) \" ') \n _p('else') \n _p(' MKDIR = $(SILENT) mkdir \" $(subst /, \\ \\ \\ \\ ,$(1)) \" 2> nul || ex "
" it 0') \n _p(' COPY = $(SILENT) copy /Y \" $(subst /, \\ \\ \\ \\ ,$(1)) \" \" $(subst /, \\ \\ \\ \\ ,$(2)) \" ') \n _p(' RM = $(SILENT) del /F \" $(subst /, \\ \\ \\ \\ ,$(1)) \" 2> nul || exit 0') \n _p('endif') \n _p('') \n _p('CC = %s', cc.cc) \n _p('CXX = %s', cc.cxx) \n _p('AR = %s', cc.ar) \n _p('') \n _p('ifndef RESCOMP') \n _p(' ifdef WINDRES') \n _p(' RESCOMP = $(WINDRES)') \n _p(' else') \n _p(' RESCOMP = %s', cc.rc or 'windres') \n _p(' endif') \n _p('endif') \n _p('') \n if (not premake.make.makefile_ignore) then \n _p('MAKEFILE = %s', _MAKE.getmakefilename(prj, true)) \n _p('') \n end \n end \n local function is_excluded(prj, cfg, file) \n if table.icontains(prj.excludes, file) then \n return true \n end \n if table.icontains(cfg.excludes, file) then \n return true \n end \n return false \n end \n function premake.gmake_cpp_configs(prj, cc, platforms) \n for _, platform in ipairs(platforms) do \n for cfg in premake.eachconfig(prj, platform) do \n premake.gmake_cpp_config(prj, cfg, cc) \n end \n end \n end \n function premake.gmake_cpp_config(prj, cfg, cc) \n _p('ifeq ($(config "
" ),%s)', _MAKE.esc(cfg.shortname)) \n cpp.platformtools(cfg, cc) \n local targetDir = _MAKE.esc(cfg.buildtarget.directory) \n _p(' ' .. (table.contains(premake.make.override, \" OBJDIR \" ) and \" override \" or \" \" ) .. 'OBJDIR = %s', _MAKE.esc(cfg.objectsdir)) \n _p(' ' .. (table.contains(premake.make.override, \" TARGETDIR \" ) and \" override \" or \" \" ) .. 'TARGETDIR = %s', iif(targetDir == \" \" , \" . \" , targetDir)) \n _p(' ' .. (table.contains(premake.make.override, \" TARGET \" ) and \" override \" or \" \" ) .. 'TARGET = $(TARGETDIR)/%s', _MAKE.esc(cfg.buildtarget.name)) \n _p(' DEFINES +=%s', make.list(_MAKE.escquote(cc.getdefines(cfg.defines)))) \n local id = make.list(cc.getincludedirs(cfg.includedirs)); \n local uid = make.list(cc.getquoteincludedirs(cfg.userincludedirs)) \n local sid = make.list(cc.getsystemincludedirs(cfg.systemincludedirs)) \n if id ~= \" \" then \n _p(' INCLUDES +=%s', id) \n end \n if uid ~= \" \" then \n _p(' INCLUDES +=%s', uid) \n end \n if sid ~= "
" \" \" then \n _p(' INCLUDES +=%s', sid) \n end \n cpp.pchconfig(cfg) \n cpp.flags(cfg, cc) \n cpp.linker(prj, cfg, cc) \n table.sort(cfg.files) \n if cfg.flags.UseObjectResponseFile then \n _p(' OBJRESP = $(OBJDIR)/%s_objects', prj.name) \n else \n _p(' OBJRESP =') \n end \n _p(' OBJECTS := \\ \\ ') \n for _, file in ipairs(cfg.files) do \n if path.issourcefile(file) then \n if not is_excluded(prj, cfg, file) then \n _p(' \\ t$(OBJDIR)/%s.o \\ \\ ' \n , _MAKE.esc(path.trimdots(path.removeext(file))) \n ) \n end \n end \n end \n _p('') \n _p(' define PREBUILDCMDS') \n if #cfg.prebuildcommands > 0 then \n _p(' \\ t@echo Running pre-build commands') \n _p(' \\ t%s', table.implode(cfg.prebuildcommands, \" \" , \" \" , \" \\ n \\ t \" )) \n end \n _p(' endef') \n _p(' define PRELINKCMDS') \n if #cfg.prelinkcommands > 0 then \n _p(' \\ t@echo Running pre-link commands') \n _p(' \\ t%s', table.implode(cfg.prelinkcommands, \" \" , \" \" , \" \\ n \\ t \" )) \n end \n _p(' endef') \n _p(' define POSTBUILDCMDS') \n if #cfg.postbuildcommands > 0 then \n _p(' \\ t@echo Running post-build "
" commands') \n _p(' \\ t%s', table.implode(cfg.postbuildcommands, \" \" , \" \" , \" \\ n \\ t \" )) \n end \n _p(' endef') \n make.settings(cfg, cc) \n _p('endif') \n _p('') \n end \n function cpp.platformtools(cfg, cc) \n local platform = cc.platforms[cfg.platform] \n if platform.cc then \n _p(' CC = %s', platform.cc) \n end \n if platform.cxx then \n _p(' CXX = %s', platform.cxx) \n end \n if platform.ar then \n _p(' AR = %s', platform.ar) \n end \n end \n function cpp.flags(cfg, cc) \n if cfg.pchheader and not cfg.flags.NoPCH then \n _p(' FORCE_INCLUDE += -include $(OBJDIR)/$(notdir $(PCH))') \n _p(' FORCE_INCLUDE_OBJC += -include $(OBJDIR)/$(notdir $(PCH))_objc') \n end \n if #cfg.forcedincludes > 0 then \n _p(' FORCE_INCLUDE += -include %s' \n ,_MAKE.esc(table.concat(cfg.forcedincludes, \" ; \" ))) \n end \n _p(' ALL_CPPFLAGS += $(CPPFLAGS) %s $(DEFINES) $(INCLUDES)', table.concat(cc.getcppflags(cfg), \" \" )) \n _p(' ALL_ASMFLAGS += $(ASMFLAGS) $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH)%s', make.list(table.join(cc.getcflags(cfg), cfg "
" .buildoptions, cfg.buildoptions_asm))) \n _p(' ALL_CFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH)%s', make.list(table.join(cc.getcflags(cfg), cfg.buildoptions, cfg.buildoptions_c))) \n _p(' ALL_CXXFLAGS += $(CXXFLAGS) $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH)%s', make.list(table.join(cc.getcflags(cfg), cc.getcxxflags(cfg), cfg.buildoptions, cfg.buildoptions_cpp))) \n _p(' ALL_OBJCFLAGS += $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH)%s', make.list(table.join(cc.getcflags(cfg), cc.getobjcflags(cfg), cfg.buildoptions, cfg.buildoptions_objc))) \n _p(' ALL_OBJCPPFLAGS += $(CXXFLAGS) $(CFLAGS) $(ALL_CPPFLAGS) $(ARCH)%s', make.list(table.join(cc.getcflags(cfg), cc.getcxxflags(cfg), cc.getobjcflags(cfg), cfg.buildoptions, cfg.buildoptions_objcpp))) \n _p(' ALL_RESFLAGS += $(RESFLAGS) $(DEFINES) $(INCLUDES)%s', \n make.list(table.join(cc.getdefines(cfg.resdefines), \n cc.getincludedirs(cfg.resincludedirs), cfg.resoptions))) \n end \n function cpp.linker(prj, cfg, cc) \n local libdeps \n loc "
" al lddeps \n if #cfg.wholearchive > 0 then \n libdeps = {} \n lddeps = {} \n for _, linkcfg in ipairs(premake.getlinks(cfg, \" siblings \" , \" object \" )) do \n local linkpath = path.rebase(linkcfg.linktarget.fullpath, linkcfg.location, cfg.location) \n if table.icontains(cfg.wholearchive, linkcfg.project.name) then \n lddeps = table.join(lddeps, cc.wholearchive(linkpath)) \n else \n table.insert(lddeps, linkpath) \n end \n table.insert(libdeps, linkpath) \n end \n libdeps = make.list(_MAKE.esc(libdeps)) \n lddeps = make.list(_MAKE.esc(lddeps)) \n else \n libdeps = make.list(_MAKE.esc(premake.getlinks(cfg, \" siblings \" , \" fullpath \" ))) \n lddeps = libdeps \n end \n _p(' ALL_LDFLAGS += $(LDFLAGS)%s', make.list(table.join(cc.getlibdirflags(cfg), cc.getldflags(cfg), cfg.linkoptions))) \n _p(' LIBDEPS +=%s', libdeps) \n _p(' LDDEPS +=%s', lddeps) \n if cfg.flags.UseLDResponseFile then \n _p(' LDRESP = $(OBJDIR)/%s_libs', prj.name) \n _p(' LIBS += @$(LDRESP)%s', make.list(cc.getlinkflags(cfg))) \n else \n "
" _p(' LDRESP =') \n _p(' LIBS += $(LDDEPS)%s', make.list(cc.getlinkflags(cfg))) \n end \n _p(' EXTERNAL_LIBS +=%s', make.list(cc.getlibfiles(cfg))) \n _p(' LINKOBJS = %s', (cfg.flags.UseObjectResponseFile and \" @$(OBJRESP) \" or \" $(OBJECTS) \" )) \n if cfg.kind == \" StaticLib \" then \n if (not prj.options.ArchiveSplit) then \n _p(' LINKCMD = $(AR) %s $(TARGET)', make.list(cc.getarchiveflags(prj, cfg, false))) \n else \n _p(' LINKCMD = $(AR) %s $(TARGET)', make.list(cc.getarchiveflags(prj, cfg, false))) \n _p(' LINKCMD_NDX = $(AR) %s $(TARGET)', make.list(cc.getarchiveflags(prj, cfg, true))) \n end \n else \n local tool = iif(cfg.language == \" C \" , \" CC \" , \" CXX \" ) \n local startgroup = '' \n local endgroup = '' \n if (cfg.flags.LinkSupportCircularDependencies) then \n startgroup = '-Wl,--start-group ' \n endgroup = ' -Wl,--end-group' \n end \n _p(' LINKCMD = $(%s) -o $(TARGET) $(LINKOBJS) $(RESOURCES) $(ARCH) $(ALL_LDFLAGS) %s$(LIBS)%s', tool, startgroup, e "
" ndgroup) \n end \n end \n function cpp.pchconfig(cfg) \n if not cfg.pchheader or cfg.flags.NoPCH then \n return \n end \n local pch = cfg.pchheader \n for _, incdir in ipairs(cfg.includedirs) do \n local abspath = path.getabsolute(path.join(cfg.project.location, incdir)) \n local testname = path.join(abspath, pch) \n if os.isfile(testname) then \n pch = path.getrelative(cfg.location, testname) \n break \n end \n end \n _p(' PCH = %s', _MAKE.esc(pch)) \n _p(' GCH = $(OBJDIR)/$(notdir $(PCH)).gch') \n _p(' GCH_OBJC = $(OBJDIR)/$(notdir $(PCH))_objc.gch') \n end \n function cpp.pchrules(prj) \n _p('ifneq (,$(PCH))') \n _p('$(GCH): $(PCH) $(MAKEFILE) | $(OBJDIR)') \n if prj.msgprecompile then \n _p(' \\ t@echo ' .. prj.msgprecompile) \n else \n _p(' \\ t@echo $(notdir $<)') \n end \n local cmd = iif(prj.language == \" C \" , \" $(CC) $(ALL_CFLAGS) -x c-header \" , \" $(CXX) $(ALL_CXXFLAGS) -x c++-header \" ) \n _p(' \\ t$(SILENT) %s $(DEFINES) $(INCLUDES) -o \" $@ \" -c \" $< \" ', cmd) \n _p('') \n _p('$(GCH_OBJC): $(PCH) $(MAKEFILE) | $(OBJDIR)') "
" \n if prj.msgprecompile then \n _p(' \\ t@echo ' .. prj.msgprecompile) \n else \n _p(' \\ t@echo $(notdir $<)') \n end \n local cmd = iif(prj.language == \" C \" , \" $(CC) $(ALL_OBJCFLAGS) -x objective-c-header \" , \" $(CXX) $(ALL_OBJCPPFLAGS) -x objective-c++-header \" ) \n _p(' \\ t$(SILENT) %s $(DEFINES) $(INCLUDES) -o \" $@ \" -c \" $< \" ', cmd) \n _p('endif') \n _p('') \n end \n function cpp.fileRules(prj, cc) \n local platforms = premake.filterplatforms(prj.solution, cc.platforms, \" Native \" ) \n _p('ifneq (,$(OBJRESP))') \n _p('$(OBJRESP): $(OBJECTS) | $(TARGETDIR) $(OBJDIRS)') \n _p(' \\ t$(SILENT) echo $^') \n _p(' \\ t$(SILENT) echo $^ > $@') \n _p('endif') \n _p('') \n _p('ifneq (,$(LDRESP))') \n _p('$(LDRESP): $(LDDEPS) | $(TARGETDIR) $(OBJDIRS)') \n _p(' \\ t$(SILENT) echo $^') \n _p(' \\ t$(SILENT) echo $^ > $@') \n _p('endif') \n _p('') \n table.sort(prj.allfiles) \n for _, file in ipairs(prj.allfiles or {}) do \n if path.issourcefile(file) then \n if (path.isobjcfile(file)) then \n _p('$(OBJDIR)/%s.o: %s $(GCH_OBJC) $(MAKEFILE) | $(OBJDIR)/%s' \n , _MAKE.esc(path.trimdots(path. "
" removeext(file))) \n , _MAKE.esc(file) \n , _MAKE.esc(path.getdirectory(path.trimdots(file))) \n ) \n else \n _p('$(OBJDIR)/%s.o: %s $(GCH) $(MAKEFILE) | $(OBJDIR)/%s' \n , _MAKE.esc(path.trimdots(path.removeext(file))) \n , _MAKE.esc(file) \n , _MAKE.esc(path.getdirectory(path.trimdots(file))) \n ) \n end \n if (path.isobjcfile(file) and prj.msgcompile_objc) then \n _p(' \\ t@echo ' .. prj.msgcompile_objc) \n elseif prj.msgcompile then \n _p(' \\ t@echo ' .. prj.msgcompile) \n else \n _p(' \\ t@echo $(notdir $<)') \n end \n if (path.isobjcfile(file)) then \n if (path.iscfile(file)) then \n _p(' \\ t$(SILENT) $(CXX) $(ALL_OBJCFLAGS) $(FORCE_INCLUDE_OBJC) -o \" $@ \" -c \" $< \" ') \n else \n _p(' \\ t$(SILENT) $(CXX) $(ALL_OBJCPPFLAGS) $(FORCE_INCLUDE_OBJC) -o \" $@ \" -c \" $< \" ') \n end \n elseif (path.isasmfile(file)) then \n _p(' \\ t$(SILENT) $(CC) $(ALL_ASMFLAGS) -o \" $@ \" -c \" $< \" ') \n else \n cpp.buildcommand(path.iscfile(file) and not prj.options.ForceCPP, \" o \" ) \n end \n for _, task in ipairs(prj.postcompiletasks or {}) do \n _p(' \\ t$(SILENT) %s', task) \n _p('') \n end \n _p('') \n e "
" lseif (path.getextension(file) == \" .rc \" ) then \n _p('$(OBJDIR)/%s.res: %s', _MAKE.esc(path.getbasename(file)), _MAKE.esc(file)) \n if prj.msgresource then \n _p(' \\ t@echo ' .. prj.msgresource) \n else \n _p(' \\ t@echo $(notdir $<)') \n end \n _p(' \\ t$(SILENT) $(RESCOMP) $< -O coff -o \" $@ \" $(ALL_RESFLAGS)') \n _p('') \n end \n end \n end \n function cpp.dependencyRules(prj) \n for _, dependency in ipairs(prj.dependency or {}) do \n for _, dep in ipairs(dependency or {}) do \n if (dep[3]==nil or dep[3]==false) then \n _p('$(OBJDIR)/%s.o: %s' \n , _MAKE.esc(path.trimdots(path.removeext(path.getrelative(prj.location, dep[1])))) \n , _MAKE.esc(path.getrelative(prj.location, dep[2])) \n ) \n else \n _p('%s: %s' \n , _MAKE.esc(dep[1]) \n , _MAKE.esc(path.getrelative(prj.location, dep[2])) \n ) \n end \n _p('') \n end \n end \n end \n function cpp.buildcommand(iscfile, objext) \n local flags = iif(iscfile, '$(CC) $(ALL_CFLAGS)', '$(CXX) $(ALL_CXXFLAGS)') \n _p(' \\ t$(SILENT) %s $(FORCE_INCLUDE) -o \" $@ \" -c \" $< \" ', flags, objext) \n end \n " ,
/* actions/make/make_csharp.lua */
" local function getresourcefilename(cfg, fname) \n if path.getextension(fname) == \" .resx \" then \n local name = cfg.buildtarget.basename .. \" . \" \n local dir = path.getdirectory(fname)\n if dir ~= \" . \" then \n name = name .. path.translate(dir, \" . \" ) .. \" . \" \n end \n return \" $(OBJDIR)/ \" .. _MAKE.esc(name .. path.getbasename(fname)) .. \" .resources \" \n else \n return fname \n end \n end \n function premake.make_csharp(prj) \n local csc = premake.dotnet \n local cfglibs = { } \n local cfgpairs = { } \n local anycfg \n for cfg in premake.eachconfig(prj) do \n anycfg = cfg \n cfglibs[cfg] = premake.getlinks(cfg, \" siblings \" , \" fullpath \" ) \n cfgpairs[cfg] = { } \n for _, fname in ipairs(cfglibs[cfg]) do \n if path.getdirectory(fname) ~= cfg.buildtarget.directory then \n cfgpairs[cfg][ \" $(TARGETDIR)/ \" .. _MAKE.esc(path.getname(fname))] = _MAKE.esc(fname) \n end \n end \n end \n local sources = {} \n local embedded = { } \n local copypairs = { } \n for fcfg in premake.project.eachfile(prj) do \n local action = csc.getbuildaction(fcfg) \n if action == \" Co "
" mpile \" then \n table.insert(sources, fcfg.name) \n elseif action == \" EmbeddedResource \" then \n table.insert(embedded, fcfg.name) \n elseif action == \" Content \" then \n copypairs[ \" $(TARGETDIR)/ \" .. _MAKE.esc(path.getname(fcfg.name))] = _MAKE.esc(fcfg.name) \n elseif path.getname(fcfg.name):lower() == \" app.config \" then \n copypairs[ \" $(TARGET).config \" ] = _MAKE.esc(fcfg.name) \n end \n end \n local paths = table.translate(prj.libdirs, function(v) return path.join(prj.basedir, v) end) \n paths = table.join({prj.basedir}, paths) \n for _, libname in ipairs(premake.getlinks(prj, \" system \" , \" fullpath \" )) do \n local libdir = os.pathsearch(libname.. \" .dll \" , unpack(paths)) \n if (libdir) then \n local target = \" $(TARGETDIR)/ \" .. _MAKE.esc(path.getname(libname)) \n local source = path.getrelative(prj.basedir, path.join(libdir, libname)).. \" .dll \" \n copypairs[target] = _MAKE.esc(source) \n end \n end \n _p('# %s project makefile autogenerated by GENie', premake.action.current().shortname) \n _p('') \n _p('ifndef config') \n _p(' config=%s', _MAKE.esc "
" (prj.configu rations[1]:lower()))\n _p('endif') \n _p('') \n _p('ifndef verbose') \n _p(' SILENT = @') \n _p('endif') \n _p('') \n _p('SHELLTYPE := msdos') \n _p('ifeq (,$(ComSpec)$(COMSPEC))') \n _p(' SHELLTYPE := posix') \n _p('endif') \n _p('ifeq (/bin,$(findstring /bin,$(SHELL)))') \n _p(' SHELLTYPE := posix') \n _p('endif') \n _p('ifeq (/bin,$(findstring /bin,$(MAKESHELL)))') \n _p(' SHELLTYPE := posix') \n _p('endif') \n _p('') \n _p('ifeq (posix,$(SHELLTYPE))') \n _p(' MKDIR = $(SILENT) mkdir -p \" $(1) \" ') \n _p(' COPY = $(SILENT) cp -fR \" $(1) \" \" $(2) \" ') \n _p('else') \n _p(' MKDIR = $(SILENT) mkdir \" $(subst /, \\ \\ \\ \\ ,$(1)) \" 2> nul') \n _p(' COPY = $(SILENT) copy /Y \" $(subst /, \\ \\ \\ \\ ,$(1)) \" \" $(subst /, \\ \\ \\ \\ ,$(2)) \" ') \n _p('endif') \n _p('') \n _p('ifndef CSC') \n _p(' CSC=%s', csc.getcompilervar(prj)) \n _p('endif') \n _p('') \n _p('ifndef RESGEN') \n _p(' RESGEN=resgen') \n _p('endif') \n _p('') \n local platforms = premake.filterplatforms(prj.solution, premake[_OPTIONS.cc].platforms) \n table.insert(platforms, 1, \" \" ) \n for cfg in premake.each "
" config(prj) do\n premake.gmake_cs_config(cfg, csc, cfglibs) \n end \n _p('# To maintain compatibility with VS.NET, these values must be set at the project level') \n _p('TARGET := $(TARGETDIR)/%s', _MAKE.esc(prj.buildtarget.name)) \n _p('FLAGS += /t:%s %s', csc.getkind(prj):lower(), table.implode(_MAKE.esc(prj.libdirs), \" /lib: \" , \" \" , \" \" )) \n _p('REFERENCES += %s', table.implode(_MAKE.esc(premake.getlinks(prj, \" system \" , \" basename \" )), \" /r: \" , \" .dll \" , \" \" )) \n _p('') \n _p('SOURCES := \\ \\ ') \n for _, fname in ipairs(sources) do \n _p(' \\ t%s \\ \\ ', _MAKE.esc(path.translate(fname))) \n end \n _p('') \n _p('EMBEDFILES := \\ \\ ') \n for _, fname in ipairs(embedded) do \n _p(' \\ t%s \\ \\ ', getresourcefilename(prj, fname)) \n end \n _p('') \n _p('COPYFILES += \\ \\ ') \n for target, source in pairs(cfgpairs[anycfg]) do \n _p(' \\ t%s \\ \\ ', target) \n end \n for target, source in pairs(copypairs) do \n _p(' \\ t%s \\ \\ ', target) \n end \n _p('') \n _p('SHELLTYPE := msdos') \n _p('ifeq (,$(ComSpec)$(COMSPEC))') \n _p(' SHELLTYPE := posix') \n _p('endif') \n _p "
" ('ifeq (/bin ,$(findstring /bin,$(SHELL)))')\n _p(' SHELLTYPE := posix') \n _p('endif') \n _p('ifeq (/bin,$(findstring /bin,$(MAKESHELL)))') \n _p(' SHELLTYPE := posix') \n _p('endif') \n _p('') \n _p('.PHONY: clean prebuild prelink') \n _p('') \n _p('all: $(TARGETDIR) $(OBJDIR) prebuild $(EMBEDFILES) $(COPYFILES) prelink $(TARGET)') \n _p('') \n _p('$(TARGET): $(SOURCES) $(EMBEDFILES) $(DEPENDS)') \n _p(' \\ t$(SILENT) $(CSC) /nologo /out:$@ $(FLAGS) $(REFERENCES) $(SOURCES) $(patsubst %%,/resource:%%,$(EMBEDFILES))') \n _p(' \\ t$(POSTBUILDCMDS)') \n _p('') \n _p('$(TARGETDIR):') \n premake.make_mkdirrule( \" $(TARGETDIR) \" ) \n _p('$(OBJDIR):') \n premake.make_mkdirrule( \" $(OBJDIR) \" ) \n _p('clean:') \n _p(' \\ t@echo Cleaning %s', prj.name) \n _p('ifeq (posix,$(SHELLTYPE))') \n _p(' \\ t$(SILENT) rm -f $(TARGET DIR )/%s.* $(COPYFILES)', prj.buildtarget.basename )\n _p(' \\ t$(SILENT) rm -rf $(OBJDIR)') \n _p('else') \n _p(' \\ t$(SILENT) if exist $(subst /, \\ \\ \\ \\ ,$(TARGETDIR)/%s.*) del $(subst /, \\ \\ \\ \\ ,$(TARGETDIR)/%s.*)', prj.buildtarget.basename, prj.buildtarget.b "
" asename)\n for target, source in pairs(cfgpairs [anycfg]) do\n _p(' \\ t$(SILENT) if exist $(subst /, \\ \\ \\ \\ ,%s) del $(subst /, \\ \\ \\ \\ ,%s)', target, target) \n end \n for target, source in pairs(copypairs) do \n _p(' \\ t$(SILENT) if exist $(subst /, \\ \\ \\ \\ ,%s) del $(subst /, \\ \\ \\ \\ ,%s)', target, target) \n end \n _p(' \\ t$(SILENT) if exist $(subst /, \\ \\ \\ \\ ,$(OBJDIR)) rmdir /s /q $(subst /, \\ \\ \\ \\ ,$(OBJDIR))') \n _p('endif') \n _p('') \n _p('prebuild:') \n _p(' \\ t$(PREBUILDCMDS)') \n _p('') \n _p('prelink:') \n _p(' \\ t$(PRELINKCMDS)') \n _p('') \n _p('# Per-configuration copied file rules') \n for cfg in premake.eachconfig(prj) do \n _p('ifneq (,$(findstring %s,$(config)))', _MAKE.esc(cfg.name:lower())) \n for target, source in pairs(cfgpairs[cfg]) do \n premake.make_copyrule(source, target) \n end \n _p('endif') \n _p('') \n end \n _p('# Copied file rules') \n for target, source in pairs(copypairs) do \n premake.make_copyrule(source, target) \n end \n _p('# Embedded file rules') \n for _, fname in ipairs(embedded) do \n if path.getextension(fname) == \" .resx \" then "
" \n _p('%s: %s', getresourcefilename(prj, fname), _MAKE.esc(fname))\n _p(' \\ t$(SILENT) $(RESGEN) $^ $@') \n end \n _p('') \n end \n end \n function premake.gmake_cs_config(cfg, csc, cfglibs) \n _p('ifneq (,$(findstring %s,$(config)))', _MAKE.esc(cfg.name:lower()))\n _p(' TARGETDIR := %s', _MAKE.esc(cfg.buildtarget.directory ))\n _p(' OBJDIR := %s', _MAKE.esc(cfg.objectsdir)) \n _p(' DEPENDS := %s', table.concat(_MAKE.esc(premake.getlinks(cfg, \" dependencies \" , \" fullpath \" )), \" \" )) \n _p(' REFERENCES := %s', table.implode(_MAKE.esc(cfglibs[cfg]), \" /r: \" , \" \" , \" \" )) \n _p(' FLAGS += %s %s', table.implode(cfg.defines, \" /d: \" , \" \" , \" \" ), table.concat(table.join(csc.getflags(cfg), cfg.buildoptions), \" \" )) \n _p(' define PREBUILDCMDS') \n if #cfg.prebuildcommands > 0 then \n _p(' \\ t@echo Running pre-build commands') \n _p(' \\ t%s', table.implode(cfg.prebuildcommands, \" \" , \" \" , \" \\ n \\ t \" )) \n end \n _p(' endef') \n _p(' define PRELINKCMDS') \n if #cfg.prelinkcommands > 0 then \n _p(' \\ t@echo Running pre-link co mmands')\n _p "
" ('\\ t%s', table.implode(cfg.prelinkcommands, \" \" , \" \" , \" \\ n \\ t \" )) \n end \n _p(' endef') \n _p(' define POSTBUILDCMDS') \n if #cfg.postbuildcommands > 0 then \n _p(' \\ t@echo Running post-build commands') \n _p(' \\ t%s', table.implode(cfg.postbuildcommands, \" \" , \" \" , \" \\ n \\ t \" )) \n end \n _p(' endef') \n _p('endif') \n _p('') \n end \n " ,
" local function getresourcefilename(cfg, fname) \n if path.getextension(fname) == \" .resx \" then \n local name = cfg.buildtarget.basename .. \" . \" \n local dir = path.getdirectory(fname)\n if dir ~= \" . \" then \n name = name .. path.translate(dir, \" . \" ) .. \" . \" \n end \n return \" $(OBJDIR)/ \" .. _MAKE.esc(name .. path.getbasename(fname)) .. \" .resources \" \n else \n return fname \n end \n end \n function premake.make_csharp(prj) \n local csc = premake.dotnet \n local cfglibs = { } \n local cfgpairs = { } \n local anycfg \n for cfg in premake.eachconfig(prj) do \n anycfg = cfg \n cfglibs[cfg] = premake.getlinks(cfg, \" siblings \" , \" fullpath \" ) \n cfgpairs[cfg] = { } \n for _, fname in ipairs(cfglibs[cfg]) do \n if path.getdirectory(fname) ~= cfg.buildtarget.directory then \n cfgpairs[cfg][ \" $(TARGETDIR)/ \" .. _MAKE.esc(path.getname(fname))] = _MAKE.esc(fname) \n end \n end \n end \n local sources = {} \n local embedded = { } \n local copypairs = { } \n for fcfg in premake.project.eachfile(prj) do \n local action = csc.getbuildaction(fcfg) \n if action == \" Co mpile\" then "
" \n table.insert(sources, fcfg.name) \n elseif action == \" EmbeddedResource \" then \n table.insert(embedded, fcfg.name) \n elseif action == \" Content \" then \n copypairs[ \" $(TARGETDIR)/ \" .. _MAKE.esc(path.getname(fcfg.name))] = _MAKE.esc(fcfg.name) \n elseif path.getname(fcfg.name):lower() == \" app.config \" then \n copypairs[ \" $(TARGET).config \" ] = _MAKE.esc(fcfg.name) \n end \n end \n local paths = table.translate(prj.libdirs, function(v) return path.join(prj.basedir, v) end) \n paths = table.join({prj.basedir}, paths) \n for _, libname in ipairs(premake.getlinks(prj, \" system \" , \" fullpath \" )) do \n local libdir = os.pathsearch(libname.. \" .dll \" , unpack(paths)) \n if (libdir) then \n local target = \" $(TARGETDIR)/ \" .. _MAKE.esc(path.getname(libname)) \n local source = path.getrelative(prj.basedir, path.join(libdir, libname)).. \" .dll \" \n copypairs[target] = _MAKE.esc(source) \n end \n end \n _p('# %s project makefile autogenerated by GENie', premake.action.current().shortname) \n _p('') \n _p('ifndef config') \n _p(' config=%s', _MAKE.esc (prj.configu "
" rations[1]:lower()))\n _p('endif') \n _p('') \n _p('ifndef verbose') \n _p(' SILENT = @') \n _p('endif') \n _p('') \n _p('SHELLTYPE := msdos') \n _p('ifeq (,$(ComSpec)$(COMSPEC))') \n _p(' SHELLTYPE := posix') \n _p('endif') \n _p('ifeq (/bin,$(findstring /bin,$(SHELL)))') \n _p(' SHELLTYPE := posix') \n _p('endif') \n _p('ifeq (/bin,$(findstring /bin,$(MAKESHELL)))') \n _p(' SHELLTYPE := posix') \n _p('endif') \n _p('') \n _p('ifeq (posix,$(SHELLTYPE))') \n _p(' MKDIR = $(SILENT) mkdir -p \" $(1) \" ') \n _p(' COPY = $(SILENT) cp -fR \" $(1) \" \" $(2) \" ') \n _p('else') \n _p(' MKDIR = $(SILENT) mkdir \" $(subst /, \\ \\ \\ \\ ,$(1)) \" 2> nul') \n _p(' COPY = $(SILENT) copy /Y \" $(subst /, \\ \\ \\ \\ ,$(1)) \" \" $(subst /, \\ \\ \\ \\ ,$(2)) \" ') \n _p('endif') \n _p('') \n _p('ifndef CSC') \n _p(' CSC=%s', csc.getcompilervar(prj)) \n _p('endif') \n _p('') \n _p('ifndef RESGEN') \n _p(' RESGEN=resgen') \n _p('endif') \n _p('') \n local platforms = premake.filterplatforms(prj.solution, premake[_OPTIONS.cc].platforms) \n table.insert(platforms, 1, \" \" ) \n for cfg in premake.each config(prj) "
" do\n premake.gmake_cs_config(cfg, csc, cfglibs) \n end \n _p('# To maintain compatibility with VS.NET, these values must be set at the project level') \n _p('TARGET := $(TARGETDIR)/%s', _MAKE.esc(prj.buildtarget.name)) \n _p('FLAGS += /t:%s %s', csc.getkind(prj):lower(), table.implode(_MAKE.esc(prj.libdirs), \" /lib: \" , \" \" , \" \" )) \n _p('REFERENCES += %s', table.implode(_MAKE.esc(premake.getlinks(prj, \" system \" , \" basename \" )), \" /r: \" , \" .dll \" , \" \" )) \n _p('') \n _p('SOURCES := \\ \\ ') \n for _, fname in ipairs(sources) do \n _p(' \\ t%s \\ \\ ', _MAKE.esc(path.translate(fname))) \n end \n _p('') \n _p('EMBEDFILES := \\ \\ ') \n for _, fname in ipairs(embedded) do \n _p(' \\ t%s \\ \\ ', getresourcefilename(prj, fname)) \n end \n _p('') \n _p('COPYFILES += \\ \\ ') \n for target, source in pairs(cfgpairs[anycfg]) do \n _p(' \\ t%s \\ \\ ', target) \n end \n for target, source in pairs(copypairs) do \n _p(' \\ t%s \\ \\ ', target) \n end \n _p('') \n _p('SHELLTYPE := msdos') \n _p('ifeq (,$(ComSpec)$(COMSPEC))') \n _p(' SHELLTYPE := posix') \n _p('endif') \n _p ('ifeq (/bin "
" ,$(findstring /bin,$(SHELL)))')\n _p(' SHELLTYPE := posix') \n _p('endif') \n _p('ifeq (/bin,$(findstring /bin,$(MAKESHELL)))') \n _p(' SHELLTYPE := posix') \n _p('endif') \n _p('') \n _p('.PHONY: clean prebuild prelink') \n _p('') \n _p('all: $(TARGETDIR) $(OBJDIR) prebuild $(EMBEDFILES) $(COPYFILES) prelink $(TARGET)') \n _p('') \n _p('$(TARGET): $(SOURCES) $(EMBEDFILES) $(DEPENDS)') \n _p(' \\ t$(SILENT) $(CSC) /nologo /out:$@ $(FLAGS) $(REFERENCES) $(SOURCES) $(patsubst %%,/resource:%%,$(EMBEDFILES))') \n _p(' \\ t$(POSTBUILDCMDS)') \n _p('') \n _p('$(TARGETDIR):') \n premake.make_mkdirrule( \" $(TARGETDIR) \" ) \n _p('$(OBJDIR):') \n premake.make_mkdirrule( \" $(OBJDIR) \" ) \n _p('clean:') \n _p(' \\ t@echo Cleaning %s', prj.name) \n _p('ifeq (posix,$(SHELLTYPE))') \n _p(' \\ t$(SILENT) rm -f $(TARGET ) $(COPYFILES)')\n _p(' \\ t$(SILENT) rm -rf $(OBJDIR)') \n _p('else') \n _p(' \\ t$(SILENT) if exist $(subst /, \\ \\ \\ \\ ,$(TARGETDIR)/%s.*) del $(subst /, \\ \\ \\ \\ ,$(TARGETDIR)/%s.*)', prj.buildtarget.basename, prj.buildtarget.b asename)\n for target, source in pairs(cfgpairs "
" [anycfg]) do\n _p(' \\ t$(SILENT) if exist $(subst /, \\ \\ \\ \\ ,%s) del $(subst /, \\ \\ \\ \\ ,%s)', target, target) \n end \n for target, source in pairs(copypairs) do \n _p(' \\ t$(SILENT) if exist $(subst /, \\ \\ \\ \\ ,%s) del $(subst /, \\ \\ \\ \\ ,%s)', target, target) \n end \n _p(' \\ t$(SILENT) if exist $(subst /, \\ \\ \\ \\ ,$(OBJDIR)) rmdir /s /q $(subst /, \\ \\ \\ \\ ,$(OBJDIR))') \n _p('endif') \n _p('') \n _p('prebuild:') \n _p(' \\ t$(PREBUILDCMDS)') \n _p('') \n _p('prelink:') \n _p(' \\ t$(PRELINKCMDS)') \n _p('') \n _p('# Per-configuration copied file rules') \n for cfg in premake.eachconfig(prj) do \n _p('ifneq (,$(findstring %s,$(config)))', _MAKE.esc(cfg.name:lower())) \n for target, source in pairs(cfgpairs[cfg]) do \n premake.make_copyrule(source, target) \n end \n _p('endif') \n _p('') \n end \n _p('# Copied file rules') \n for target, source in pairs(copypairs) do \n premake.make_copyrule(source, target) \n end \n _p('# Embedded file rules') \n for _, fname in ipairs(embedded) do \n if path.getextension(fname) == \" .resx \" then \n _p('%s: %s', getresourcefilename(prj, fname), "
" _MAKE.esc(fname))\n _p(' \\ t$(SILENT) $(RESGEN) $^ $@') \n end \n _p('') \n end \n end \n function premake.gmake_cs_config(cfg, csc, cfglibs) \n local targetDir = _MAKE.esc(cfg.buildtarget.directory)\n _p('ifneq (,$(findstring %s,$(config)))', _MAKE.esc(cfg.name:lower()))\n _p(' TARGETDIR := %s', iif(targetDir == \" \" , \" . \" , targetDir ))\n _p(' OBJDIR := %s', _MAKE.esc(cfg.objectsdir)) \n _p(' DEPENDS := %s', table.concat(_MAKE.esc(premake.getlinks(cfg, \" dependencies \" , \" fullpath \" )), \" \" )) \n _p(' REFERENCES := %s', table.implode(_MAKE.esc(cfglibs[cfg]), \" /r: \" , \" \" , \" \" )) \n _p(' FLAGS += %s %s', table.implode(cfg.defines, \" /d: \" , \" \" , \" \" ), table.concat(table.join(csc.getflags(cfg), cfg.buildoptions), \" \" )) \n _p(' define PREBUILDCMDS') \n if #cfg.prebuildcommands > 0 then \n _p(' \\ t@echo Running pre-build commands') \n _p(' \\ t%s', table.implode(cfg.prebuildcommands, \" \" , \" \" , \" \\ n \\ t \" )) \n end \n _p(' endef') \n _p(' define PRELINKCMDS') \n if #cfg.prelinkcommands > 0 then \n _p(' \\ t@echo Running pre-link co "
" mmands')\n _p ('\\ t%s', table.implode(cfg.prelinkcommands, \" \" , \" \" , \" \\ n \\ t \" )) \n end \n _p(' endef') \n _p(' define POSTBUILDCMDS') \n if #cfg.postbuildcommands > 0 then \n _p(' \\ t@echo Running post-build commands') \n _p(' \\ t%s', table.implode(cfg.postbuildcommands, \" \" , \" \" , \" \\ n \\ t \" )) \n end \n _p(' endef') \n _p('endif') \n _p('') \n end \n " ,
/* actions/make/make_vala.lua */
" local make = premake.make \n function premake.make_vala(prj) \n local valac = premake.gettool(prj) \n local platforms = premake.filterplatforms(prj.solution, valac.platforms, \" Native \" ) \n _p('# %s project makefile autogenerated by GENie', premake.action.current().shortname) \n _p('ifndef config') \n _p(' config=%s', _MAKE.esc(premake.getconfigname(prj.solution.configurations[1], platforms[1], true))) \n _p('endif') \n _p('') \n _p('ifndef verbose') \n _p(' SILENT = @') \n _p('endif') \n _p('') \n _p('SHELLTYPE := msdos') \n _p('ifeq (,$(ComSpec)$(COMSPEC))') \n _p(' SHELLTYPE := posix') \n _p('endif') \n _p('ifeq (/bin,$(findstring /bin,$(SHELL)))') \n _p(' SHELLTYPE := posix') \n _p('endif') \n _p('ifeq (/bin,$(findstring /bin,$(MAKESHELL)))') \n _p(' SHELLTYPE := posix') \n _p('endif') \n _p('') \n _p('ifeq (posix,$(SHELLTYPE))') \n _p(' MKDIR = $(SILENT) mkdir -p \" $(1) \" ') \n _p(' COPY = $(SILENT) cp -fR \" $(1) \" \" $(2) \" ') \n _p(' RM = $(SILENT) rm -f \" $(1) \" ') \n _p('else') \n _p(' MKDIR = $(SILENT) mkdir \" $(subst /, \\ \\ \\ \\ ,$(1)) \" 2> nul || e "
@ -259,64 +271,77 @@ const char* builtin_scripts[] = {
" GS = %s \" , make.list(tool.getswiftlinkflags(cfg))) \n _p(1, \" AR_FLAGS = %s \" , make.list(tool.getarchiveflags(cfg, cfg, false))) \n _p(1, \" LD_FLAGS = %s \" , make.list(tool.getldflags(cfg))) \n _p(1, \" LDDEPS = %s \" , make.list(premake.getlinks(cfg, \" siblings \" , \" fullpath \" ))) \n if cfg.flags.Symbols then \n _p(1, \" SYMBOLS = $(TARGET).dSYM \" ) \n end \n local sdk = tool.get_sdk_path(cfg) \n if sdk then \n _p(1, \" TOOLCHAIN_PATH = %s \" , tool.get_toolchain_path(cfg)) \n _p(1, \" SDK_PATH = %s \" , sdk) \n _p(1, \" PLATFORM_PATH = %s \" , tool.get_sdk_platform_path(cfg)) \n _p(1, \" SDK = -sdk $(SDK_PATH) \" ) \n else \n _p(1, \" SDK_PATH = \" ) \n _p(1, \" SDK = \" ) \n end \n _p(1,'WORK_DIRS = $(OUT_DIR) $(OBJDIR)') \n _p('endif') \n _p('') \n end " ,
/* actions/vstudio/_vstudio.lua */
" premake.vstudio = { } \n local toolsets = { \n vs2010 = \" v100 \" , \n vs2012 = \" v110 \" , \n vs2013 = \" v120 \" , \n vs2015 = \" v140 \" , \n vs2017 = \" v141 \" , \n vs llvm = \" llvm \" , \n } \n premake.vstudio.toolset = toolsets[_ACTION] or \" unknown? \" \n premake.vstudio.splashpath = '' \n local vstudio = premake.vstudio \n vstudio.platforms = { \n any = \" Any CPU \" , \n mixed = \" Mixed Platforms \" , \n Native = \" Win32 \" , \n x86 = \" x86 \" , \n x32 = \" Win32 \" , \n x64 = \" x64 \" , \n PS3 = \" PS3 \" , \n Xbox360 = \" Xbox 360 \" , \n ARM = \" ARM \" , \n Orbis = \" ORBIS \" , \n Durango = \" Durango \" , \n }\n function vstudio.arch(prj) \n if (prj.language == \" C# \" ) then \n return \" Any CPU \" \n else \n return \" Win32 \" \n end \n end \n function vstudio.iswinrt() \n return vstudio.storeapp ~= nil and vstudio.storeapp ~= '' \n end \n function vstudio.buildconfigs(sln) \n local cfgs = { } \n local platforms = premake.filter platforms(sln, vstudio.platforms, \" Native \" ) \n local hascpp = premake.hascppproject(sln) \n local hasdotnet = premake.hasdotnetproject(sln) \n if hasdotnet and (_ "
" ACTION > \" vs2008 \" or hascpp) then \n table.insert(platforms, 1, \" mixed \" ) \n end \n if hasdotnet and (_ACTION < \" vs2010 \" or not hascpp) then \n table.insert(platforms, 1, \" any \" ) \n end \n if _ACTION > \" vs2008 \" then \n local platforms2010 = { } \n for _, platform in ipairs(platforms) do \n if vstudio.platforms[platform] == \" Win32 \" then \n if hascpp then \n table.insert(platforms2010, platform) \n end \n if hasdotnet then \n table.insert(platforms2010, \" x86 \" ) \n end \n else \n table.insert(platforms2010, platform) \n end \n end \n platforms = platforms2010 \n end \n for _, buildcfg in ipairs(sln.configurations) do \n for _, platform in ipairs(platforms) do \n local entry = { } \n entry.src_buildcfg = buildcfg \n entry.src_platform = platform \n if platform ~= \" PS3 \" or _ACTION > \" vs2008 \" then \n entry.buildcfg = buildcfg \n entry.platform = vstudio.platforms[platform] \n else \n entry.buildcfg = pla tform .. \" \" .. buildcfg \n entry.platform = \" Win32 \" \n end \n entry.name = entry.buildcfg .. \" | \" .. entry.platform \n entry.isreal = (platform ~= \" any \" and plat "
" form ~= \" mixed \" ) \n table.insert(cfgs, entry) \n end \n end \n return cfgs \n end \n function premake.vstudio.bakeimports(sln) \n for _,iprj in ipairs(sln.importedprojects) do \n if string.find(iprj.location, \" .csproj \" ) ~= nil then \n iprj.language = \" C# \" \n else \n iprj.language = \" C++ \" \n end \n local f, err = io.open(iprj.location, \" r \" ) \n if (not f) then \n error(err, 1) \n end \n local projcontents = f:read( \" *all \" ) \n f:close() \n local found, _, uuid = string.find(projcontents, \" <ProjectGuid>{([%w%-]+)}</ProjectGuid> \" ) \n if not found then \n error( \" Could not find ProjectGuid element in project \" .. iprj.location, 1) \n end \n iprj.uuid = uuid \n if iprj.language == \" C++ \" and string.find(projcontents, \" <CLRSupport>true</CLRSupport> \" ) then \n iprj.flags.Managed = true \n end \n iprj.relpath = path.getrelative(sln.location, iprj.location) \n end \n end \n function premake.vstudio.get importprj(prjpath, sln)\n for _,iprj in ipairs(sln.importedprojects) do \n if prjpath == iprj.relpath then \n return iprj \n end \n end \n error( \" Could not find reference impo"
" rt project \" .. prjpath, 1) \n end \n function vstudio.cleansolution(sln) \n premake.clean.file(sln, \" %%.sln \" ) \n premake.clean.file(sln, \" %%.suo \" ) \n premake.clean.file(sln, \" %%.ncb \" ) \n premake.clean.file(sln, \" %%.userprefs \" ) \n premake.clean.file(sln, \" %%.usertasks \" ) \n end \n function vstudio.cleanproject(prj) \n local fname = premake.project.getfilename(prj, \" %% \" ) \n os.remove(fname .. \" .vcproj \" ) \n os.remove(fname .. \" .vcproj.user \" ) \n os.remove(fname .. \" .vcxproj \" ) \n os.remove(fname .. \" .vcxproj.user \" ) \n os.remove(fname .. \" .vcxproj.filters \" ) \n os.remove(fname .. \" .csproj \" ) \n os.remove(fname .. \" .csproj.user \" ) \n os.remove(fname .. \" .pidb \" ) \n os.remove(fname .. \" .sdf \" ) \n end \n function vstudio.cleantarget(name) \n os.remove(name .. \" .pdb \" ) \n os.remove(name .. \" .idb \" ) \n os.remove(name .. \" .ilk \" ) \n os.remove(name .. \" .vshost.exe \" ) \n os.remove(name . . \" .exe.manifest \" ) \n end \n function vstudio.projectfile(prj) \n local pattern \n if prj.language == \" C# \" then \n pattern = \" %%.csproj \" \n else \n pattern = iif(_ACTION "
" > \" vs2008 \" , \" %%.vcxproj \" , \" %%.vcproj \" ) \n end \n local fname = premake.project.getbasename(prj.name, pattern) \n fname = path.join(prj.location, fname) \n return fname \n end \n function vstudio.tool(prj) \n if (prj.language == \" C# \" ) then \n return \" FAE04EC0-301F-11D3-BF4B-00C04F79EFBC \" \n else \n return \" 8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942 \" \n end \n end \n " ,
" premake.vstudio = { } \n local toolsets = { \n vs2010 = \" v100 \" , \n vs2012 = \" v110 \" , \n vs2013 = \" v120 \" , \n vs2015 = \" v140 \" , \n vs2017 = \" v141 \" , \n vs 2019 = \" v142 \" , \n vs llvm = \" llvm \" , \n } \n premake.vstudio.toolset = toolsets[_ACTION] or \" unknown? \" \n premake.vstudio.splashpath = '' \n premake.vstudio.xpwarning = true \n local vstudio = premake.vstudio \n vstudio.platforms = { \n any = \" Any CPU \" , \n mixed = \" Mixed Platforms \" , \n Native = \" Win32 \" , \n x86 = \" x86 \" , \n x32 = \" Win32 \" , \n x64 = \" x64 \" , \n PS3 = \" PS3 \" , \n Xbox360 = \" Xbox 360 \" , \n ARM = \" ARM \" , \n Orbis = \" ORBIS \" , \n Durango = \" Durango \" , \n TegraAndroid = \" Tegra-Android \" , \n NX32 = \" NX32 \" , \n NX64 = \" NX64 \" , \n Emscripten = \" Emscripten \" , \n }\n function vstudio.arch(prj) \n if (prj.language == \" C# \" ) then \n return \" Any CPU \" \n else \n return \" Win32 \" \n end \n end \n function vstudio.iswinrt() \n return vstudio.storeapp ~= nil and vstudio.storeapp ~= '' \n end \n function vstudio.buildconfigs(sln) \n local cfgs = { } \n local platforms = premake.filter "
" platforms(sln, vstudio.platforms, \" Native \" ) \n local hascpp = premake.hascppproject(sln) \n local hasdotnet = premake.hasdotnetproject(sln) \n if hasdotnet and (_ ACTION > \" vs2008 \" or hascpp) then \n table.insert(platforms, 1, \" mixed \" ) \n end \n if hasdotnet and (_ACTION < \" vs2010 \" or not hascpp) then \n table.insert(platforms, 1, \" any \" ) \n end \n if _ACTION > \" vs2008 \" then \n local platforms2010 = { } \n for _, platform in ipairs(platforms) do \n if vstudio.platforms[platform] == \" Win32 \" then \n if hascpp then \n table.insert(platforms2010, platform) \n end \n if hasdotnet then \n table.insert(platforms2010, \" x86 \" ) \n end \n else \n table.insert(platforms2010, platform) \n end \n end \n platforms = platforms2010 \n end \n for _, buildcfg in ipairs(sln.configurations) do \n for _, platform in ipairs(platforms) do \n local entry = { } \n entry.src_buildcfg = buildcfg \n entry.src_platform = platform \n if platform ~= \" PS3 \" or _ACTION > \" vs2008 \" then \n entry.buildcfg = buildcfg \n entry.platform = vstudio.platforms[platform] \n else \n entry.buildcfg = pla "
" tform .. \" \" .. buildcfg \n entry.platform = \" Win32 \" \n end \n entry.name = entry.buildcfg .. \" | \" .. entry.platform \n entry.isreal = (platform ~= \" any \" and plat form ~= \" mixed \" ) \n table.insert(cfgs, entry) \n end \n end \n return cfgs \n end \n function premake.vstudio.bakeimports(sln) \n for _,iprj in ipairs(sln.importedprojects) do \n if string.find(iprj.location, \" .csproj \" ) ~= nil then \n iprj.language = \" C# \" \n else \n iprj.language = \" C++ \" \n end \n local f, err = io.open(iprj.location, \" r \" ) \n if (not f) then \n error(err, 1) \n end \n local projcontents = f:read( \" *all \" ) \n f:close() \n local found, _, uuid = string.find(projcontents, \" <ProjectGuid>{([%w%-]+)}</ProjectGuid> \" ) \n if not found then \n error( \" Could not find ProjectGuid element in project \" .. iprj.location, 1) \n end \n iprj.uuid = uuid \n if iprj.language == \" C++ \" and string.find(projcontents, \" <CLRSupport>true</CLRSupport> \" ) then \n iprj.flags.Managed = true \n end \n iprj.relpath = path.getrelative(sln.location, iprj.location) \n end \n end \n function premake.vstudio.get impo"
" rt prj(prjpath, sln)\n for _,iprj in ipairs(sln.importedprojects) do \n if prjpath == iprj.relpath then \n return iprj \n end \n end \n error( \" Could not find reference import project \" .. prjpath, 1) \n end \n function vstudio.cleansolution(sln) \n premake.clean.file(sln, \" %%.sln \" ) \n premake.clean.file(sln, \" %%.suo \" ) \n premake.clean.file(sln, \" %%.ncb \" ) \n premake.clean.file(sln, \" %%.userprefs \" ) \n premake.clean.file(sln, \" %%.usertasks \" ) \n end \n function vstudio.cleanproject(prj) \n local fname = premake.project.getfilename(prj, \" %% \" ) \n os.remove(fname .. \" .vcproj \" ) \n os.remove(fname .. \" .vcproj.user \" ) \n os.remove(fname .. \" .vcxproj \" ) \n os.remove(fname .. \" .vcxproj.user \" ) \n os.remove(fname .. \" .vcxproj.filters \" ) \n os.remove(fname .. \" .csproj \" ) \n os.remove(fname .. \" .csproj.user \" ) \n os.remove(fname .. \" .pidb \" ) \n os.remove(fname .. \" .sdf \" ) \n end \n function vstudio.cleantarget(name) \n os.remove(name .. \" .pdb \" ) \n os.remove(name .. \" .idb \" ) \n os.remove(name .. \" .ilk \" ) \n os.remove(name .. \" .vshost.exe \" ) \n os.remove(name . "
" . \" .exe.manifest \" ) \n end \n function vstudio.projectfile(prj) \n local pattern \n if prj.language == \" C# \" then \n pattern = \" %%.csproj \" \n else \n pattern = iif(_ACTION > \" vs2008 \" , \" %%.vcxproj \" , \" %%.vcproj \" ) \n end \n local fname = premake.project.getbasename(prj.name, pattern) \n fname = path.join(prj.location, fname) \n return fname \n end \n function vstudio.tool(prj) \n if (prj.language == \" C# \" ) then \n return \" FAE04EC0-301F-11D3-BF4B-00C04F79EFBC \" \n else \n return \" 8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942 \" \n end \n end \n " ,
/* actions/vstudio/vstudio_solution.lua */
" premake.vstudio.sln2005 = { } \n local vstudio = premake.vstudio \n local sln2005 = premake.vstudio.sln2005 \n function sln2005.generate(sln) \n io.eol = ' \\ r \\ n' \n sln.vstudio_configs = premake.vstudio.buildconfigs(sln) \n premake.vstudio.bakeimports(sln) \n _p(' \\ 239 \\ 187 \\ 191') \n sln2005.reorderProjects(sln) \n sln2005.header(sln) \n for grp in premake.solution.eachgroup(sln) do \n sln2005.group(grp) \n end \n for prj in premake.solution.eachproject(sln) do \n sln2005.project(prj) \n end \n \n for _,iprj in ipairs(sln.importedprojects) do \n sln2005.importproject(iprj) \n end \n _p('Global') \n sln2005.platforms(sln) \n sln2005.project_platforms(sln) \n sln2005.properties(sln) \n sln2005.project_groups(sln) \n _p('EndGlobal') \n end \n function sln2005.reorderProjects(sln) \n if sln.startproject then \n for i, prj in ipairs(sln.projects) do \n if sln.startproject == prj.name then \n local cur = prj.group \n while cur ~= nil do \n for j, group in ipairs(sln.groups) do \n if group == cur then \n table.remove(sln.groups, j) \n break \n end \n end \n table.insert(sln.groups, 1 "
" , cur) \n cur = cur.parent \n end \n table.remove(sln.projects, i) \n table.insert(sln.projects, 1, prj) \n break \n end \n end \n end \n end \n function sln2005.header(sln) \n local action = premake.action.current() \n _p('Microsoft Visual Studio Solution File, Format Version %d.00', action.vstudio.solutionVersion) \n if(_ACTION:sub(3) == \" 2015 \" or _ACTION:sub(3) == \" 2017 \" or _ACTION:sub(3) == \" llvm \" ) then \n _p('# Visual Studio %s', action.vstudio.toolsVersion:sub(1,2)) \n else \n _p('# Visual Studio %s', _ACTION:sub(3)) \n end \n end \n function sln2005.project(prj) \n local projpath = path.translate(path.getrelative(prj.solution.location, vstudio.projectfile(prj)), \" \\ \\ \" ) \n _p('Project( \" {%s} \" ) = \" %s \" , \" %s \" , \" {%s} \" ', vstudio.tool(prj), prj.name, projpath, prj.uuid) \n sln2005.projectdependencies(prj) \n _p('EndProject') \n end \n function sln2005.group(grp) \n _p('Project( \" {2150E333-8FDC-42A3-9474-1A3956D46DE8} \" ) = \" %s \" , \" %s \" , \" {%s} \" ', grp.name, grp.name, grp.uuid) \n _p('EndProject') \n end \n \n function sln2005.importproject(iprj) "
" \n _p('Project( \" {%s} \" ) = \" %s \" , \" %s \" , \" {%s} \" ', vstudio.tool(iprj), path.getbasename(iprj.location), iprj.relpath, iprj.uuid) \n _p('EndProject') \n end \n function sln2005.projectdependencies(prj) \n local deps = premake.getdependencies(prj) \n if #deps > 0 then \n _p('\\ tProjectSection(ProjectDependencies) = postProject') \n for _, dep in ipairs(deps) do \n _p(' \\ t \\ t{%s} = {%s}', dep.uuid, dep.uuid) \n end \n _p(' \\ tEndProjectSection') \n end \n end \n function sln2005.platforms(sln) \n _p(' \\ tGlobalSection(SolutionConfigurationPlatforms) = preSolution') \n for _, cfg in ipairs(sln.vstudio_configs) do \n _p(' \\ t \\ t%s = %s', cfg.name, cfg.name) \n end \n _p(' \\ tEndGlobalSection') \n end \n function sln2005.project_platform(prj, sln) \n for _, cfg in ipairs(sln.vstudio_configs) do \n local mapped \n local buildfor \n if premake.isdotnetproject(prj) then \n buildfor = \" x64 \" \n mapped = \" Any CPU \" \n elseif prj.flags and prj.flags.Managed then \n mapped = \" x64 \" \n els e\n if cfg.platform == \" Any CPU \" or cfg.platform == \" Mixed Platforms \" then \n mapped = sln. "
" vstudio_configs[3].platform\n else \n mapped = cfg.platform \n end \n end \n local build_project = true \n if prj.solution ~= nil then \n build_project = premake.getconfig(prj, cfg.src_buildcfg, cfg.src_platform).build \n end \n _p(' \\ t \\ t{%s}.%s.ActiveCfg = %s|%s', prj.uuid, cfg.name, cfg.buildcfg, mapped) \n if build_project then \n if mapped == cfg.platform or cfg.platform == \" Mixed Platforms \" or buildfor == cfg.platform then \n _p(' \\ t \\ t{%s}.%s.Build.0 = %s|%s', prj.uuid, cfg.name, cfg.buildcfg, mapped) \n end \n if premake.vstudio.iswinrt() and prj.kind == \" WindowedApp \" then \n _p(' \\ t \\ t{%s}.%s.Deploy.0 = %s|%s', prj.uuid, cfg.name, cfg.buildcfg, mapped) \n end \n end \n end \n end \n function sln2005.project_platforms(sln) \n _p(' \\ tGlobalSection(ProjectConfigurationPlatforms) = postSolution') \n for prj in premake.solution.eachproject(sln) do \n sln2005.project_platform(prj, sln) \n end \n for _,iprj in ipairs(sln.imported projects) do\n sln2005.project_platform(iprj, sln) \n end \n _p(' \\ tEndGlobalSection') \n end \n func "
" tion sln2005.properties(sln)\n _p(' \\ tGlobalSection(SolutionProperties) = preSolution') \n _p(' \\ t \\ tHideSolutionNode = FALSE') \n _p(' \\ tEndGlobalSection') \n end \n function sln2005.project_groups(sln) \n _p(' \\ tGlobalSection(NestedProjects) = preSolution') \n for grp in premake.solution.eachgroup(sln) do \n if grp.parent ~= nil then \n _p(' \\ t \\ t{%s} = {%s}', grp.uuid, grp.parent.uuid) \n end \n end \n for prj in premake.solution.eachproject(sln) do \n if prj.group ~= nil then \n _p(' \\ t \\ t{%s} = {%s}', prj.uuid, prj.group.uuid) \n end \n end \n for _,iprj in ipairs(sln.importedprojects) do \n if iprj.group ~= nil then \n _p(' \\ t \\ t{%s} = {%s}', iprj.uuid, iprj.group.uuid) \n end \n end \n \n _p(' \\ tEndGlobalSection') \n end " ,
" \n _p('Project( \" {%s} \" ) = \" %s \" , \" %s \" , \" {%s} \" ', vstudio.tool(iprj), path.getbasename(iprj.location), iprj.relpath, iprj.uuid) \n _p('EndProject') \n end \n function sln2005.projectdependencies(prj) \n local deps = premake.getdependencies(prj) \n if #deps > 0 then \n local function compareuuid(a, b) return a.uuid < b.uuid end\n table.sort(deps, compareuuid) \n _p('\\ tProjectSection(ProjectDependencies) = postProject') \n for _, dep in ipairs(deps) do \n _p(' \\ t \\ t{%s} = {%s}', dep.uuid, dep.uuid) \n end \n _p(' \\ tEndProjectSection') \n end \n end \n function sln2005.platforms(sln) \n _p(' \\ tGlobalSection(SolutionConfigurationPlatforms) = preSolution') \n for _, cfg in ipairs(sln.vstudio_configs) do \n _p(' \\ t \\ t%s = %s', cfg.name, cfg.name) \n end \n _p(' \\ tEndGlobalSection') \n end \n function sln2005.project_platform(prj, sln) \n for _, cfg in ipairs(sln.vstudio_configs) do \n local mapped \n local buildfor \n if premake.isdotnetproject(prj) then \n buildfor = \" x64 \" \n mapped = \" Any CPU \" \n elseif prj.flags and prj.flags.Managed then \n mapped = \" x64 \" \n els "
" e\n if cfg.platform == \" Any CPU \" or cfg.platform == \" Mixed Platforms \" then \n mapped = sln. vstudio_configs[3].platform\n else \n mapped = cfg.platform \n end \n end \n local build_project = true \n if prj.solution ~= nil then \n build_project = premake.getconfig(prj, cfg.src_buildcfg, cfg.src_platform).build \n end \n _p(' \\ t \\ t{%s}.%s.ActiveCfg = %s|%s', prj.uuid, cfg.name, cfg.buildcfg, mapped) \n if build_project then \n if mapped == cfg.platform or cfg.platform == \" Mixed Platforms \" or buildfor == cfg.platform then \n _p(' \\ t \\ t{%s}.%s.Build.0 = %s|%s', prj.uuid, cfg.name, cfg.buildcfg, mapped) \n end \n if premake.vstudio.iswinrt() and prj.kind == \" WindowedApp \" then \n _p(' \\ t \\ t{%s}.%s.Deploy.0 = %s|%s', prj.uuid, cfg.name, cfg.buildcfg, mapped) \n end \n end \n end \n end \n function sln2005.project_platforms(sln) \n _p(' \\ tGlobalSection(ProjectConfigurationPlatforms) = postSolution') \n for prj in premake.solution.eachproject(sln) do \n sln2005.project_platform(prj, sln) \n end \n for _,iprj in ipairs(sln.imported "
" projects) do\n sln2005.project_platform(iprj, sln) \n end \n _p(' \\ tEndGlobalSection') \n end \n func tion sln2005.properties(sln)\n _p(' \\ tGlobalSection(SolutionProperties) = preSolution') \n _p(' \\ t \\ tHideSolutionNode = FALSE') \n _p(' \\ tEndGlobalSection') \n end \n function sln2005.project_groups(sln) \n _p(' \\ tGlobalSection(NestedProjects) = preSolution') \n for grp in premake.solution.eachgroup(sln) do \n if grp.parent ~= nil then \n _p(' \\ t \\ t{%s} = {%s}', grp.uuid, grp.parent.uuid) \n end \n end \n for prj in premake.solution.eachproject(sln) do \n if prj.group ~= nil then \n _p(' \\ t \\ t{%s} = {%s}', prj.uuid, prj.group.uuid) \n end \n end \n for _,iprj in ipairs(sln.importedprojects) do \n if iprj.group ~= nil then \n _p(' \\ t \\ t{%s} = {%s}', iprj.uuid, iprj.group.uuid) \n end \n end \n \n _p(' \\ tEndGlobalSection') \n end " ,
/* actions/vstudio/vstudio_vcxproj.lua */
" premake.vstudio.vc2010 = { } \n local vc2010 = premake.vstudio.vc2010 \n local vstudio = premake.vstudio \n local function vs2010_config(prj) \n _p(1,'<ItemGroup Label= \" ProjectConfigurations \" >') \n for _, cfginfo in ipairs(prj.solution.vstudio_configs) do \n _p(2,'<ProjectConfiguration Include= \" %s \" >', premake.esc(cfginfo.name)) \n _p(3,'<Configuration>%s</Configuration>',cfginfo.buildcfg) \n _p(3,'<Platform>%s</Platform>',cfginfo.platform) \n _p(2,'</ProjectConfiguration>') \n end \n _p(1,'</ItemGroup>') \n end \n local function vs2010_globals(prj) \n local action = premake.action.current() \n _p(1,'<PropertyGroup Label= \" Globals \" >') \n _p(2, '<ProjectGuid>{%s}</ProjectGuid>',prj.uuid) \n _p(2, '<RootNamespace>%s</RootNamespace>',prj.name) \n if vstudio.storeapp ~= \" durango \" then \n local windowsTargetPlatformVersion = prj.windowstargetplatformversion or action.vstudio.windowsTargetPlatformVersion \n if windowsTargetPlatformVersion ~= nil then \n _p(2,'<WindowsTargetPlatformVersion>%s</WindowsTargetPlatformVersion>',windowsTargetPlatformVersion "
" ) \n if windowsTargetPlatformVersion and string.startswith(windowsTargetPlatformVersion, \" 10. \" ) then \n _p(2,'<WindowsTargetPlatformMinVersion>%s</WindowsTargetPlatformMinVersion>', prj.windowstargetplatformminversion or \" 10.0.10240.0 \" ) \n end \n end \n end \n if prj.flags and prj.flags.Managed then \n local frameworkVersion = prj.framework or \" 4.0 \" \n _p(2, '<TargetFrameworkVersion>v%s</TargetFrameworkVersion>', frameworkVersion) \n _p(2, '<Keyword>ManagedCProj</Keyword>') \n elseif vstudio.iswinrt() then \n _p(2, '<DefaultLanguage>en-US</DefaultLanguage>') \n if vstudio.storeapp == \" durango \" then \n _p(2, '<Keyword>Win32Proj</Keyword>') \n _p(2, '<ApplicationEnvironment>title</ApplicationEnvironment>') \n _p(2, '<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>') \n _p(2, '<TargetRuntime>Native</TargetRuntime>') \n else \n _p(2, '<AppContainerApplication>true</AppContainerApplication>') \n _p(2, '<MinimumVisualStudioVersion>12.0</MinimumVisualStudioVersion>') \n if vstudio.toolset == \" v120_wp81 \" then \n _p(2, '<ApplicationType> "
" Windows Phone</ApplicationType>') \n else \n _p(2, '<ApplicationType>Windows Store</ApplicationType>') \n end \n _p(2, '<ApplicationTypeRevision>%s</ApplicationTypeRevision>', vstudio.storeapp) \n end \n else \n _p(2, '<Keyword>Win32Proj</Keyword>') \n end \n if _ACTION:sub(3) == \" 2015 \" or _ACTION:sub(3) == \" 2017 \" or _ACTION:sub(3) == \" llvm \" then \n _p(2,'<PreferredToolArchitecture>x64</PreferredToolArchitecture>') \n end \n if (_ACTION:sub(3) == \" 2017 \" or _ACTION:sub(3) == \" llvm \" ) \n and os.isdir(path.join(os.getenv( \" VSINSTALLDIR \" ), \" VC/Tools/MSVC/14.14.26428 \" )) then \n _p(2,'<VCToolsVersion>14.14.26428</VCToolsVersion>') \n end \n _p(1,'</PropertyGroup>') \n end \n function vc2010.config_type(config) \n local t = \n { \n SharedLib = \" DynamicLibrary \" , \n StaticLib = \" StaticLibrary \" , \n ConsoleApp = \" Application \" , \n WindowedApp = \" Application \" \n } \n return t[config.kind] \n end \n local function if_config_and_platform() \n return 'Condition= \" \\ '$(Configuration)|$(Platform) \\ '== \\ '%s \\ ' \" ' \n end \n local function optimisation(cfg) \n local result "
" = \" Disabled \" \n for _, value in ipairs(cfg.flags) do \n if (value == \" Optimize \" ) then \n result = \" Full \" \n elseif (value == \" OptimizeSize \" ) then \n result = \" MinSpace \" \n elseif (value == \" OptimizeSpeed \" ) then \n result = \" MaxSpeed \" \n end \n end \n return result \n end \n function vc2010.configurationPropertyGroup(cfg, cfginfo) \n _p(1,'<PropertyGroup '..if_config_and_platform() ..' Label= \" Configuration \" >' \n , premake.esc(cfginfo.name)) \n _p(2,'<ConfigurationType>%s</ConfigurationType>',vc2010.config_type(cfg)) \n _p(2,'<UseDebugLibraries>%s</UseDebugLibraries>', iif(optimisation(cfg) == \" Disabled \" , \" true \" , \" false \" )) \n _p(2,'<PlatformToolset>%s</PlatformToolset>', premake.vstudio.toolset) \n if cfg.flags.MFC then \n _p(2,'<UseOfMfc>%s</UseOfMfc>', iif(cfg.flags.StaticRuntime, \" Static \" , \" Dynamic \" )) \n end \n if cfg.flags.ATL or cfg.flags.StaticATL then \n _p(2,'<UseOfAtl>%s</UseOfAtl>', iif(cfg.flags.StaticATL, \" Static \" , \" Dynamic \" )) \n end \n if cfg.flags.Unicode then \n _p(2,'<CharacterSet>Unicode</CharacterSet>') \n end \n if cfg "
" .flags.Managed then \n _p(2,'<CLRSupport>true</CLRSupport>') \n end \n _p(1,'</PropertyGroup>') \n end \n local function import_props(prj) \n for _, cfginfo in ipairs(prj.solution.vstudio_configs) do \n local cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform) \n _p(1,'<ImportGroup '..if_config_and_platform() ..' Label= \" PropertySheets \" >' \n ,premake.esc(cfginfo.name)) \n _p(2,'<Import Project= \" $(UserRootDir) \\ \\ Microsoft.Cpp.$(Platform).user.props \" Condition= \" exists( \\ '$(UserRootDir) \\ \\ Microsoft.Cpp.$(Platform).user.props \\ ') \" Label= \" LocalAppDataPlatform \" />') \n if #cfg.propertysheets > 0 then \n local dirs = cfg.propertysheets \n for _, dir in ipairs(dirs) do \n _p(2,'<Import Project= \" %s \" />', path.translate(dir)) \n end \n end \n _p(1,'</ImportGroup>') \n end \n end \n local function add_trailing_backslash(dir) \n if dir:len() > 0 and dir:sub(-1) ~= \" \\ \\ \" then \n return dir.. \" \\ \\ \" \n end \n return dir \n end \n function vc2010.outputProperties(prj) \n for _, cfginfo in ipairs(prj.solution.vstudio_configs) do \n local cfg = p "
" remake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform) \n local target = cfg.buildtarget \n local outdir = add_trailing_backslash(target.directory) \n local intdir = add_trailing_backslash(iif(action.vstudio.intDirAbsolute \n , path.translate( \n path.join(prj.solution.location, cfg.objectsdir) \n , ' \\ \\ ') \n , cfg.objectsdir \n )) \n _p(1,'<PropertyGroup '..if_config_and_platform() ..'>', premake.esc(cfginfo.name)) \n _p(2,'<OutDir>%s</OutDir>', iif(outdir:len() > 0, premake.esc(outdir), \" . \\ \\ \" )) \n if cfg.platform == \" Xbox360 \" then \n _p(2,'<OutputFile>$(OutDir)%s</OutputFile>', premake.esc(target.name)) \n end \n _p(2,'<IntDir>%s</IntDir>', premake.esc(intdir)) \n _p(2,'<TargetName>%s</TargetName>', premake.esc(path.getbasename(target.name))) \n _p(2,'<TargetExt>%s</TargetExt>', premake.esc(path.getextension(target.name))) \n if cfg.kind == \" SharedLib \" then \n local ignore = (cfg.flags.NoImportLib ~= nil) \n _p(2,'<IgnoreImportLibrary>%s</IgnoreImportLibrary>', tostring(ignore)) \n end \n if cfg.platform == \" Durango \" then \n _p "
" (2, '<ReferencePath>$(Console_SdkLibPath);$(Console_SdkWindowsMetadataPath)</ReferencePath>') \n _p(2, '<LibraryPath>$(Console_SdkLibPath)</LibraryPath>') \n _p(2, '<LibraryWPath>$(Console_SdkLibPath);$(Console_SdkWindowsMetadataPath)</LibraryWPath>') \n _p(2, '<IncludePath>$(Console_SdkIncludeRoot)</IncludePath>') \n _p(2, '<ExecutablePath>$(Console_SdkRoot)bin;$(VCInstallDir)bin \\ \\ x86_amd64;$(VCInstallDir)bin;$(WindowsSDK_ExecutablePath_x86);$(VSInstallDir)Common7 \\ \\ Tools \\ \\ bin;$(VSInstallDir)Common7 \\ \\ tools;$(VSInstallDir)Common7 \\ \\ ide;$(ProgramFiles) \\ \\ HTML Help Workshop;$(MSBuildToolsPath32);$(FxCopDir);$(PATH);</ExecutablePath>') \n if cfg.imagepath then \n _p(2, '<LayoutDir>%s</LayoutDir>', cfg.imagepath) \n else \n _p(2, '<LayoutDir>%s</LayoutDir>', prj.name) \n end \n if cfg.pullmappingfile ~= nil then \n _p(2,'<PullMappingFile>%s</PullMappingFile>', premake.esc(cfg.pullmappingfile)) \n end \n _p(2, '<LayoutExtensionFilter>*.pdb;*.ilk;*.exp;*.lib;*.winmd;*.appxrecipe;*.pri;*.idb</LayoutExtensionFilter>') \n _p(2, '<Isolate "
" ConfigurationsOnDeploy>true</IsolateConfigurationsOnDeploy>') \n end \n if cfg.kind ~= \" StaticLib \" then \n _p(2,'<LinkIncremental>%s</LinkIncremental>', tostring(premake.config.isincrementallink(cfg))) \n end \n if cfg.flags.NoManifest then \n _p(2,'<GenerateManifest>false</GenerateManifest>') \n end \n _p(1,'</PropertyGroup>') \n end \n end \n local function runtime(cfg) \n local runtime \n local flags = cfg.flags \n if premake.config.isdebugbuild(cfg) then \n runtime = iif(flags.StaticRuntime and not flags.Managed, \" MultiThreadedDebug \" , \" MultiThreadedDebugDLL \" ) \n else \n runtime = iif(flags.StaticRuntime and not flags.Managed, \" MultiThreaded \" , \" MultiThreadedDLL \" ) \n end \n return runtime \n end \n local function precompiled_header(cfg) \n if not cfg.flags.NoPCH and cfg.pchheader then \n _p(3,'<PrecompiledHeader>Use</PrecompiledHeader>') \n _p(3,'<PrecompiledHeaderFile>%s</PrecompiledHeaderFile>', cfg.pchheader) \n else \n _p(3,'<PrecompiledHeader></PrecompiledHeader>') \n end \n end \n local function preprocessor(indent,cfg) \n if #cfg.defines > 0 th "
" en \n _p(indent,'<PreprocessorDefinitions>%s;%%(PreprocessorDefinitions)</PreprocessorDefinitions>' \n ,premake.esc(table.concat(cfg.defines, \" ; \" ))) \n else \n _p(indent,'<PreprocessorDefinitions></PreprocessorDefinitions>') \n end \n end \n local function include_dirs(indent,cfg) \n local includedirs = table.join(cfg.userincludedirs, cfg.includedirs) \n if #includedirs> 0 then \n _p(indent,'<AdditionalIncludeDirectories>%s;%%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>' \n ,premake.esc(path.translate(table.concat(includedirs, \" ; \" ), ' \\ \\ '))) \n end \n end \n local function using_dirs(indent,cfg) \n if #cfg.usingdirs > 0 then \n _p(indent,'<AdditionalUsingDirectories>%s;%%(AdditionalUsingDirectories)</AdditionalUsingDirectories>' \n ,premake.esc(path.translate(table.concat(cfg.usingdirs, \" ; \" ), ' \\ \\ '))) \n end \n end \n local function resource_compile(cfg) \n _p(2,'<ResourceCompile>') \n preprocessor(3,cfg) \n include_dirs(3,cfg) \n _p(2,'</ResourceCompile>') \n end \n local function exceptions(cfg) \n if cfg.flags.NoExceptions then \n _p(3, "
" '<ExceptionHandling>false</ExceptionHandling>') \n elseif cfg.flags.SEH then \n _p(3, '<ExceptionHandling>Async</ExceptionHandling>') \n end \n end \n local function rtti(cfg) \n if cfg.flags.NoRTTI and not cfg.flags.Managed then \n _p(3,'<RuntimeTypeInfo>false</RuntimeTypeInfo>') \n end \n end \n local function calling_convention(cfg) \n if cfg.flags.FastCall then \n _p(3,'<CallingConvention>FastCall</CallingConvention>') \n elseif cfg.flags.StdCall then \n _p(3,'<CallingConvention>StdCall</CallingConvention>') \n end \n end \n local function wchar_t_builtin(cfg) \n if cfg.flags.NativeWChar then \n _p(3,'<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>') \n elseif cfg.flags.NoNativeWChar then \n _p(3,'<TreatWChar_tAsBuiltInType>false</TreatWChar_tAsBuiltInType>') \n end \n end \n local function sse(cfg) \n if cfg.flags.EnableSSE then \n _p(3, '<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>') \n elseif cfg.flags.EnableSSE2 then \n _p(3, '<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructio "
" nSet>') \n elseif cfg.flags.EnableAVX then \n _p(3, '<EnableEnhancedInstructionSet>AdvancedVectorExtensions</EnableEnhancedInstructionSet>') \n elseif cfg.flags.EnableAVX2 then \n _p(3, '<EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>') \n end \n end \n local function floating_point(cfg) \n if cfg.flags.FloatFast then \n _p(3,'<FloatingPointModel>Fast</FloatingPointModel>') \n elseif cfg.flags.FloatStrict and not cfg.flags.Managed then \n _p(3,'<FloatingPointModel>Strict</FloatingPointModel>') \n end \n end \n local function debug_info(cfg) \n local debug_info = '' \n if cfg.flags.Symbols then \n if cfg.flags.C7DebugInfo then \n debug_info = \" OldStyle \" \n elseif (action.vstudio.supports64bitEditContinue == false and cfg.platform == \" x64 \" ) \n or cfg.flags.Managed \n or premake.config.isoptimizedbuild(cfg.flags) \n or cfg.flags.NoEditAndContinue \n then \n debug_info = \" ProgramDatabase \" \n else \n debug_info = \" EditAndContinue \" \n end \n end \n _p(3,'<DebugInformationFormat>%s</DebugInformationFormat>',debug_info) \n en "
" d \n local function minimal_build(cfg) \n if premake.config.isdebugbuild(cfg) and cfg.flags.EnableMinimalRebuild then \n _p(3,'<MinimalRebuild>true</MinimalRebuild>') \n else \n _p(3,'<MinimalRebuild>false</MinimalRebuild>') \n end \n end \n local function compile_language(cfg) \n if cfg.options.ForceCPP then \n _p(3,'<CompileAs>CompileAsCpp</CompileAs>') \n else \n if cfg.language == \" C \" then \n _p(3,'<CompileAs>CompileAsC</CompileAs>') \n end \n end \n end \n local function forcedinclude_files(indent,cfg) \n if #cfg.forcedincludes > 0 then \n _p(indent,'<ForcedIncludeFiles>%s</ForcedIncludeFiles>' \n ,premake.esc(path.translate(table.concat(cfg.forcedincludes, \" ; \" ), ' \\ \\ '))) \n end \n end \n local function vs10_clcompile(cfg) \n _p(2,'<ClCompile>') \n local unsignedChar = \" /J \" \n local buildoptions = cfg.buildoptions \n if cfg.platform == \" Orbis \" then \n unsignedChar = \" -funsigned-char \" ; \n _p(3,'<GenerateDebugInformation>%s</GenerateDebugInformation>', tostring(cfg.flags.Symbols ~= nil)) \n end \n if cfg.language == \" C \" and not cfg.options.ForceCPP then "
" \n buildoptions = table.join(buildoptions, cfg.buildoptions_c) \n else \n buildoptions = table.join(buildoptions, cfg.buildoptions_cpp) \n end \n _p(3,'<AdditionalOptions>%s %s%%(AdditionalOptions)</AdditionalOptions>' \n , table.concat(premake.esc(buildoptions), \" \" ) \n , iif(cfg.flags.UnsignedChar, unsignedChar, \" \" ) \n ) \n _p(3,'<Optimization>%s</Optimization>',optimisation(cfg)) \n include_dirs(3, cfg) \n using_dirs(3, cfg) \n preprocessor(3, cfg) \n minimal_build(cfg) \n if not premake.config.isoptimizedbuild(cfg.flags) then \n if not cfg.flags.Managed then \n _p(3, '<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>') \n end \n if cfg.flags.ExtraWarnings then \n end \n else \n _p(3, '<StringPooling>true</StringPooling>') \n end \n if cfg.platform == \" Durango \" or cfg.flags.NoWinRT then \n _p(3, '<CompileAsWinRT>false</CompileAsWinRT>') \n end \n _p(3, '<RuntimeLibrary>%s</RuntimeLibrary>', runtime(cfg)) \n if cfg.flags.NoBufferSecurityCheck then \n _p(3, '<BufferSecurityCheck>false</BufferSecurityCheck>') \n end \n _p(3,'<FunctionLevelLinking>true< "
" /FunctionLevelLinking>') \n if not cfg.flags.NoMultiProcessorCompilation and not cfg.flags.EnableMinimalRebuild then \n _p(3, '<MultiProcessorCompilation>true</MultiProcessorCompilation>') \n else \n _p(3, '<MultiProcessorCompilation>false</MultiProcessorCompilation>') \n end \n precompiled_header(cfg) \n if cfg.flags.PedanticWarnings then \n _p(3, '<WarningLevel>EnableAllWarnings</WarningLevel>') \n elseif cfg.flags.ExtraWarnings then \n _p(3, '<WarningLevel>Level4</WarningLevel>') \n elseif cfg.flags.MinimumWarnings then \n _p(3, '<WarningLevel>Level1</WarningLevel>') \n else \n _p(3 ,'<WarningLevel>Level3</WarningLevel>') \n end \n if cfg.flags.FatalWarnings then \n _p(3, '<TreatWarningAsError>true</TreatWarningAsError>') \n end \n exceptions(cfg) \n rtti(cfg) \n calling_convention(cfg) \n wchar_t_builtin(cfg) \n sse(cfg) \n floating_point(cfg) \n debug_info(cfg) \n if _ACTION:sub(3) == \" llvm \" then \n _p(3,'<SupportJustMyCode>false</SupportJustMyCode>') \n end \n if cfg.flags.Symbols \n and _ACTION:sub(3) ~= \" 2017 \" and _ACTION:sub(3) ~= \" llvm \" \n then \n _p(3, '< "
" ProgramDataBaseFileName>$(OutDir)%s.pdb</ProgramDataBaseFileName>' \n , path.getbasename(cfg.buildtarget.name) \n ) \n end \n if cfg.flags.NoFramePointer then \n _p(3, '<OmitFramePointers>true</OmitFramePointers>') \n end \n if cfg.flags.UseFullPaths then \n _p(3, '<UseFullPaths>true</UseFullPaths>') \n end \n compile_language(cfg) \n forcedinclude_files(3,cfg); \n _p(2,'</ClCompile>') \n end \n local function event_hooks(cfg) \n if #cfg.postbuildcommands> 0 then \n _p(2,'<PostBuildEvent>') \n _p(3,'<Command>%s</Command>',premake.esc(table.implode(cfg.postbuildcommands, \" \" , \" \" , \" \\ r \\ n \" ))) \n _p(2,'</PostBuildEvent>') \n end \n if #cfg.prebuildcommands> 0 then \n _p(2,'<PreBuildEvent>') \n _p(3,'<Command>%s</Command>',premake.esc(table.implode(cfg.prebuildcommands, \" \" , \" \" , \" \\ r \\ n \" ))) \n _p(2,'</PreBuildEvent>') \n end \n if #cfg.prelinkcommands> 0 then \n _p(2,'<PreLinkEvent>') \n _p(3,'<Command>%s</Command>',premake.esc(table.implode(cfg.prelinkcommands, \" \" , \" \" , \" \\ r \\ n \" ))) \n _p(2,'</PreLinkEvent>') \n end \n end \n local function additio "
" nal_options(indent,cfg) \n if #cfg.linkoptions > 0 then \n _p(indent,'<AdditionalOptions>%s %%(AdditionalOptions)</AdditionalOptions>', \n table.concat(premake.esc(cfg.linkoptions), \" \" )) \n end \n end \n local function link_target_machine(index,cfg) \n local platforms = {x32 = 'MachineX86', x64 = 'MachineX64'} \n if platforms[cfg.platform] then \n _p(index,'<TargetMachine>%s</TargetMachine>', platforms[cfg.platform]) \n end \n end \n local function item_def_lib(prj, cfg) \n if cfg.kind == 'StaticLib' and cfg.platform ~= \" Xbox360 \" then \n _p(1,'<Lib>') \n _p(2,'<OutputFile>$(OutDir)%s</OutputFile>',cfg.buildtarget.name) \n additional_options(2,cfg) \n link_target_machine(2,cfg) \n if _ACTION:sub(3) == \" llvm \" and prj.name == \" portaudio \" then -- MSVC-LLVM needs special help \n _p(3,'<AdditionalDependencies>ksuser.lib;%%(AdditionalDependencies)</AdditionalDependencies>') \n end \n _p(1,'</Lib>') \n end \n end \n local function import_lib(cfg) \n if cfg.kind == \" SharedLib \" then \n local implibname = cfg.linktarget.fullpath \n _p(3,'<ImportLibrary>%s</Import "
" Library>',iif(cfg.flags.NoImportLib, cfg.objectsdir .. \" \\ \\ \" .. path.getname(implibname), implibname)) \n end \n end \n local function hasmasmfiles(prj) \n local files = vc2010.getfilegroup(prj, \" MASM \" ) \n return #files > 0 \n end \n local function vs10_masm(prj, cfg) \n if hasmasmfiles(prj) then \n _p(2, '<MASM>') \n _p(3,'<AdditionalOptions>%s %%(AdditionalOptions)</AdditionalOptions>' \n , table.concat(premake.esc(table.join(cfg.buildoptions, cfg.buildoptions_asm)), \" \" ) \n ) \n local includedirs = table.join(cfg.userincludedirs, cfg.includedirs) \n if #includedirs > 0 then \n _p(3, '<IncludePaths>%s;%%(IncludePaths)</IncludePaths>' \n , premake.esc(path.translate(table.concat(includedirs, \" ; \" ), ' \\ \\ ')) \n ) \n end \n local defines = table.join(cfg.defines) \n table.insertflat(defines, iif(premake.config.isdebugbuild(cfg), \" _DEBUG \" , {})) \n table.insert(defines, iif(cfg.platform == \" x64 \" , \" _WIN64 \" , \" _WIN32 \" )) \n table.insert(defines, iif(prj.kind == \" SharedLib \" , \" _EXPORT=EXPORT \" , \" _EXPORT= \" )) \n _p(3, '<PreprocessorDefinitions>% "
" s;%%(PreprocessorDefinitions)</PreprocessorDefinitions>' \n , premake.esc(table.concat(defines, \" ; \" )) \n ) \n if cfg.flags.FatalWarnings then \n _p(3,'<TreatWarningsAsErrors>true</TreatWarningsAsErrors>') \n end \n if cfg.flags.MinimumWarnings then \n _p(3,'<WarningLevel>0</WarningLevel>') \n else \n _p(3,'<WarningLevel>3</WarningLevel>') \n end \n _p(2, '</MASM>') \n end \n end \n function vc2010.link(cfg) \n _p(2,'<Link>') \n _p(3,'<SubSystem>%s</SubSystem>', iif(cfg.kind == \" ConsoleApp \" , \" Console \" , \" Windows \" )) \n _p(3,'<GenerateDebugInformation>%s</GenerateDebugInformation>', \n iif(cfg.flags.Symbols ~= nil, iif(_ACTION:sub(3) ~= \" llvm \" , \" true \" , \" DebugFull \" ), \" false \" ) \n ) \n if cfg.flags.Symbols \n and (_ACTION:sub(3) == \" 2017 \" or _ACTION:sub(3) == \" llvm \" ) \n then \n _p(3, '<ProgramDataBaseFileName>$(OutDir)%s.pdb</ProgramDataBaseFileName>' \n , path.getbasename(cfg.buildtarget.name) \n ) \n end \n if premake.config.isoptimizedbuild(cfg.flags) then \n _p(3,'<EnableCOMDATFolding>true</EnableCOMDATFolding>') \n _p(3,'<OptimizeReferences>true</O "
" ptimizeReferences>') \n end \n if cfg.kind ~= 'StaticLib' then \n vc2010.additionalDependencies(3,cfg) \n _p(3,'<OutputFile>$(OutDir)%s</OutputFile>', cfg.buildtarget.name) \n if #cfg.libdirs > 0 then \n _p(3,'<AdditionalLibraryDirectories>%s;%%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>' \n , premake.esc(path.translate(table.concat(cfg.libdirs, ';'), ' \\ \\ ')) \n ) \n end \n if vc2010.config_type(cfg) == 'Application' and not cfg.flags.WinMain and not cfg.flags.Managed then \n if cfg.flags.Unicode then \n _p(3,'<EntryPointSymbol>wmainCRTStartup</EntryPointSymbol>') \n else \n _p(3,'<EntryPointSymbol>mainCRTStartup</EntryPointSymbol>') \n end \n end \n import_lib(cfg) \n local deffile = premake.findfile(cfg, \" .def \" ) \n if deffile then \n _p(3,'<ModuleDefinitionFile>%s</ModuleDefinitionFile>', deffile) \n end \n link_target_machine(3,cfg) \n additional_options(3,cfg) \n if cfg.flags.NoWinMD and vstudio.iswinrt() and prj.kind == \" WindowedApp \" then \n _p(3,'<GenerateWindowsMetadata>false</GenerateWindowsMetadata>' ) \n end \n end \n _p(2,'</Link>' "
" ) \n end \n function vc2010.additionalDependencies(tab,cfg) \n local links = premake.getlinks(cfg, \" system \" , \" fullpath \" ) \n if #links > 0 then \n local deps = \" \" \n if cfg.platform == \" Orbis \" then \n for _, v in ipairs(links) do \n deps = deps .. \" -l \" .. v .. \" ; \" \n end \n else \n deps = table.concat(links, \" ; \" ) \n end \n _p(tab, '<AdditionalDependencies>%s;%s</AdditionalDependencies>' \n , deps \n , iif(cfg.platform == \" Durango \" \n , '%(XboxExtensionsDependencies)' \n , '%(AdditionalDependencies)' \n ) \n ) \n elseif cfg.platform == \" Durango \" then \n _p(tab, '<AdditionalDependencies>%%(XboxExtensionsDependencies)</AdditionalDependencies>') \n end \n end \n local function item_definitions(prj) \n for _, cfginfo in ipairs(prj.solution.vstudio_configs) do \n local cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform) \n _p(1,'<ItemDefinitionGroup ' ..if_config_and_platform() ..'>' \n ,premake.esc(cfginfo.name)) \n vs10_clcompile(cfg) \n resource_compile(cfg) \n item_def_lib(prj, cfg) \n vc2010.link(cfg) \n event_hooks(cfg) \n vs10_masm(prj, c "
" fg) \n _p(1,'</ItemDefinitionGroup>') \n end \n end \n function vc2010.getfilegroup(prj, group) \n local sortedfiles = prj.vc2010sortedfiles \n if not sortedfiles then \n sortedfiles = { \n ClCompile = {}, \n ClInclude = {}, \n MASM = {}, \n None = {}, \n ResourceCompile = {}, \n AppxManifest = {}, \n Natvis = {}, \n Image = {}, \n DeploymentContent = {} \n } \n local foundAppxManifest = false \n for file in premake.project.eachfile(prj, true) do \n if path.issourcefilevs(file.name) then \n table.insert(sortedfiles.ClCompile, file) \n elseif path.iscppheader(file.name) then \n if not table.icontains(prj.removefiles, file) then \n table.insert(sortedfiles.ClInclude, file) \n end \n elseif path.isresourcefile(file.name) then \n table.insert(sortedfiles.ResourceCompile, file) \n elseif path.isimagefile(file.name) then \n table.insert(sortedfiles.Image, file) \n elseif path.isappxmanifest(file.name) then \n foundAppxManifest = true \n table.insert(sortedfiles.AppxManifest, file) \n elseif path.isnatvis(file.name) then \n table.insert(sortedfiles.Natvis, file) \n elseif path.isasmfil "
" e(file.name) then \n table.insert(sortedfiles.MASM, file) \n elseif file.flags and table.icontains(file.flags, \" DeploymentContent \" ) then \n table.insert(sortedfiles.DeploymentContent, file) \n else \n table.insert(sortedfiles.None, file) \n end \n end \n if vstudio.iswinrt() and prj.kind == \" WindowedApp \" and not foundAppxManifest then \n vstudio.needAppxManifest = true \n local fcfg = {} \n fcfg.name = prj.name .. \" /Package.appxmanifest \" \n fcfg.vpath = premake.project.getvpath(prj, fcfg.name) \n table.insert(sortedfiles.AppxManifest, fcfg) \n local logo = {} \n logo.name = prj.name .. \" /Logo.png \" \n logo.vpath = logo.name \n table.insert(sortedfiles.Image, logo) \n local smallLogo = {} \n smallLogo.name = prj.name .. \" /SmallLogo.png \" \n smallLogo.vpath = smallLogo.name \n table.insert(sortedfiles.Image, smallLogo) \n local storeLogo = {} \n storeLogo.name = prj.name .. \" /StoreLogo.png \" \n storeLogo.vpath = storeLogo.name \n table.insert(sortedfiles.Image, storeLogo) \n local splashScreen = {} \n splashScreen.name = prj.name .. \" /SplashScreen.png "
" \" \n splashScreen.vpath = splashScreen.name \n table.insert(sortedfiles.Image, splashScreen) \n end \n prj.vc2010sortedfiles = sortedfiles \n end \n return sortedfiles[group] \n end \n function vc2010.files(prj) \n vc2010.simplefilesgroup(prj, \" ClInclude \" ) \n vc2010.compilerfilesgroup(prj) \n vc2010.simplefilesgroup(prj, \" None \" ) \n vc2010.customtaskgroup(prj) \n vc2010.simplefilesgroup(prj, \" ResourceCompile \" ) \n vc2010.simplefilesgroup(prj, \" AppxManifest \" ) \n vc2010.simplefilesgroup(prj, \" Natvis \" ) \n vc2010.deploymentcontentgroup(prj, \" Image \" ) \n vc2010.deploymentcontentgroup(prj, \" DeploymentContent \" , \" None \" ) \n end \n function vc2010.customtaskgroup(prj) \n local files = { } \n for _, custombuildtask in ipairs(prj.custombuildtask or {}) do \n for _, buildtask in ipairs(custombuildtask or {}) do \n local fcfg = { } \n fcfg.name = path.getrelative(prj.location,buildtask[1]) \n fcfg.vpath = path.trimdots(fcfg.name) \n table.insert(files, fcfg) \n end \n end \n if #files > 0 then \n _p(1,'<ItemGroup>') \n local groupedBuildTasks = {} \n for _, custombuildtas "
" k in ipairs(prj.custombuildtask or {}) do \n for _, buildtask in ipairs(custombuildtask or {}) do \n if (groupedBuildTasks[buildtask[1]] == nil) then \n groupedBuildTasks[buildtask[1]] = {} \n end \n table.insert(groupedBuildTasks[buildtask[1]], buildtask) \n end \n end \n for name, custombuildtask in pairs(groupedBuildTasks or {}) do \n _p(2,'<CustomBuild Include= \\ \" %s \\ \" >', path.translate(path.getrelative(prj.location,name), \" \\ \\ \" )) \n _p(3,'<FileType>Text</FileType>') \n local cmd = \" \" \n local outputs = \" \" \n for _, buildtask in ipairs(custombuildtask or {}) do \n for _, cmdline in ipairs(buildtask[4] or {}) do \n cmd = cmd .. cmdline \n local num = 1 \n for _, depdata in ipairs(buildtask[3] or {}) do \n cmd = string.gsub(cmd, \" %$%( \" .. num .. \" %) \" , string.format( \" %s \" ,path.getrelative(prj.location,depdata))) \n num = num + 1 \n end \n cmd = string.gsub(cmd, \" %$%(<%) \" , string.format( \" %s \" ,path.getrelative(prj.location,buildtask[1]))) \n cmd = string.gsub(cmd, \" %$%(@%) \" , string.format( \" %s \" ,path.getrelative(prj.location,buildtask "
" [2]))) \n cmd = cmd .. \" \\ r \\ n \" \n end \n outputs = outputs .. path.getrelative(prj.location,buildtask[2]) .. \" ; \" \n end \n _p(3,'<Command>%s</Command>',cmd) \n _p(3,'<Outputs>%s%%(Outputs)</Outputs>',outputs) \n _p(3,'<SubType>Designer</SubType>') \n _p(3,'<Message></Message>') \n _p(2,'</CustomBuild>') \n end \n _p(1,'</ItemGroup>') \n end \n end \n function vc2010.simplefilesgroup(prj, section, subtype) \n local files = vc2010.getfilegroup(prj, section) \n if #files > 0 then \n _p(1,'<ItemGroup>') \n for _, file in ipairs(files) do \n if subtype then \n _p(2,'<%s Include= \\ \" %s \\ \" >', section, path.translate(file.name, \" \\ \\ \" )) \n _p(3,'<SubType>%s</SubType>', subtype) \n _p(2,'</%s>', section) \n else \n _p(2,'<%s Include= \\ \" %s \\ \" />', section, path.translate(file.name, \" \\ \\ \" )) \n end \n end \n _p(1,'</ItemGroup>') \n end \n end \n function vc2010.deploymentcontentgroup(prj, section, filetype) \n if filetype == nil then \n filetype = section \n end \n local files = vc2010.getfilegroup(prj, section) \n if #files > 0 then \n _p(1,'<ItemGroup>') \n for _, file in ipair "
" s(files) do \n _p(2,'<%s Include= \\ \" %s \\ \" >', filetype, path.translate(file.name, \" \\ \\ \" )) \n _p(3,'<DeploymentContent>true</DeploymentContent>') \n _p(3,'<Link>%s</Link>', path.translate(file.vpath, \" \\ \\ \" )) \n _p(2,'</%s>', filetype) \n end \n _p(1,'</ItemGroup>') \n end \n end \n function vc2010.compilerfilesgroup(prj) \n local configs = prj.solution.vstudio_configs \n local files = vc2010.getfilegroup(prj, \" ClCompile \" ) \n if #files > 0 then \n local config_mappings = {} \n for _, cfginfo in ipairs(configs) do \n local cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform) \n if cfg.pchheader and cfg.pchsource and not cfg.flags.NoPCH then \n config_mappings[cfginfo] = path.translate(cfg.pchsource, \" \\ \\ \" ) \n end \n end \n _p(1,'<ItemGroup>') \n for _, file in ipairs(files) do \n local translatedpath = path.translate(file.name, \" \\ \\ \" ) \n _p(2, '<ClCompile Include= \\ \" %s \\ \" >', translatedpath) \n _p(3, '<ObjectFileName>$(IntDir)%s \\ \\ </ObjectFileName>' \n , premake.esc(path.translate(path.trimdots(path.getdirectory(file.name))) "
" ) \n ) \n if path.iscxfile(file.name) then \n _p(3, '<CompileAsWinRT>true</CompileAsWinRT>') \n _p(3, '<RuntimeTypeInfo>true</RuntimeTypeInfo>') \n _p(3, '<PrecompiledHeader>NotUsing</PrecompiledHeader>') \n end \n if vstudio.iswinrt() and string.len(file.name) > 2 and string.sub(file.name, -2) == \" .c \" then \n _p(3,'<CompileAsWinRT>FALSE</CompileAsWinRT>') \n end \n for _, cfginfo in ipairs(configs) do \n if config_mappings[cfginfo] and translatedpath == config_mappings[cfginfo] then \n _p(3,'<PrecompiledHeader '.. if_config_and_platform() .. '>Create</PrecompiledHeader>', premake.esc(cfginfo.name)) \n config_mappings[cfginfo] = nil --only one source file per pch \n end \n end \n local nopch = table.icontains(prj.nopch, file.name) \n for _, vsconfig in ipairs(configs) do \n local cfg = premake.getconfig(prj, vsconfig.src_buildcfg, vsconfig.src_platform) \n if nopch or table.icontains(cfg.nopch, file.name) then \n _p(3,'<PrecompiledHeader '.. if_config_and_platform() .. '>NotUsing</PrecompiledHeader>', premake.esc(vsconfig.name)) \n end \n end \n local "
" excluded = table.icontains(prj.excludes, file.name) \n for _, vsconfig in ipairs(configs) do \n local cfg = premake.getconfig(prj, vsconfig.src_buildcfg, vsconfig.src_platform) \n local fileincfg = table.icontains(cfg.files, file.name) \n local cfgexcluded = table.icontains(cfg.excludes, file.name) \n if excluded or not fileincfg or cfgexcluded then \n _p(3, '<ExcludedFromBuild ' \n .. if_config_and_platform() \n .. '>true</ExcludedFromBuild>' \n , premake.esc(vsconfig.name) \n ) \n end \n end \n if prj.flags and prj.flags.Managed then \n local prjforcenative = table.icontains(prj.forcenative, file.name) \n for _,vsconfig in ipairs(configs) do \n local cfg = premake.getconfig(prj, vsconfig.src_buildcfg, vsconfig.src_platform) \n if prjforcenative or table.icontains(cfg.forcenative, file.name) then \n _p(3, '<CompileAsManaged ' .. if_config_and_platform() .. '>false</CompileAsManaged>', premake.esc(vsconfig.name)) \n end \n end \n end \n _p(2,'</ClCompile>') \n end \n _p(1,'</ItemGroup>') \n end \n end \n function vc2010.masmfiles(prj) \n local configs = prj.solutio "
" n.vstudio_configs \n local files = vc2010.getfilegroup(prj, \" MASM \" ) \n if #files > 0 then \n _p(1, '<ItemGroup>') \n for _, file in ipairs(files) do \n local translatedpath = path.translate(file.name, \" \\ \\ \" ) \n _p(2, '<MASM Include= \" %s \" >', translatedpath) \n local excluded = table.icontains(prj.excludes, file.name) \n for _, vsconfig in ipairs(configs) do \n local cfg = premake.getconfig(prj, vsconfig.src_buildcfg, vsconfig.src_platform) \n local fileincfg = table.icontains(cfg.files, file.name) \n local cfgexcluded = table.icontains(cfg.excludes, file.name) \n if excluded or not fileincfg or cfgexcluded then \n _p(3, '<ExcludedFromBuild ' \n .. if_config_and_platform() \n .. '>true</ExcludedFromBuild>' \n , premake.esc(vsconfig.name) \n ) \n end \n end \n _p(2, '</MASM>') \n end \n _p(1, '</ItemGroup>') \n end \n end \n function vc2010.header(targets) \n io.eol = \" \\ r \\ n \" \n _p('<?xml version= \" 1.0 \" encoding= \" utf-8 \" ?>') \n local t = \" \" \n if targets then \n t = ' DefaultTargets= \" ' .. targets .. ' \" ' \n end \n _p('<Project%s ToolsVersion= \" %s \" xmlns= \" http: "
" //schemas.microsoft.com/developer/msbuild/2003 \" >', t, action.vstudio.toolsVersion) \n end \n function premake.vs2010_vcxproj(prj) \n local usemasm = hasmasmfiles(prj) \n io.indent = \" \" \n vc2010.header( \" Build \" ) \n vs2010_config(prj) \n vs2010_globals(prj) \n _p(1,'<Import Project= \" $(VCTargetsPath) \\ \\ Microsoft.Cpp.Default.props \" />') \n for _, cfginfo in ipairs(prj.solution.vstudio_configs) do \n local cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform) \n vc2010.configurationPropertyGroup(cfg, cfginfo) \n end \n _p(1,'<Import Project= \" $(VCTargetsPath) \\ \\ Microsoft.Cpp.props \" />') \n _p(1,'<ImportGroup Label= \" ExtensionSettings \" >') \n if usemasm then \n _p(2, '<Import Project= \" $(VCTargetsPath) \\ \\ BuildCustomizations \\ \\ masm.props \" />') \n end \n _p(1,'</ImportGroup>') \n import_props(prj) \n _p(1,'<PropertyGroup Label= \" UserMacros \" />') \n vc2010.outputProperties(prj) \n item_definitions(prj) \n if prj.flags.Managed then \n vc2010.clrReferences(prj) \n end \n vc2010.files(prj) \n vc2010.projectReferences(prj) \n vc2010.sdkReferen "
" ces(prj) \n vc2010.masmfiles(prj) \n _p(1,'<Import Project= \" $(VCTargetsPath) \\ \\ Microsoft.Cpp.targets \" />') \n _p(1,'<ImportGroup Label= \" ExtensionTargets \" >') \n if usemasm then \n _p(2, '<Import Project= \" $(VCTargetsPath) \\ \\ BuildCustomizations \\ \\ masm.targets \" />') \n end \n _p(1,'</ImportGroup>') \n _p('</Project>') \n end \n function vc2010.clrReferences(prj) \n if #prj.clrreferences == 0 then \n return \n end \n _p(1,'<ItemGroup>') \n for _, ref in ipairs(prj.clrreferences) do \n if os.isfile(ref) then \n local assembly = path.getbasename(ref) \n _p(2,'<Reference Include= \" %s \" >', assembly) \n _p(3,'<HintPath>%s</HintPath>', path.getrelative(prj.location, ref)) \n _p(2,'</Reference>') \n else \n _p(2,'<Reference Include= \" %s \" />', ref) \n end \n end \n _p(1,'</ItemGroup>') \n end \n function vc2010.projectReferences(prj) \n local deps = premake.getdependencies(prj) \n if #deps == 0 and #prj.vsimportreferences == 0 then \n return \n end \n _p(1,'<ItemGroup>') \n for _, dep in ipairs(deps) do \n local deppath = path.getrelative(prj.location, vstudio.projectfile(dep)) \n "
" _p(2,'<ProjectReference Include= \\ \" %s \\ \" >', path.translate(deppath, \" \\ \\ \" )) \n _p(3,'<Project>{%s}</Project>', dep.uuid) \n if vstudio.iswinrt() then \n _p(3,'<ReferenceOutputAssembly>false</ReferenceOutputAssembly>') \n end \n _p(2,'</ProjectReference>') \n end \n for _, ref in ipairs(prj.vsimportreferences) do \n local iprj = premake.vstudio.getimportprj(ref, prj.solution) \n _p(2,'<ProjectReference Include= \\ \" %s \\ \" >', iprj.relpath) \n _p(3,'<Project>{%s}</Project>', iprj.uuid) \n _p(2,'</ProjectReference>') \n end \n _p(1,'</ItemGroup>') \n end \n function vc2010.sdkReferences(prj) \n local refs = prj.sdkreferences \n if #refs > 0 then \n _p(1,'<ItemGroup>') \n for _, ref in ipairs(refs) do \n _p(2,'<SDKReference Include= \\ \" %s \\ \" />', ref) \n end \n _p(1,'</ItemGroup>') \n end \n end \n function vc2010.debugdir(cfg) \n local debuggerFlavor = \n iif(cfg.platform == \" Orbis \" , 'ORBISDebugger' \n , iif(cfg.platform == \" Durango \" , 'XboxOneVCppDebugger' \n , 'WindowsLocalDebugger' \n )) \n _p(2, '<DebuggerFlavor>%s</DebuggerFlav "
" or>', debuggerFlavor) \n if cfg.debugdir and not vstudio.iswinrt() then \n _p(2, '<LocalDebuggerWorkingDirectory>%s</LocalDebuggerWorkingDirectory>' \n , path.translate(cfg.debugdir, ' \\ \\ ') \n ) \n end \n if cfg.debugargs then \n _p(2, '<LocalDebuggerCommandArguments>%s</LocalDebuggerCommandArguments>' \n , table.concat(cfg.debugargs, \" \" ) \n ) \n end \n if cfg.debugenvs and #cfg.debugenvs > 0 then \n _p(2, '<LocalDebuggerEnvironment>%s%s</LocalDebuggerEnvironment>' \n , table.concat(cfg.debugenvs, \" \\ n \" ) \n , iif(cfg.flags.DebugEnvsInherit,' \\ n$(LocalDebuggerEnvironment)', '') \n ) \n if cfg.flags.DebugEnvsDontMerge then \n _p(2, '<LocalDebuggerMergeEnvironment>false</LocalDebuggerMergeEnvironment>') \n end \n end \n if cfg.deploymode then \n _p(' <DeployMode>%s</DeployMode>', cfg.deploymode) \n end \n end \n function premake.vs2010_vcxproj_user(prj) \n io.indent = \" \" \n vc2010.header() \n for _, cfginfo in ipairs(prj.solution.vstudio_configs) do \n local cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform) \n _p(' <PropertyGroup '.. "
" if_config_and_platform() ..'>', premake.esc(cfginfo.name)) \n vc2010.debugdir(cfg) \n _p(' </PropertyGroup>') \n end \n _p('</Project>') \n end \n local png1x1data = { \n 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, -- .PNG........IHDR \n 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x03, 0x00, 0x00, 0x00, 0x25, 0xdb, 0x56, -- .............%.V \n 0xca, 0x00, 0x00, 0x00, 0x03, 0x50, 0x4c, 0x54, 0x45, 0x00, 0x00, 0x00, 0xa7, 0x7a, 0x3d, 0xda, -- .....PLTE....z=. \n 0x00, 0x00, 0x00, 0x01, 0x74, 0x52, 0x4e, 0x53, 0x00, 0x40, 0xe6, 0xd8, 0x66, 0x00, 0x00, 0x00, -- ....tRNS.@..f... \n 0x0a, 0x49, 0x44, 0x41, 0x54, 0x08, 0xd7, 0x63, 0x60, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0xe2, -- .IDAT..c`....... \n 0x21, 0xbc, 0x33, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82, -- !.3....IEND.B`. \n } \n function png1x1(obj, filename) \n filename = premake.project.getfilename(obj, filename) \n local f, err = io.open(filename, \" wb \" ) \n if f then \n for _, byte in ipairs( "
" png1x1data) do \n f:write(string.char(byte)) \n end \n f:close() \n end \n end \n function premake.vs2010_appxmanifest(prj) \n io.indent = \" \" \n io.eol = \" \\ r \\ n \" \n _p('<?xml version= \" 1.0 \" encoding= \" utf-8 \" ?>') \n if vstudio.toolset == \" v120_wp81 \" then \n _p('<Package xmlns= \" http://schemas.microsoft.com/appx/2010/manifest \" xmlns:m2= \" http://schemas.microsoft.com/appx/2013/manifest \" xmlns:m3= \" http://schemas.microsoft.com/appx/2014/manifest \" xmlns:mp= \" http://schemas.microsoft.com/appx/2014/phone/manifest \" >') \n elseif vstudio.storeapp == \" 8.1 \" then \n _p('<Package xmlns= \" http://schemas.microsoft.com/appx/2010/manifest \" xmlns:m3= \" http://schemas.microsoft.com/appx/2013/manifest \" >') \n elseif vstudio.storeapp == \" durango \" then \n _p('<Package xmlns= \" http://schemas.microsoft.com/appx/2010/manifest \" xmlns:mx= \" http://schemas.microsoft.com/appx/2013/xbox/manifest \" IgnorableNamespaces= \" mx \" >') \n else \n _p('<Package xmlns= \" http://schemas.microsoft.com/appx/manifest/foundation/windows10 \" xmlns:mp= \" http://schemas.micros "
" oft.com/appx/2014/phone/manifest \" xmlns:m3= \" http://schemas.microsoft.com/appx/manifest/uap/windows10 \" >') \n end \n _p(1,'<Identity Name= \" ' .. prj.uuid .. ' \" ') \n _p(2,'Publisher= \" CN=Publisher \" ') \n _p(2,'Version= \" 1.0.0.0 \" />') \n if vstudio.toolset == \" v120_wp81 \" or vstudio.storeapp == \" 8.2 \" then \n _p(1,'<mp:PhoneIdentity PhoneProductId= \" ' .. prj.uuid .. ' \" PhonePublisherId= \" 00000000-0000-0000-0000-000000000000 \" />') \n end \n _p(1, '<Properties>') \n _p(2, '<DisplayName>' .. prj.name .. '</DisplayName>') \n _p(2, '<PublisherDisplayName>PublisherDisplayName</PublisherDisplayName>') \n _p(2, '<Logo>' .. prj.name .. ' \\ \\ StoreLogo.png</Logo>') \n png1x1(prj, \" %%/StoreLogo.png \" ) \n _p(2, '<Description>' .. prj.name .. '</Description>') \n _p(1,'</Properties>') \n if vstudio.storeapp == \" 8.2 \" then \n _p(1, '<Dependencies>') \n _p(2, '<TargetDeviceFamily Name= \" Windows.Universal \" MinVersion= \" 10.0.10069.0 \" MaxVersionTested= \" 10.0.10069.0 \" />') \n _p(1, '</Dependencies>') \n elseif vstudio.storeapp == \" durango \" then \n _p(1, '<Pr "
" erequisites>') \n _p(2, '<OSMinVersion>6.2</OSMinVersion>') \n _p(2, '<OSMaxVersionTested>6.2</OSMaxVersionTested>') \n _p(1, '</Prerequisites>') \n else \n _p(1, '<Prerequisites>') \n _p(2, '<OSMinVersion>6.3.0</OSMinVersion>') \n _p(2, '<OSMaxVersionTested>6.3.0</OSMaxVersionTested>') \n _p(1, '</Prerequisites>') \n end \n _p(1,'<Resources>') \n _p(2,'<Resource Language= \" en-us \" />') \n _p(1,'</Resources>') \n _p(1,'<Applications>') \n _p(2,'<Application Id= \" App \" ') \n _p(3,'Executable= \" $targetnametoken$.exe \" ') \n _p(3,'EntryPoint= \" ' .. prj.name .. '.App \" >') \n if vstudio.storeapp == \" durango \" then \n _p(3, '<VisualElements') \n _p(4, 'DisplayName= \" ' .. prj.name .. ' \" ') \n _p(4, 'Logo= \" ' .. prj.name .. ' \\ \\ Logo.png \" ') \n png1x1(prj, \" %%/Logo.png \" ) \n _p(4, 'SmallLogo= \" ' .. prj.name .. ' \\ \\ SmallLogo.png \" ') \n png1x1(prj, \" %%/SmallLogo.png \" ) \n _p(4, 'Description= \" ' .. prj.name .. ' \" ') \n _p(4, 'ForegroundText= \" light \" ') \n _p(4, 'BackgroundColor= \" transparent \" >') \n _p(5, '<SplashScreen Image= \" ' .. prj.name .. ' \\ \\ SplashScreen.png \" />') "
" \n png1x1(prj, \" %%/SplashScreen.png \" ) \n _p(3, '</VisualElements>') \n _p(3, '<Extensions>') \n _p(4, '<mx:Extension Category= \" xbox.system.resources \" >') \n _p(4, '<mx:XboxSystemResources />') \n _p(4, '</mx:Extension>') \n _p(3, '</Extensions>') \n else \n _p(3, '<m3:VisualElements') \n _p(4, 'DisplayName= \" ' .. prj.name .. ' \" ') \n _p(4, 'Square150x150Logo= \" ' .. prj.name .. ' \\ \\ Logo.png \" ') \n png1x1(prj, \" %%/Logo.png \" ) \n if vstudio.toolset == \" v120_wp81 \" or vstudio.storeapp == \" 8.2 \" then \n _p(4, 'Square44x44Logo= \" ' .. prj.name .. ' \\ \\ SmallLogo.png \" ') \n png1x1(prj, \" %%/SmallLogo.png \" ) \n else \n _p(4, 'Square30x30Logo= \" ' .. prj.name .. ' \\ \\ SmallLogo.png \" ') \n png1x1(prj, \" %%/SmallLogo.png \" ) \n end \n _p(4, 'Description= \" ' .. prj.name .. ' \" ') \n _p(4, 'ForegroundText= \" light \" ') \n _p(4, 'BackgroundColor= \" transparent \" >') \n _p(4, '<m3:SplashScreen Image= \" ' .. prj.name .. ' \\ \\ SplashScreen.png \" />') \n png1x1(prj, \" %%/SplashScreen.png \" ) \n _p(3, '</m3:VisualElements>') \n end \n _p(2,'</Application>') \n _p(1,'</Applications>') \n _p( "
" '</Package>') \n end \n " ,
" premake.vstudio.vc2010 = { } \n local vc2010 = premake.vstudio.vc2010 \n local vstudio = premake.vstudio \n local function vs2010_config(prj) \n for _, cfginfo in ipairs(prj.solution.vstudio_configs) do \n if cfginfo.src_platform == \" TegraAndroid \" then \n _p(1,'<PropertyGroup Label= \" NsightTegraProject \" >') \n _p(2,'<NsightTegraProjectRevisionNumber>11</NsightTegraProjectRevisionNumber>') \n _p(1,'</PropertyGroup>') \n break \n end \n end \n _p(1,'<ItemGroup Label= \" ProjectConfigurations \" >') \n for _, cfginfo in ipairs(prj.solution.vstudio_configs) do \n _p(2,'<ProjectConfiguration Include= \" %s \" >', premake.esc(cfginfo.name)) \n _p(3,'<Configuration>%s</Configuration>',cfginfo.buildcfg) \n _p(3,'<Platform>%s</Platform>',cfginfo.platform) \n _p(2,'</ProjectConfiguration>') \n end \n _p(1,'</ItemGroup>') \n end \n local function vs2010_globals(prj) \n local action = premake.action.current() \n _p(1,'<PropertyGroup Label= \" Globals \" >') \n _p(2, '<ProjectGuid>{%s}</ProjectGuid>',prj.uuid) \n _p(2, '<RootNamespace>%s</RootNamespace>',prj.name) \n if vstudio.store "
" app ~= \" durango \" then \n local windowsTargetPlatformVersion = prj.windowstargetplatformversion or action.vstudio.windowsTargetPlatformVersion \n if windowsTargetPlatformVersion ~= nil then \n _p(2,'<WindowsTargetPlatformVersion>%s</WindowsTargetPlatformVersion>',windowsTargetPlatformVersion) \n if windowsTargetPlatformVersion and string.startswith(windowsTargetPlatformVersion, \" 10. \" ) then \n _p(2,'<WindowsTargetPlatformMinVersion>%s</WindowsTargetPlatformMinVersion>', prj.windowstargetplatformminversion or \" 10.0.10240.0 \" ) \n end \n end \n end \n if prj.flags and prj.flags.Managed then \n local frameworkVersion = prj.framework or \" 4.0 \" \n _p(2, '<TargetFrameworkVersion>v%s</TargetFrameworkVersion>', frameworkVersion) \n _p(2, '<Keyword>ManagedCProj</Keyword>') \n elseif vstudio.iswinrt() then \n _p(2, '<DefaultLanguage>en-US</DefaultLanguage>') \n if vstudio.storeapp == \" durango \" then \n _p(2, '<Keyword>Win32Proj</Keyword>') \n _p(2, '<ApplicationEnvironment>title</ApplicationEnvironment>') \n _p(2, '<MinimumVisualStudioVersion>14.0</Mi "
" nimumVisualStudioVersion>') \n _p(2, '<TargetRuntime>Native</TargetRuntime>') \n else \n _p(2, '<AppContainerApplication>true</AppContainerApplication>') \n _p(2, '<MinimumVisualStudioVersion>12.0</MinimumVisualStudioVersion>') \n _p(2, '<ApplicationType>Windows Store</ApplicationType>') \n _p(2, '<ApplicationTypeRevision>%s</ApplicationTypeRevision>', vstudio.storeapp) \n end \n else \n _p(2, '<Keyword>Win32Proj</Keyword>') \n end \n if _ACTION:sub(3) == \" 2015 \" or _ACTION:sub(3) == \" 2017 \" or _ACTION:sub(3) == \" llvm \" then \n _p(2,'<PreferredToolArchitecture>x64</PreferredToolArchitecture>') \n end \n if (_ACTION:sub(3) == \" 2017 \" or _ACTION:sub(3) == \" llvm \" ) \n and os.isdir(path.join(os.getenv( \" VSINSTALLDIR \" ), \" VC/Tools/MSVC/14.14.26428 \" )) then \n _p(2,'<VCToolsVersion>14.14.26428</VCToolsVersion>') \n end \n if not vstudio.xpwarning then \n _p(2, '<XPDeprecationWarning>false</XPDeprecationWarning>') \n end \n _p(1,'</PropertyGroup>') \n end \n function vc2010.config_type(config) \n local t = \n { \n SharedLib = \" DynamicLibrary \" , \n StaticLib = \" S "
" taticLibrary \" , \n ConsoleApp = \" Application \" , \n WindowedApp = \" Application \" \n } \n return t[config.kind] \n end \n local function if_config_and_platform() \n return 'Condition= \" \\ '$(Configuration)|$(Platform) \\ '== \\ '%s \\ ' \" ' \n end \n local function optimisation(cfg) \n local result = \" Disabled \" \n for _, value in ipairs(cfg.flags) do \n if (value == \" Optimize \" ) then \n result = \" Full \" \n elseif (value == \" OptimizeSize \" ) then \n result = \" MinSpace \" \n elseif (value == \" OptimizeSpeed \" ) then \n result = \" MaxSpeed \" \n end \n end \n return result \n end \n function vc2010.configurationPropertyGroup(cfg, cfginfo) \n _p(1, '<PropertyGroup '..if_config_and_platform() ..' Label= \" Configuration \" >' \n , premake.esc(cfginfo.name)) \n local is2019 = premake.action.current() == premake.action.get( \" vs2019 \" ) \n if is2019 then \n _p(2, '<VCProjectVersion>%s</VCProjectVersion>', action.vstudio.toolsVersion) \n if cfg.flags.UnitySupport then \n _p(2, '<EnableUnitySupport>true</EnableUnitySupport>') \n end \n end \n _p(2, '<ConfigurationType>%s</Configuration "
" Type>', vc2010.config_type(cfg)) \n _p(2, '<UseDebugLibraries>%s</UseDebugLibraries>', iif(optimisation(cfg) == \" Disabled \" , \" true \" , \" false \" )) \n _p(2, '<PlatformToolset>%s</PlatformToolset>', premake.vstudio.toolset) \n if os.is64bit() then \n _p(2, '<PreferredToolArchitecture>x64</PreferredToolArchitecture>') \n end \n if cfg.flags.MFC then \n _p(2,'<UseOfMfc>%s</UseOfMfc>', iif(cfg.flags.StaticRuntime, \" Static \" , \" Dynamic \" )) \n end \n if cfg.flags.ATL or cfg.flags.StaticATL then \n _p(2,'<UseOfAtl>%s</UseOfAtl>', iif(cfg.flags.StaticATL, \" Static \" , \" Dynamic \" )) \n end \n if cfg.flags.Unicode then \n _p(2,'<CharacterSet>Unicode</CharacterSet>') \n end \n if cfg.flags.Managed then \n _p(2,'<CLRSupport>true</CLRSupport>') \n end \n if cfg.platform == \" TegraAndroid \" then \n if cfg.androidtargetapi then \n _p(2,'<AndroidTargetAPI>android-%s</AndroidTargetAPI>', cfg.androidtargetapi) \n end \n if cfg.androidminapi then \n _p(2,'<AndroidMinAPI>android-%s</AndroidMinAPI>', cfg.androidminapi) \n end \n if cfg.androidarch then \n _p(2,'<AndroidArch>%s</A "
" ndroidArch>', cfg.androidarch) \n end \n if cfg.androidndktoolchainversion then \n _p(2,'<NdkToolchainVersion>%s</NdkToolchainVersion>', cfg.androidndktoolchainversion) \n end \n if cfg.androidstltype then \n _p(2,'<AndroidStlType>%s</AndroidStlType>', cfg.androidstltype) \n end \n end \n if cfg.platform == \" NX32 \" or cfg.platform == \" NX64 \" then \n _p(2,'<NintendoSdkRoot>$(NINTENDO_SDK_ROOT) \\ \\ </NintendoSdkRoot>') \n _p(2,'<NintendoSdkSpec>NX</NintendoSdkSpec>') \n if premake.config.isdebugbuild(cfg) then \n _p(2,'<NintendoSdkBuildType>Debug</NintendoSdkBuildType>') \n else \n _p(2,'<NintendoSdkBuildType>Release</NintendoSdkBuildType>') \n end \n end \n if cfg.flags.Symbols and (premake.action.current() == premake.action.get( \" vs2017 \" ) or is2019) then \n _p(2, '<DebugSymbols>true</DebugSymbols>') \n end \n _p(1,'</PropertyGroup>') \n end \n local function import_props(prj) \n for _, cfginfo in ipairs(prj.solution.vstudio_configs) do \n local cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform) \n _p(1,'<ImportGroup '..if_config_and_plat "
" form() ..' Label= \" PropertySheets \" >' \n ,premake.esc(cfginfo.name)) \n _p(2,'<Import Project= \" $(UserRootDir) \\ \\ Microsoft.Cpp.$(Platform).user.props \" Condition= \" exists( \\ '$(UserRootDir) \\ \\ Microsoft.Cpp.$(Platform).user.props \\ ') \" Label= \" LocalAppDataPlatform \" />') \n if #cfg.propertysheets > 0 then \n local dirs = cfg.propertysheets \n for _, dir in ipairs(dirs) do \n _p(2,'<Import Project= \" %s \" />', path.translate(dir)) \n end \n end \n _p(1,'</ImportGroup>') \n end \n end \n local function add_trailing_backslash(dir) \n if dir:len() > 0 and dir:sub(-1) ~= \" \\ \\ \" then \n return dir.. \" \\ \\ \" \n end \n return dir \n end \n function vc2010.outputProperties(prj) \n for _, cfginfo in ipairs(prj.solution.vstudio_configs) do \n local cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform) \n local target = cfg.buildtarget \n local outdir = add_trailing_backslash(target.directory) \n local intdir = add_trailing_backslash(iif(action.vstudio.intDirAbsolute \n , path.translate( \n path.join(prj.solution.location, cfg.objectsdir) \n , ' \\ \\ ') "
" \n , cfg.objectsdir \n )) \n _p(1,'<PropertyGroup '..if_config_and_platform() ..'>', premake.esc(cfginfo.name)) \n _p(2,'<OutDir>%s</OutDir>', iif(outdir:len() > 0, premake.esc(outdir), \" . \\ \\ \" )) \n if cfg.platform == \" Xbox360 \" then \n _p(2,'<OutputFile>$(OutDir)%s</OutputFile>', premake.esc(target.name)) \n end \n _p(2,'<IntDir>%s</IntDir>', premake.esc(intdir)) \n _p(2,'<TargetName>%s</TargetName>', premake.esc(path.getbasename(target.name))) \n _p(2,'<TargetExt>%s</TargetExt>', premake.esc(path.getextension(target.name))) \n if cfg.kind == \" SharedLib \" then \n local ignore = (cfg.flags.NoImportLib ~= nil) \n _p(2,'<IgnoreImportLibrary>%s</IgnoreImportLibrary>', tostring(ignore)) \n end \n if cfg.platform == \" Durango \" then \n _p(2, '<ReferencePath>$(Console_SdkLibPath);$(Console_SdkWindowsMetadataPath)</ReferencePath>') \n _p(2, '<LibraryPath>$(Console_SdkLibPath)</LibraryPath>') \n _p(2, '<LibraryWPath>$(Console_SdkLibPath);$(Console_SdkWindowsMetadataPath)</LibraryWPath>') \n _p(2, '<IncludePath>$(Console_SdkIncludeRoot)</IncludePath>' "
" ) \n _p(2, '<ExecutablePath>$(Console_SdkRoot)bin;$(VCInstallDir)bin \\ \\ x86_amd64;$(VCInstallDir)bin;$(WindowsSDK_ExecutablePath_x86);$(VSInstallDir)Common7 \\ \\ Tools \\ \\ bin;$(VSInstallDir)Common7 \\ \\ tools;$(VSInstallDir)Common7 \\ \\ ide;$(ProgramFiles) \\ \\ HTML Help Workshop;$(MSBuildToolsPath32);$(FxCopDir);$(PATH);</ExecutablePath>') \n if cfg.imagepath then \n _p(2, '<LayoutDir>%s</LayoutDir>', cfg.imagepath) \n else \n _p(2, '<LayoutDir>%s</LayoutDir>', prj.name) \n end \n if cfg.pullmappingfile ~= nil then \n _p(2,'<PullMappingFile>%s</PullMappingFile>', premake.esc(cfg.pullmappingfile)) \n end \n _p(2, '<LayoutExtensionFilter>*.pdb;*.ilk;*.exp;*.lib;*.winmd;*.appxrecipe;*.pri;*.idb</LayoutExtensionFilter>') \n _p(2, '<IsolateConfigurationsOnDeploy>true</IsolateConfigurationsOnDeploy>') \n end \n if cfg.kind ~= \" StaticLib \" then \n _p(2,'<LinkIncremental>%s</LinkIncremental>', tostring(premake.config.isincrementallink(cfg))) \n end \n if cfg.applicationdatadir ~= nil then \n _p(2,'<ApplicationDataDir>%s</ApplicationDataDir>', premake.esc(cf "
" g.applicationdatadir)) \n end \n if cfg.flags.NoManifest then \n _p(2,'<GenerateManifest>false</GenerateManifest>') \n end \n _p(1,'</PropertyGroup>') \n end \n end \n local function runtime(cfg) \n local runtime \n local flags = cfg.flags \n if premake.config.isdebugbuild(cfg) then \n runtime = iif(flags.StaticRuntime and not flags.Managed, \" MultiThreadedDebug \" , \" MultiThreadedDebugDLL \" ) \n else \n runtime = iif(flags.StaticRuntime and not flags.Managed, \" MultiThreaded \" , \" MultiThreadedDLL \" ) \n end \n return runtime \n end \n local function precompiled_header(cfg) \n if not cfg.flags.NoPCH and cfg.pchheader then \n _p(3,'<PrecompiledHeader>Use</PrecompiledHeader>') \n _p(3,'<PrecompiledHeaderFile>%s</PrecompiledHeaderFile>', cfg.pchheader) \n else \n _p(3,'<PrecompiledHeader></PrecompiledHeader>') \n end \n end \n local function preprocessor(indent,cfg,escape) \n if #cfg.defines > 0 then \n local defines = table.concat(cfg.defines, \" ; \" ) \n if escape then \n defines = defines:gsub(' \" ', ' \\ \\ \" ') \n end \n local isPreprocessorDefinitionPresent = string.find(d "
" efines, \" %%%(PreprocessorDefinitions%) \" ) \n if isPreprocessorDefinitionPresent then \n _p(indent,'<PreprocessorDefinitions>%s</PreprocessorDefinitions>' \n ,premake.esc(defines)) \n else \n _p(indent,'<PreprocessorDefinitions>%s;%%(PreprocessorDefinitions)</PreprocessorDefinitions>' \n ,premake.esc(defines)) \n end \n else \n _p(indent,'<PreprocessorDefinitions></PreprocessorDefinitions>') \n end \n end \n local function include_dirs(indent,cfg) \n local includedirs = table.join(cfg.userincludedirs, cfg.includedirs, cfg.systemincludedirs) \n if #includedirs> 0 then \n _p(indent,'<AdditionalIncludeDirectories>%s;%%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>' \n ,premake.esc(path.translate(table.concat(includedirs, \" ; \" ), ' \\ \\ '))) \n end \n end \n local function using_dirs(indent,cfg) \n if #cfg.usingdirs > 0 then \n _p(indent,'<AdditionalUsingDirectories>%s;%%(AdditionalUsingDirectories)</AdditionalUsingDirectories>' \n ,premake.esc(path.translate(table.concat(cfg.usingdirs, \" ; \" ), ' \\ \\ '))) \n end \n end \n local function resource_compi "
" le(cfg) \n _p(2,'<ResourceCompile>') \n preprocessor(3,cfg,true) \n include_dirs(3,cfg) \n _p(2,'</ResourceCompile>') \n end \n local function cppstandard_vs2017_or_2019(cfg) \n if cfg.flags.CppLatest then \n _p(3, '<LanguageStandard>stdcpplatest</LanguageStandard>') \n _p(3, '<EnableModules>true</EnableModules>') \n elseif cfg.flags.Cpp17 then \n _p(3, '<LanguageStandard>stdcpp17</LanguageStandard>') \n elseif cfg.flags.Cpp14 then \n _p(3, '<LanguageStandard>stdcpp14</LanguageStandard>') \n end \n end \n local function exceptions(cfg) \n if cfg.platform == \" Orbis \" then \n if cfg.flags.NoExceptions then \n _p(3, '<CppExceptions>false</CppExceptions>') \n end \n elseif cfg.platform == \" TegraAndroid \" then \n if cfg.flags.NoExceptions then \n _p(3, '<GccExceptionHandling>false</GccExceptionHandling>') \n end \n else \n if cfg.flags.NoExceptions then \n _p(3, '<ExceptionHandling>false</ExceptionHandling>') \n elseif cfg.flags.SEH then \n _p(3, '<ExceptionHandling>Async</ExceptionHandling>') \n end \n end \n end \n local function rtti(cfg) \n if cfg.flags.NoRTTI and not cfg.fla "
" gs.Managed then \n _p(3,'<RuntimeTypeInfo>false</RuntimeTypeInfo>') \n end \n end \n local function calling_convention(cfg) \n if cfg.flags.FastCall then \n _p(3,'<CallingConvention>FastCall</CallingConvention>') \n elseif cfg.flags.StdCall then \n _p(3,'<CallingConvention>StdCall</CallingConvention>') \n end \n end \n local function wchar_t_builtin(cfg) \n if cfg.flags.NativeWChar then \n _p(3,'<TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>') \n elseif cfg.flags.NoNativeWChar then \n _p(3,'<TreatWChar_tAsBuiltInType>false</TreatWChar_tAsBuiltInType>') \n end \n end \n local function sse(cfg) \n if cfg.flags.EnableSSE then \n _p(3, '<EnableEnhancedInstructionSet>StreamingSIMDExtensions</EnableEnhancedInstructionSet>') \n elseif cfg.flags.EnableSSE2 then \n _p(3, '<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>') \n elseif cfg.flags.EnableAVX then \n _p(3, '<EnableEnhancedInstructionSet>AdvancedVectorExtensions</EnableEnhancedInstructionSet>') \n elseif cfg.flags.EnableAVX2 then \n _p(3, '<EnableEnhancedInstruct "
" ionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>') \n end \n end \n local function floating_point(cfg) \n if cfg.platform == \" Orbis \" then \n if cfg.flags.FloatFast then \n _p(3,'<FastMath>true</FastMath>') \n end \n elseif cfg.platform == \" TegraAndroid \" then \n else \n if cfg.flags.FloatFast then \n _p(3,'<FloatingPointModel>Fast</FloatingPointModel>') \n elseif cfg.flags.FloatStrict and not cfg.flags.Managed then \n _p(3,'<FloatingPointModel>Strict</FloatingPointModel>') \n end \n end \n end \n local function debug_info(cfg) \n local debug_info = '' \n if cfg.flags.Symbols then \n if cfg.flags.C7DebugInfo then \n debug_info = \" OldStyle \" \n elseif (action.vstudio.supports64bitEditContinue == false and cfg.platform == \" x64 \" ) \n or not premake.config.iseditandcontinue(cfg) \n then \n debug_info = \" ProgramDatabase \" \n else \n debug_info = \" EditAndContinue \" \n end \n end \n _p(3,'<DebugInformationFormat>%s</DebugInformationFormat>',debug_info) \n end \n local function minimal_build(cfg) \n if premake.config.isdebugbuild(cfg) and cfg.flags.EnableMinimal "
" Rebuild then \n _p(3,'<MinimalRebuild>true</MinimalRebuild>') \n else \n _p(3,'<MinimalRebuild>false</MinimalRebuild>') \n end \n end \n local function compile_language(cfg) \n if cfg.options.ForceCPP then \n _p(3,'<CompileAs>CompileAsCpp</CompileAs>') \n else \n if cfg.language == \" C \" then \n _p(3,'<CompileAs>CompileAsC</CompileAs>') \n end \n end \n end \n local function forcedinclude_files(indent,cfg) \n if #cfg.forcedincludes > 0 then \n _p(indent,'<ForcedIncludeFiles>%s</ForcedIncludeFiles>' \n ,premake.esc(path.translate(table.concat(cfg.forcedincludes, \" ; \" ), ' \\ \\ '))) \n end \n end \n local function vs10_clcompile(cfg) \n _p(2,'<ClCompile>') \n local unsignedChar = \" /J \" \n local buildoptions = cfg.buildoptions \n if cfg.platform == \" Orbis \" then \n unsignedChar = \" -funsigned-char \" ; \n _p(3,'<GenerateDebugInformation>%s</GenerateDebugInformation>', tostring(cfg.flags.Symbols ~= nil)) \n end \n if cfg.language == \" C \" and not cfg.options.ForceCPP then \n buildoptions = table.join(buildoptions, cfg.buildoptions_c) \n else \n buildoptions = table.join(buildo "
" ptions, cfg.buildoptions_cpp) \n end \n _p(3,'<AdditionalOptions>%s %s%%(AdditionalOptions)</AdditionalOptions>' \n , table.concat(premake.esc(buildoptions), \" \" ) \n , iif(cfg.flags.UnsignedChar and cfg.platform ~= \" TegraAndroid \" , unsignedChar, \" \" ) \n ) \n if cfg.platform == \" TegraAndroid \" then \n _p(3,'<SignedChar>%s</SignedChar>', tostring(cfg.flags.UnsignedChar == nil)) \n _p(3,'<GenerateDebugInformation>%s</GenerateDebugInformation>', tostring(cfg.flags.Symbols ~= nil)) \n if cfg.androidcppstandard then \n _p(3,'<CppLanguageStandard>%s</CppLanguageStandard>', cfg.androidcppstandard) \n end \n end \n if cfg.platform == \" Orbis \" then \n local opt = optimisation(cfg) \n if opt == \" Disabled \" then \n _p(3,'<OptimizationLevel>Level0</OptimizationLevel>') \n elseif opt == \" MinSpace \" then \n _p(3,'<OptimizationLevel>Levelz</OptimizationLevel>') -- Oz is more aggressive than Os \n elseif opt == \" MaxSpeed \" then \n _p(3,'<OptimizationLevel>Level3</OptimizationLevel>') \n else \n _p(3,'<OptimizationLevel>Level2</OptimizationLevel>') \n end \n elseif "
" cfg.platform == \" TegraAndroid \" then \n local opt = optimisation(cfg) \n if opt == \" Disabled \" then \n _p(3,'<OptimizationLevel>O0</OptimizationLevel>') \n elseif opt == \" MinSpace \" then \n _p(3,'<OptimizationLevel>Os</OptimizationLevel>') \n elseif opt == \" MaxSpeed \" then \n _p(3,'<OptimizationLevel>O3</OptimizationLevel>') \n else \n _p(3,'<OptimizationLevel>O2</OptimizationLevel>') \n end \n else \n _p(3,'<Optimization>%s</Optimization>', optimisation(cfg)) \n end \n include_dirs(3, cfg) \n using_dirs(3, cfg) \n preprocessor(3, cfg) \n minimal_build(cfg) \n if premake.config.isoptimizedbuild(cfg.flags) then \n if cfg.flags.NoOptimizeLink and cfg.flags.NoEditAndContinue then \n _p(3, '<StringPooling>false</StringPooling>') \n _p(3, '<FunctionLevelLinking>false</FunctionLevelLinking>') \n else \n _p(3, '<StringPooling>true</StringPooling>') \n _p(3, '<FunctionLevelLinking>true</FunctionLevelLinking>') \n end \n else \n _p(3, '<FunctionLevelLinking>true</FunctionLevelLinking>') \n if cfg.flags.NoRuntimeChecks then \n _p(3, '<BasicRuntimeChecks>Default</BasicRunt "
" imeChecks>') \n elseif not cfg.flags.Managed then \n _p(3, '<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>') \n end \n if cfg.flags.ExtraWarnings then \n end \n end \n if cfg.platform == \" Durango \" or cfg.flags.NoWinRT then \n _p(3, '<CompileAsWinRT>false</CompileAsWinRT>') \n end \n _p(3, '<RuntimeLibrary>%s</RuntimeLibrary>', runtime(cfg)) \n if cfg.flags.NoBufferSecurityCheck then \n _p(3, '<BufferSecurityCheck>false</BufferSecurityCheck>') \n end \n if not cfg.flags.NoMultiProcessorCompilation and not cfg.flags.EnableMinimalRebuild then \n _p(3, '<MultiProcessorCompilation>true</MultiProcessorCompilation>') \n else \n _p(3, '<MultiProcessorCompilation>false</MultiProcessorCompilation>') \n end \n precompiled_header(cfg) \n if cfg.platform == \" Orbis \" then \n if cfg.flags.PedanticWarnings then \n _p(3, '<Warnings>MoreWarnings</Warnings>') \n _p(3, '<ExtraWarnings>true</ExtraWarnings>') \n elseif cfg.flags.ExtraWarnings then \n _p(3, '<Warnings>NormalWarnings</Warnings>') \n _p(3, '<ExtraWarnings>true</ExtraWarnings>') \n elseif cfg.flags.MinimumWa "
" rnings then \n _p(3, '<Warnings>WarningsOff</Warnings>') \n _p(3, '<ExtraWarnings>false</ExtraWarnings>') \n else \n _p(3, '<Warnings>NormalWarnings</Warnings>') \n _p(3, '<ExtraWarnings>false</ExtraWarnings>') \n end \n if cfg.flags.FatalWarnings then \n _p(3, '<WarningsAsErrors>true</WarningsAsErrors>') \n end \n elseif cfg.platform == \" TegraAndroid \" then \n if cfg.flags.PedanticWarnings or cfg.flags.ExtraWarnings then \n _p(3, '<Warnings>AllWarnings</Warnings>') \n elseif cfg.flags.MinimumWarnings then \n _p(3, '<Warnings>DisableAllWarnings</Warnings>') \n else \n _p(3, '<Warnings>NormalWarnings</Warnings>') \n end \n if cfg.flags.FatalWarnings then \n _p(3, '<WarningsAsErrors>true</WarningsAsErrors>') \n end \n else \n if cfg.flags.PedanticWarnings then \n _p(3, '<WarningLevel>EnableAllWarnings</WarningLevel>') \n elseif cfg.flags.ExtraWarnings then \n _p(3, '<WarningLevel>Level4</WarningLevel>') \n elseif cfg.flags.MinimumWarnings then \n _p(3, '<WarningLevel>Level1</WarningLevel>') \n else \n _p(3 ,'<WarningLevel>Level3</WarningLevel>') \n end \n end \n if cfg.flag "
" s.FatalWarnings then \n _p(3, '<TreatWarningAsError>true</TreatWarningAsError>') \n end \n if premake.action.current() == premake.action.get( \" vs2017 \" ) or \n premake.action.current() == premake.action.get( \" vs2019 \" ) then \n cppstandard_vs2017_or_2019(cfg) \n end \n exceptions(cfg) \n rtti(cfg) \n calling_convention(cfg) \n wchar_t_builtin(cfg) \n sse(cfg) \n floating_point(cfg) \n debug_info(cfg) \n if _ACTION:sub(3) == \" llvm \" then \n _p(3,'<SupportJustMyCode>false</SupportJustMyCode>') \n end \n if cfg.flags.Symbols then \n if cfg.kind == \" StaticLib \" then \n _p(3, '<ProgramDataBaseFileName>$(OutDir)%s.pdb</ProgramDataBaseFileName>' \n , path.getbasename(cfg.buildtarget.name) \n ) \n else \n _p(3, '<ProgramDataBaseFileName>$(IntDir)%s.compile.pdb</ProgramDataBaseFileName>' \n , path.getbasename(cfg.buildtarget.name) \n ) \n end \n end \n if cfg.flags.Hotpatchable then \n _p(3, '<CreateHotpatchableImage>true</CreateHotpatchableImage>') \n end \n if cfg.flags.NoFramePointer then \n _p(3, '<OmitFramePointers>true</OmitFramePointers>') \n end \n if cfg.flags.UseFullPaths "
" then \n _p(3, '<UseFullPaths>true</UseFullPaths>') \n end \n if cfg.flags.NoJMC then \n _p(3,'<SupportJustMyCode>false</SupportJustMyCode>' ) \n end \n compile_language(cfg) \n forcedinclude_files(3,cfg); \n if vstudio.diagformat then \n _p(3, '<DiagnosticsFormat>%s</DiagnosticsFormat>', vstudio.diagformat) \n else \n _p(3, '<DiagnosticsFormat>Caret</DiagnosticsFormat>') \n end \n _p(2,'</ClCompile>') \n end \n local function event_hooks(cfg) \n if #cfg.postbuildcommands> 0 then \n _p(2,'<PostBuildEvent>') \n _p(3,'<Command>%s</Command>',premake.esc(table.implode(cfg.postbuildcommands, \" \" , \" \" , \" \\ r \\ n \" ))) \n _p(2,'</PostBuildEvent>') \n end \n if #cfg.prebuildcommands> 0 then \n _p(2,'<PreBuildEvent>') \n _p(3,'<Command>%s</Command>',premake.esc(table.implode(cfg.prebuildcommands, \" \" , \" \" , \" \\ r \\ n \" ))) \n _p(2,'</PreBuildEvent>') \n end \n if #cfg.prelinkcommands> 0 then \n _p(2,'<PreLinkEvent>') \n _p(3,'<Command>%s</Command>',premake.esc(table.implode(cfg.prelinkcommands, \" \" , \" \" , \" \\ r \\ n \" ))) \n _p(2,'</PreLinkEvent>') \n end \n end \n local fu "
" nction additional_options(indent,cfg) \n if #cfg.linkoptions > 0 then \n _p(indent,'<AdditionalOptions>%s %%(AdditionalOptions)</AdditionalOptions>', \n table.concat(premake.esc(cfg.linkoptions), \" \" )) \n end \n end \n local function link_target_machine(index,cfg) \n local platforms = {x32 = 'MachineX86', x64 = 'MachineX64'} \n if platforms[cfg.platform] then \n _p(index,'<TargetMachine>%s</TargetMachine>', platforms[cfg.platform]) \n end \n end \n local function item_def_lib(prj, cfg) \n if cfg.kind == 'StaticLib' and cfg.platform ~= \" Xbox360 \" then \n _p(1,'<Lib>') \n _p(2,'<OutputFile>$(OutDir)%s</OutputFile>',cfg.buildtarget.name) \n additional_options(2,cfg) \n link_target_machine(2,cfg) \n if _ACTION:sub(3) == \" llvm \" and prj.name == \" portaudio \" then -- MSVC-LLVM needs special help \n _p(2,'<AdditionalDependencies>ksuser.lib;%%(AdditionalDependencies)</AdditionalDependencies>') \n end \n _p(1,'</Lib>') \n end \n end \n local function import_lib(cfg) \n if cfg.kind == \" SharedLib \" then \n local implibname = cfg.linktarget.fullpath \n _p(3,'<ImportLibr "
" ary>%s</ImportLibrary>',iif(cfg.flags.NoImportLib, cfg.objectsdir .. \" \\ \\ \" .. path.getname(implibname), implibname)) \n end \n end \n local function hasmasmfiles(prj) \n local files = vc2010.getfilegroup(prj, \" MASM \" ) \n return #files > 0 \n end \n local function ismanagedprj(prj, cfgname, pltname) \n local cfg = premake.getconfig(prj, cfgname, pltname) \n return cfg.flags.Managed == true \n end \n local function getcfglinks(cfg) \n local haswholearchive = #cfg.wholearchive > 0 \n local msvcnaming = premake.getnamestyle(cfg) == \" windows \" \n local iscppprj = premake.iscppproject(cfg) \n local isnetprj = premake.isdotnetproject(cfg) \n local linkobjs = {} \n local links = iif(haswholearchive \n , premake.getlinks(cfg, \" all \" , \" object \" ) \n , premake.getlinks(cfg, \" system \" , \" fullpath \" ) \n ) \n for _, link in ipairs(links) do \n local name = nil \n local directory = nil \n local whole = nil \n if type(link) == \" table \" then \n if not ismanagedprj(link.project, cfg.name, cfg.platform) then \n name = link.linktarget.basen "
" ame \n directory = path.rebase(link.linktarget.directory, link.location, cfg.location) \n whole = table.icontains(cfg.wholearchive, link.project.name) \n end \n else \n name = link \n whole = table.icontains(cfg.wholearchive, link) \n end \n if name then \n if haswholearchive and msvcnaming then \n if iscppprj then \n name = name .. \" .lib \" \n elseif isnetprj then \n name = name .. \" .dll \" \n end \n end \n table.insert(linkobjs, {name=name, directory=directory, wholearchive=whole}) \n end \n end \n return linkobjs \n end \n local function vs10_masm(prj, cfg) \n if hasmasmfiles(prj) then \n _p(2, '<MASM>') \n _p(3,'<AdditionalOptions>%s %%(AdditionalOptions)</AdditionalOptions>' \n , table.concat(premake.esc(table.join(cfg.buildoptions, cfg.buildoptions_asm)), \" \" ) \n ) \n local includedirs = table.join(cfg.userincludedirs, cfg.includedirs, cfg.systemincludedirs) \n if #includedirs > 0 then \n _p(3, '<IncludePaths>%s;%%(IncludePaths)</IncludePaths>' \n , premake.esc(path.translate(table.concat(includedirs, \" ; \" ), ' \\ \\ ')) \n ) \n end \n local defines = table "
" .join(cfg.defines) \n table.insertflat(defines, iif(premake.config.isdebugbuild(cfg), \" _DEBUG \" , {})) \n table.insert(defines, iif(cfg.platform == \" x64 \" , \" _WIN64 \" , \" _WIN32 \" )) \n table.insert(defines, iif(prj.kind == \" SharedLib \" , \" _EXPORT=EXPORT \" , \" _EXPORT= \" )) \n _p(3, '<PreprocessorDefinitions>%s;%%(PreprocessorDefinitions)</PreprocessorDefinitions>' \n , premake.esc(table.concat(defines, \" ; \" )) \n ) \n if cfg.flags.FatalWarnings then \n _p(3,'<TreatWarningsAsErrors>true</TreatWarningsAsErrors>') \n end \n if cfg.flags.MinimumWarnings then \n _p(3,'<WarningLevel>0</WarningLevel>') \n else \n _p(3,'<WarningLevel>3</WarningLevel>') \n end \n _p(2, '</MASM>') \n end \n end \n local function additional_manifest(cfg) \n if(cfg.dpiawareness ~= nil) then \n _p(2,'<Manifest>') \n if(cfg.dpiawareness == \" None \" ) then \n _p(3, '<EnableDpiAwareness>false</EnableDpiAwareness>') \n end \n if(cfg.dpiawareness == \" High \" ) then \n _p(3, '<EnableDpiAwareness>true</EnableDpiAwareness>') \n end \n if(cfg.dpiawareness == \" HighPerMonitor \" ) then \n _p(3, '<EnableDpiAwa "
" reness>PerMonitorHighDPIAware</EnableDpiAwareness>') \n end \n _p(2,'</Manifest>') \n end \n end \n function vc2010.link(cfg) \n local vs2017OrLater = premake.action.current() == premake.action.get( \" vs2017 \" ) or \n premake.action.current() == premake.action.get( \" vs2019 \" ) \n local vsllvm = premake.action.current() == premake.action.get( \" vsllvm \" ) \n local links = getcfglinks(cfg) \n _p(2,'<Link>') \n _p(3,'<SubSystem>%s</SubSystem>', iif(cfg.kind == \" ConsoleApp \" , \" Console \" , \" Windows \" )) \n if (vs2017OrLater or vsllvm) and cfg.flags.FullSymbols then \n _p(3,'<GenerateDebugInformation>DebugFull</GenerateDebugInformation>') \n else \n _p(3,'<GenerateDebugInformation>%s</GenerateDebugInformation>', tostring(cfg.flags.Symbols ~= nil)) \n end \n if cfg.flags.Symbols then \n _p(3, '<ProgramDatabaseFile>$(OutDir)%s.pdb</ProgramDatabaseFile>' \n , path.getbasename(cfg.buildtarget.name) \n ) \n end \n if premake.config.islinkeroptimizedbuild(cfg.flags) then \n if cfg.platform == \" Orbis \" then \n _p(3,'<DataStripping>StripFuncsAndData</DataStripping>') \n "
" _p(3,'<DuplicateStripping>true</DuplicateStripping>') \n else \n _p(3,'<EnableCOMDATFolding>true</EnableCOMDATFolding>') \n _p(3,'<OptimizeReferences>true</OptimizeReferences>') \n end \n elseif cfg.platform == \" Orbis \" and premake.config.iseditandcontinue(cfg) then \n _p(3,'<EditAndContinue>true</EditAndContinue>') \n end \n if cfg.finalizemetasource ~= nil then \n _p(3,'<FinalizeMetaSource>%s</FinalizeMetaSource>', premake.esc(cfg.finalizemetasource)) \n end \n if cfg.kind ~= 'StaticLib' then \n vc2010.additionalDependencies(3, cfg, links) \n vc2010.additionalLibraryDirectories(3, cfg, links) \n _p(3,'<OutputFile>$(OutDir)%s</OutputFile>', cfg.buildtarget.name) \n if vc2010.config_type(cfg) == 'Application' and not cfg.flags.WinMain and not cfg.flags.Managed then \n if cfg.flags.Unicode then \n _p(3,'<EntryPointSymbol>wmainCRTStartup</EntryPointSymbol>') \n else \n _p(3,'<EntryPointSymbol>mainCRTStartup</EntryPointSymbol>') \n end \n end \n import_lib(cfg) \n local deffile = premake.findfile(cfg, \" .def \" ) \n if deffile then \n _p(3,'<ModuleDefinitionFile> "
" %s</ModuleDefinitionFile>', deffile) \n end \n link_target_machine(3,cfg) \n additional_options(3,cfg) \n if cfg.flags.NoWinMD and vstudio.iswinrt() and prj.kind == \" WindowedApp \" then \n _p(3,'<GenerateWindowsMetadata>false</GenerateWindowsMetadata>' ) \n end \n end \n if cfg.platform == \" TegraAndroid \" then \n if cfg.androidlinker then \n _p(3,'<UseLinker>%s</UseLinker>',cfg.androidlinker) \n end \n end \n if cfg.flags.Hotpatchable then \n _p(3, '<CreateHotPatchableImage>Enabled</CreateHotPatchableImage>') \n end \n _p(2,'</Link>') \n if #cfg.wholearchive > 0 then \n _p(2, '<ProjectReference>') \n _p(3, '<LinkLibraryDependencies>false</LinkLibraryDependencies>') \n _p(2, '</ProjectReference>') \n end \n end \n function vc2010.additionalLibraryDirectories(tab, cfg, links) \n local dirs = cfg.libdirs \n for _, link in ipairs(links) do \n if link.directory and not table.icontains(dirs, link.directory) then \n table.insert(dirs, link.directory) \n end \n end \n _p(tab, '<AdditionalLibraryDirectories>%s;%%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>' \n , "
" premake.esc(path.translate(table.concat(dirs, ';'), ' \\ \\ ')) \n ) \n end \n function vc2010.additionalDependencies(tab, cfg, links) \n if #links > 0 then \n local deps = \" \" \n if cfg.platform == \" Orbis \" then \n local iswhole = false \n for _, link in ipairs(links) do \n if link.wholearchive and not iswhole then \n deps = deps .. \" --whole-archive; \" \n iswhole = true \n elseif not link.wholearchive and iswhole then \n deps = deps .. \" --no-whole-archive; \" \n iswhole = false \n end \n deps = deps .. \" -l \" .. link.name .. \" ; \" \n end \n else \n for _, link in ipairs(links) do \n if link.wholearchive then \n deps = deps .. \" /WHOLEARCHIVE: \" .. link.name .. \" ; \" \n else \n deps = deps .. link.name .. \" ; \" \n end \n end \n end \n if cfg.platform == \" TegraAndroid \" then \n deps = \" -Wl,--start-group; \" .. deps .. \" ;-Wl,--end-group \" \n end \n _p(tab, '<AdditionalDependencies>%s;%s</AdditionalDependencies>' \n , deps \n , iif(cfg.platform == \" Durango \" \n , '%(XboxExtensionsDependencies)' \n , '%(AdditionalDependencies)' \n ) \n ) \n elseif cfg.platform == \" Durango \" then \n _ "
" p(tab, '<AdditionalDependencies>%%(XboxExtensionsDependencies)</AdditionalDependencies>') \n end \n end \n function ant_build(prj, cfg) \n if cfg.platform == \" TegraAndroid \" then \n local files = vc2010.getfilegroup(prj, \" AndroidBuild \" ) \n _p(2,'<AntBuild>') \n if #files > 0 then \n _p(3,'<AndroidManifestLocation>%s</AndroidManifestLocation>',path.translate(files[1].name)) \n end \n local isdebugbuild = premake.config.isdebugbuild(cfg) \n _p(3,'<AntBuildType>%s</AntBuildType>',iif(isdebugbuild, 'Debug','Release')) \n _p(3,'<Debuggable>%s</Debuggable>',tostring(cfg.flags.AntBuildDebuggable ~= nil)) \n if #cfg.antbuildjavasourcedirs > 0 then \n local dirs = table.concat(cfg.antbuildjavasourcedirs, \" ; \" ) \n _p(3,'<JavaSourceDir>%s</JavaSourceDir>',dirs) \n end \n if #cfg.antbuildjardirs > 0 then \n local dirs = table.concat(cfg.antbuildjardirs, \" ; \" ) \n _p(3,'<JarDirectories>%s</JarDirectories>',dirs) \n end \n if #cfg.antbuildjardependencies > 0 then \n local dirs = table.concat(cfg.antbuildjardependencies, \" ; \" ) \n _p(3,'<JarDependencies>%s</JarDependen "
" cies>',dirs) \n end \n if #cfg.antbuildnativelibdirs > 0 then \n local dirs = table.concat(cfg.antbuildnativelibdirs, \" ; \" ) \n _p(3,'<NativeLibDirectories>%s</NativeLibDirectories>',dirs) \n end \n if #cfg.antbuildnativelibdependencies > 0 then \n local dirs = table.concat(cfg.antbuildnativelibdependencies, \" ; \" ) \n _p(3,'<NativeLibDependencies>%s</NativeLibDependencies>',dirs) \n end \n if #cfg.antbuildassetsdirs > 0 then \n local dirs = table.concat(cfg.antbuildassetsdirs, \" ; \" ) \n _p(3,'<AssetsDirectories>%s</AssetsDirectories>',dirs) \n end \n _p(2,'</AntBuild>') \n end \n end \n local function item_definitions(prj) \n for _, cfginfo in ipairs(prj.solution.vstudio_configs) do \n local cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform) \n _p(1,'<ItemDefinitionGroup ' ..if_config_and_platform() ..'>' \n ,premake.esc(cfginfo.name)) \n vs10_clcompile(cfg) \n resource_compile(cfg) \n item_def_lib(prj, cfg) \n vc2010.link(cfg) \n ant_build(prj, cfg) \n event_hooks(cfg) \n vs10_masm(prj, cfg) \n additional_manifest(cfg) \n _p(1,'</ItemDefinitionGroup "
" >') \n end \n end \n function vc2010.getfilegroup(prj, group) \n local sortedfiles = prj.vc2010sortedfiles \n if not sortedfiles then \n sortedfiles = { \n ClCompile = {}, \n ClInclude = {}, \n MASM = {}, \n Object = {}, \n None = {}, \n ResourceCompile = {}, \n AppxManifest = {}, \n AndroidBuild = {}, \n Natvis = {}, \n Image = {}, \n DeploymentContent = {} \n } \n local foundAppxManifest = false \n for file in premake.project.eachfile(prj, true) do \n if path.issourcefilevs(file.name) then \n table.insert(sortedfiles.ClCompile, file) \n elseif path.iscppheader(file.name) then \n if not table.icontains(prj.removefiles, file) then \n table.insert(sortedfiles.ClInclude, file) \n end \n elseif path.isobjectfile(file.name) then \n table.insert(sortedfiles.Object, file) \n elseif path.isresourcefile(file.name) then \n table.insert(sortedfiles.ResourceCompile, file) \n elseif path.isimagefile(file.name) then \n table.insert(sortedfiles.Image, file) \n elseif path.isappxmanifest(file.name) then \n foundAppxManifest = true \n table.insert(sortedfiles.AppxManifest, file) \n elseif path.is "
" androidbuildfile(file.name) then \n table.insert(sortedfiles.AndroidBuild, file) \n elseif path.isnatvis(file.name) then \n table.insert(sortedfiles.Natvis, file) \n elseif path.isasmfile(file.name) then \n table.insert(sortedfiles.MASM, file) \n elseif file.flags and table.icontains(file.flags, \" DeploymentContent \" ) then \n table.insert(sortedfiles.DeploymentContent, file) \n else \n table.insert(sortedfiles.None, file) \n end \n end \n if vstudio.iswinrt() and prj.kind == \" WindowedApp \" and not foundAppxManifest then \n vstudio.needAppxManifest = true \n local fcfg = {} \n fcfg.name = prj.name .. \" /Package.appxmanifest \" \n fcfg.vpath = premake.project.getvpath(prj, fcfg.name) \n table.insert(sortedfiles.AppxManifest, fcfg) \n local logo = {} \n logo.name = prj.name .. \" /Logo.png \" \n logo.vpath = logo.name \n table.insert(sortedfiles.Image, logo) \n local smallLogo = {} \n smallLogo.name = prj.name .. \" /SmallLogo.png \" \n smallLogo.vpath = smallLogo.name \n table.insert(sortedfiles.Image, smallLogo) \n local storeLogo = {} \n storeLogo.name = prj.name "
" .. \" /StoreLogo.png \" \n storeLogo.vpath = storeLogo.name \n table.insert(sortedfiles.Image, storeLogo) \n local splashScreen = {} \n splashScreen.name = prj.name .. \" /SplashScreen.png \" \n splashScreen.vpath = splashScreen.name \n table.insert(sortedfiles.Image, splashScreen) \n end \n prj.vc2010sortedfiles = sortedfiles \n end \n return sortedfiles[group] \n end \n function vc2010.files(prj) \n vc2010.simplefilesgroup(prj, \" ClInclude \" ) \n vc2010.compilerfilesgroup(prj) \n vc2010.simplefilesgroup(prj, \" Object \" ) \n vc2010.simplefilesgroup(prj, \" None \" ) \n vc2010.customtaskgroup(prj) \n vc2010.simplefilesgroup(prj, \" ResourceCompile \" ) \n vc2010.simplefilesgroup(prj, \" AppxManifest \" ) \n vc2010.simplefilesgroup(prj, \" AndroidBuild \" ) \n vc2010.simplefilesgroup(prj, \" Natvis \" ) \n vc2010.deploymentcontentgroup(prj, \" Image \" ) \n vc2010.deploymentcontentgroup(prj, \" DeploymentContent \" , \" None \" ) \n end \n function vc2010.customtaskgroup(prj) \n local files = { } \n for _, custombuildtask in ipairs(prj.custombuildtask or {}) do \n for _, buildtask in ipairs(cus "
" tombuildtask or {}) do \n local fcfg = { } \n fcfg.name = path.getrelative(prj.location,buildtask[1]) \n fcfg.vpath = path.trimdots(fcfg.name) \n table.insert(files, fcfg) \n end \n end \n if #files > 0 then \n _p(1,'<ItemGroup>') \n local groupedBuildTasks = {} \n local buildTaskNames = {} \n for _, custombuildtask in ipairs(prj.custombuildtask or {}) do \n for _, buildtask in ipairs(custombuildtask or {}) do \n if (groupedBuildTasks[buildtask[1]] == nil) then \n groupedBuildTasks[buildtask[1]] = {} \n table.insert(buildTaskNames, buildtask[1]) \n end \n table.insert(groupedBuildTasks[buildtask[1]], buildtask) \n end \n end \n for _, name in ipairs(buildTaskNames) do \n custombuildtask = groupedBuildTasks[name] \n _p(2,'<CustomBuild Include= \\ \" %s \\ \" >', path.translate(path.getrelative(prj.location,name), \" \\ \\ \" )) \n _p(3,'<FileType>Text</FileType>') \n local cmd = \" \" \n local outputs = \" \" \n for _, buildtask in ipairs(custombuildtask or {}) do \n for _, cmdline in ipairs(buildtask[4] or {}) do \n cmd = cmd .. cmdline \n local num = 1 \n for _, depdata in ipair "
" s(buildtask[3] or {}) do \n cmd = string.gsub(cmd, \" %$%( \" .. num .. \" %) \" , string.format( \" %s \" ,path.getrelative(prj.location,depdata))) \n num = num + 1 \n end \n cmd = string.gsub(cmd, \" %$%(<%) \" , string.format( \" %s \" ,path.getrelative(prj.location,buildtask[1]))) \n cmd = string.gsub(cmd, \" %$%(@%) \" , string.format( \" %s \" ,path.getrelative(prj.location,buildtask[2]))) \n cmd = cmd .. \" \\ r \\ n \" \n end \n outputs = outputs .. path.getrelative(prj.location,buildtask[2]) .. \" ; \" \n end \n _p(3,'<Command>%s</Command>',cmd) \n _p(3,'<Outputs>%s%%(Outputs)</Outputs>',outputs) \n _p(3,'<SubType>Designer</SubType>') \n _p(3,'<Message></Message>') \n _p(2,'</CustomBuild>') \n end \n _p(1,'</ItemGroup>') \n end \n end \n function vc2010.simplefilesgroup(prj, section, subtype) \n local configs = prj.solution.vstudio_configs \n local files = vc2010.getfilegroup(prj, section) \n if #files > 0 then \n local config_mappings = {} \n for _, cfginfo in ipairs(configs) do \n local cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform) \n if cfg.pchheader "
" and cfg.pchsource and not cfg.flags.NoPCH then \n config_mappings[cfginfo] = path.translate(cfg.pchsource, \" \\ \\ \" ) \n end \n end \n _p(1,'<ItemGroup>') \n for _, file in ipairs(files) do \n local prjexcluded = table.icontains(prj.excludes, file.name) \n local excludedcfgs = {} \n if not prjexcluded then \n for _, vsconfig in ipairs(configs) do \n local cfg = premake.getconfig(prj, vsconfig.src_buildcfg, vsconfig.src_platform) \n local fileincfg = table.icontains(cfg.files, file.name) \n local cfgexcluded = table.icontains(cfg.excludes, file.name) \n if not fileincfg or cfgexcluded then \n table.insert(excludedcfgs, vsconfig.name) \n end \n end \n end \n if subtype or prjexcluded or #excludedcfgs > 0 then \n _p(2, '<%s Include= \\ \" %s \\ \" >', section, path.translate(file.name, \" \\ \\ \" )) \n if prjexcluded then \n _p(3, '<ExcludedFromBuild>true</ExcludedFromBuild>') \n else \n for _, cfgname in ipairs(excludedcfgs) do \n _p(3, '<ExcludedFromBuild ' \n .. if_config_and_platform() \n .. '>true</ExcludedFromBuild>' \n , premake.esc(cfgname) \n ) \n end \n end \n if subtype t "
" hen \n _p(3, '<SubType>%s</SubType>', subtype) \n end \n _p(2,'</%s>', section) \n else \n _p(2, '<%s Include= \\ \" %s \\ \" />', section, path.translate(file.name, \" \\ \\ \" )) \n end \n end \n _p(1,'</ItemGroup>') \n end \n end \n function vc2010.deploymentcontentgroup(prj, section, filetype) \n if filetype == nil then \n filetype = section \n end \n local files = vc2010.getfilegroup(prj, section) \n if #files > 0 then \n _p(1,'<ItemGroup>') \n for _, file in ipairs(files) do \n _p(2,'<%s Include= \\ \" %s \\ \" >', filetype, path.translate(file.name, \" \\ \\ \" )) \n _p(3,'<DeploymentContent>true</DeploymentContent>') \n _p(3,'<Link>%s</Link>', path.translate(file.vpath, \" \\ \\ \" )) \n _p(2,'</%s>', filetype) \n end \n _p(1,'</ItemGroup>') \n end \n end \n function vc2010.compilerfilesgroup(prj) \n local configs = prj.solution.vstudio_configs \n local files = vc2010.getfilegroup(prj, \" ClCompile \" ) \n if #files > 0 then \n local config_mappings = {} \n for _, cfginfo in ipairs(configs) do \n local cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform) \n if cfg.pchheade "
" r and cfg.pchsource and not cfg.flags.NoPCH then \n config_mappings[cfginfo] = path.translate(cfg.pchsource, \" \\ \\ \" ) \n end \n end \n _p(1,'<ItemGroup>') \n local existingBasenames = {}; \n for _, file in ipairs(files) do \n local filename = string.lower(path.getbasename(file.name)) \n local disambiguation = existingBasenames[filename] or 0; \n existingBasenames[filename] = disambiguation + 1 \n local translatedpath = path.translate(file.name, \" \\ \\ \" ) \n _p(2, '<ClCompile Include= \\ \" %s \\ \" >', translatedpath) \n for _, vsconfig in ipairs(configs) do \n local cfg = premake.getconfig(prj, vsconfig.src_buildcfg, vsconfig.src_platform) \n local namestyle = premake.getnamestyle(cfg) \n if namestyle == \" TegraAndroid \" or namestyle == \" NX \" then \n _p(3, '<ObjectFileName '.. if_config_and_platform() .. '>$(IntDir)%s.o</ObjectFileName>', premake.esc(vsconfig.name), premake.esc(path.translate(path.trimdots(path.removeext(file.name)))) ) \n else \n if disambiguation > 0 then \n _p(3, '<ObjectFileName '.. if_config_and_platform() .. '>$(IntDir)%s \\ \\ </ "
" ObjectFileName>', premake.esc(vsconfig.name), tostring(disambiguation)) \n end \n end \n end \n if path.iscxfile(file.name) then \n _p(3, '<CompileAsWinRT>true</CompileAsWinRT>') \n _p(3, '<RuntimeTypeInfo>true</RuntimeTypeInfo>') \n _p(3, '<PrecompiledHeader>NotUsing</PrecompiledHeader>') \n end \n if vstudio.iswinrt() and string.len(file.name) > 2 and string.sub(file.name, -2) == \" .c \" then \n _p(3,'<CompileAsWinRT>FALSE</CompileAsWinRT>') \n end \n for _, cfginfo in ipairs(configs) do \n if config_mappings[cfginfo] and translatedpath == config_mappings[cfginfo] then \n _p(3,'<PrecompiledHeader '.. if_config_and_platform() .. '>Create</PrecompiledHeader>', premake.esc(cfginfo.name)) \n config_mappings[cfginfo] = nil --only one source file per pch \n end \n end \n local nopch = table.icontains(prj.nopch, file.name) \n for _, vsconfig in ipairs(configs) do \n local cfg = premake.getconfig(prj, vsconfig.src_buildcfg, vsconfig.src_platform) \n if nopch or table.icontains(cfg.nopch, file.name) then \n _p(3,'<PrecompiledHeader '.. if_config_and_platform() "
" .. '>NotUsing</PrecompiledHeader>', premake.esc(vsconfig.name)) \n end \n end \n local excluded = table.icontains(prj.excludes, file.name) \n for _, vsconfig in ipairs(configs) do \n local cfg = premake.getconfig(prj, vsconfig.src_buildcfg, vsconfig.src_platform) \n local fileincfg = table.icontains(cfg.files, file.name) \n local cfgexcluded = table.icontains(cfg.excludes, file.name) \n if excluded or not fileincfg or cfgexcluded then \n _p(3, '<ExcludedFromBuild ' \n .. if_config_and_platform() \n .. '>true</ExcludedFromBuild>' \n , premake.esc(vsconfig.name) \n ) \n end \n end \n if prj.flags and prj.flags.Managed then \n local prjforcenative = table.icontains(prj.forcenative, file.name) \n for _,vsconfig in ipairs(configs) do \n local cfg = premake.getconfig(prj, vsconfig.src_buildcfg, vsconfig.src_platform) \n if prjforcenative or table.icontains(cfg.forcenative, file.name) then \n _p(3, '<CompileAsManaged ' .. if_config_and_platform() .. '>false</CompileAsManaged>', premake.esc(vsconfig.name)) \n end \n end \n end \n _p(2,'</ClCompile>') \n end \n _p(1,'</I "
" temGroup>') \n end \n end \n function vc2010.masmfiles(prj) \n local configs = prj.solution.vstudio_configs \n local files = vc2010.getfilegroup(prj, \" MASM \" ) \n if #files > 0 then \n _p(1, '<ItemGroup>') \n for _, file in ipairs(files) do \n local translatedpath = path.translate(file.name, \" \\ \\ \" ) \n _p(2, '<MASM Include= \" %s \" >', translatedpath) \n local excluded = table.icontains(prj.excludes, file.name) \n for _, vsconfig in ipairs(configs) do \n local cfg = premake.getconfig(prj, vsconfig.src_buildcfg, vsconfig.src_platform) \n local fileincfg = table.icontains(cfg.files, file.name) \n local cfgexcluded = table.icontains(cfg.excludes, file.name) \n if excluded or not fileincfg or cfgexcluded then \n _p(3, '<ExcludedFromBuild ' \n .. if_config_and_platform() \n .. '>true</ExcludedFromBuild>' \n , premake.esc(vsconfig.name) \n ) \n end \n end \n _p(2, '</MASM>') \n end \n _p(1, '</ItemGroup>') \n end \n end \n function vc2010.header(targets) \n io.eol = \" \\ r \\ n \" \n _p('<?xml version= \" 1.0 \" encoding= \" utf-8 \" ?>') \n local t = \" \" \n if targets then \n t = ' DefaultTar "
" gets= \" ' .. targets .. ' \" ' \n end \n _p('<Project%s ToolsVersion= \" %s \" xmlns= \" http://schemas.microsoft.com/developer/msbuild/2003 \" >', t, action.vstudio.toolsVersion) \n end \n function premake.vs2010_vcxproj(prj) \n local usemasm = hasmasmfiles(prj) \n io.indent = \" \" \n vc2010.header( \" Build \" ) \n vs2010_config(prj) \n vs2010_globals(prj) \n _p(1,'<Import Project= \" $(VCTargetsPath) \\ \\ Microsoft.Cpp.Default.props \" />') \n for _, cfginfo in ipairs(prj.solution.vstudio_configs) do \n local cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform) \n vc2010.configurationPropertyGroup(cfg, cfginfo) \n end \n _p(1,'<Import Project= \" $(VCTargetsPath) \\ \\ Microsoft.Cpp.props \" />') \n _p(1,'<ImportGroup Label= \" ExtensionSettings \" >') \n if usemasm then \n _p(2, '<Import Project= \" $(VCTargetsPath) \\ \\ BuildCustomizations \\ \\ masm.props \" />') \n end \n _p(1,'</ImportGroup>') \n import_props(prj) \n _p(1,'<PropertyGroup Label= \" UserMacros \" />') \n vc2010.outputProperties(prj) \n item_definitions(prj) \n vc2010.files(prj) \n vc2010.clrReferences(prj) "
" \n vc2010.projectReferences(prj) \n vc2010.sdkReferences(prj) \n vc2010.masmfiles(prj) \n _p(1,'<Import Project= \" $(VCTargetsPath) \\ \\ Microsoft.Cpp.targets \" />') \n _p(1,'<ImportGroup Label= \" ExtensionTargets \" >') \n if usemasm then \n _p(2, '<Import Project= \" $(VCTargetsPath) \\ \\ BuildCustomizations \\ \\ masm.targets \" />') \n end \n _p(1,'</ImportGroup>') \n _p('</Project>') \n end \n function vc2010.clrReferences(prj) \n if #prj.clrreferences == 0 then \n return \n end \n _p(1,'<ItemGroup>') \n for _, ref in ipairs(prj.clrreferences) do \n if os.isfile(ref) then \n local assembly = path.getbasename(ref) \n _p(2,'<Reference Include= \" %s \" >', assembly) \n _p(3,'<HintPath>%s</HintPath>', path.getrelative(prj.location, ref)) \n _p(2,'</Reference>') \n else \n _p(2,'<Reference Include= \" %s \" />', ref) \n end \n end \n _p(1,'</ItemGroup>') \n end \n function vc2010.projectReferences(prj) \n local deps = premake.getdependencies(prj) \n if #deps == 0 and #prj.vsimportreferences == 0 then \n return \n end \n local function compareuuid(a, b) return a.uuid < b.uuid end \n table.sort(deps "
" , compareuuid) \n table.sort(table.join(prj.vsimportreferences), compareuuid) \n _p(1,'<ItemGroup>') \n for _, dep in ipairs(deps) do \n local deppath = path.getrelative(prj.location, vstudio.projectfile(dep)) \n _p(2,'<ProjectReference Include= \\ \" %s \\ \" >', path.translate(deppath, \" \\ \\ \" )) \n _p(3,'<Project>{%s}</Project>', dep.uuid) \n if vstudio.iswinrt() then \n _p(3,'<ReferenceOutputAssembly>false</ReferenceOutputAssembly>') \n end \n _p(2,'</ProjectReference>') \n end \n for _, ref in ipairs(prj.vsimportreferences) do \n local slnrelpath = path.rebase(ref, prj.location, sln.location) \n local iprj = premake.vstudio.getimportprj(slnrelpath, prj.solution) \n _p(2,'<ProjectReference Include= \\ \" %s \\ \" >', ref) \n _p(3,'<Project>{%s}</Project>', iprj.uuid) \n _p(2,'</ProjectReference>') \n end \n _p(1,'</ItemGroup>') \n end \n function vc2010.sdkReferences(prj) \n local refs = prj.sdkreferences \n if #refs > 0 then \n _p(1,'<ItemGroup>') \n for _, ref in ipairs(refs) do \n _p(2,'<SDKReference Include= \\ \" %s \\ \" />', ref) \n end \n _p(1,'</ItemGroup>') \n end \n end "
" \n function vc2010.debugdir(cfg) \n local isnx = (cfg.platform == \" NX32 \" or cfg.platform == \" NX64 \" ) \n local debuggerFlavor = \n iif(isnx, 'OasisNXDebugger' \n , iif(cfg.platform == \" Orbis \" , 'ORBISDebugger' \n , iif(cfg.platform == \" Durango \" , 'XboxOneVCppDebugger' \n , iif(cfg.platform == \" TegraAndroid \" , 'AndroidDebugger' \n , iif(vstudio.iswinrt(), 'AppHostLocalDebugger' \n , 'WindowsLocalDebugger' \n ))))) \n _p(2, '<DebuggerFlavor>%s</DebuggerFlavor>', debuggerFlavor) \n if cfg.debugdir and not vstudio.iswinrt() then \n _p(2, '<LocalDebuggerWorkingDirectory>%s</LocalDebuggerWorkingDirectory>' \n , path.translate(cfg.debugdir, ' \\ \\ ') \n ) \n end \n if cfg.debugcmd then \n _p(2, '<LocalDebuggerCommand>%s</LocalDebuggerCommand>', cfg.debugcmd) \n end \n if cfg.debugargs then \n _p(2, '<LocalDebuggerCommandArguments>%s</LocalDebuggerCommandArguments>' \n , table.concat(cfg.debugargs, \" \" ) \n ) \n end \n if cfg.debugenvs and #cfg.debugenvs > 0 then \n _p(2, '<Lo "
" calDebuggerEnvironment>%s%s</LocalDebuggerEnvironment>' \n , table.concat(cfg.debugenvs, \" \\ n \" ) \n , iif(cfg.flags.DebugEnvsInherit,' \\ n$(LocalDebuggerEnvironment)', '') \n ) \n if cfg.flags.DebugEnvsDontMerge then \n _p(2, '<LocalDebuggerMergeEnvironment>false</LocalDebuggerMergeEnvironment>') \n end \n end \n if cfg.deploymode then \n _p(2, '<DeployMode>%s</DeployMode>', cfg.deploymode) \n end \n if cfg.platform == \" TegraAndroid \" then \n if cfg.androiddebugintentparams then \n _p(2, '<IntentParams>%s</IntentParams>' \n , table.concat(cfg.androiddebugintentparams, \" \" ) \n ) \n end \n end \n end \n function premake.vs2010_vcxproj_user(prj) \n io.indent = \" \" \n vc2010.header() \n for _, cfginfo in ipairs(prj.solution.vstudio_configs) do \n local cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform) \n _p(' <PropertyGroup '.. if_config_and_platform() ..'>', premake.esc(cfginfo.name)) \n vc2010.debugdir(cfg) \n _p(' </PropertyGroup>') \n end \n _p('</Project>') \n end \n local png1x1data = { \n 0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, 0 "
" x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, -- .PNG........IHDR \n 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x01, 0x03, 0x00, 0x00, 0x00, 0x25, 0xdb, 0x56, -- .............%.V \n 0xca, 0x00, 0x00, 0x00, 0x03, 0x50, 0x4c, 0x54, 0x45, 0x00, 0x00, 0x00, 0xa7, 0x7a, 0x3d, 0xda, -- .....PLTE....z=. \n 0x00, 0x00, 0x00, 0x01, 0x74, 0x52, 0x4e, 0x53, 0x00, 0x40, 0xe6, 0xd8, 0x66, 0x00, 0x00, 0x00, -- ....tRNS.@..f... \n 0x0a, 0x49, 0x44, 0x41, 0x54, 0x08, 0xd7, 0x63, 0x60, 0x00, 0x00, 0x00, 0x02, 0x00, 0x01, 0xe2, -- .IDAT..c`....... \n 0x21, 0xbc, 0x33, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82, -- !.3....IEND.B`. \n } \n function png1x1(obj, filename) \n filename = premake.project.getfilename(obj, filename) \n local f, err = io.open(filename, \" wb \" ) \n if f then \n for _, byte in ipairs(png1x1data) do \n f:write(string.char(byte)) \n end \n f:close() \n end \n end \n function premake.vs2010_appxmanifest(prj) \n io.indent = \" \" \n io.eol = \" \\ r \\ n \" \n _p('<?xml version= \" 1.0 \" encoding= \" utf-8 \" ?>') \n if v "
" studio.storeapp == \" 10.0 \" then \n _p('<Package') \n _p(1, 'xmlns= \" http://schemas.microsoft.com/appx/manifest/foundation/windows10 \" ') \n _p(1, 'xmlns:mp= \" http://schemas.microsoft.com/appx/2014/phone/manifest \" ') \n _p(1, 'xmlns:uap= \" http://schemas.microsoft.com/appx/manifest/uap/windows10 \" ') \n _p(1, 'IgnorableNamespaces= \" uap mp \" >') \n elseif vstudio.storeapp == \" durango \" then \n _p('<Package xmlns= \" http://schemas.microsoft.com/appx/2010/manifest \" xmlns:mx= \" http://schemas.microsoft.com/appx/2013/xbox/manifest \" IgnorableNamespaces= \" mx \" >') \n end \n _p(1, '<Identity') \n _p(2, 'Name= \" ' .. prj.uuid .. ' \" ') \n _p(2, 'Publisher= \" CN=Publisher \" ') \n _p(2, 'Version= \" 1.0.0.0 \" />') \n if vstudio.storeapp == \" 10.0 \" then \n _p(1, '<mp:PhoneIdentity') \n _p(2, 'PhoneProductId= \" ' .. prj.uuid .. ' \" ') \n _p(2, 'PhonePublisherId= \" 00000000-0000-0000-0000-000000000000 \" />') \n end \n _p(1, '<Properties>') \n _p(2, '<DisplayName>' .. prj.name .. '</DisplayName>') \n _p(2, '<PublisherDisplayName>PublisherDisplayName</PublisherDisplayName>') \n _ "
" p(2, '<Logo>' .. prj.name .. ' \\ \\ StoreLogo.png</Logo>') \n png1x1(prj, \" %%/StoreLogo.png \" ) \n _p(2, '<Description>' .. prj.name .. '</Description>') \n _p(1,'</Properties>') \n if vstudio.storeapp == \" 10.0 \" then \n _p(1, '<Dependencies>') \n _p(2, '<TargetDeviceFamily Name= \" Windows.Universal \" MinVersion= \" 10.0.10069.0 \" MaxVersionTested= \" 10.0.10069.0 \" />') \n _p(1, '</Dependencies>') \n elseif vstudio.storeapp == \" durango \" then \n _p(1, '<Prerequisites>') \n _p(2, '<OSMinVersion>6.2</OSMinVersion>') \n _p(2, '<OSMaxVersionTested>6.2</OSMaxVersionTested>') \n _p(1, '</Prerequisites>') \n end \n _p(1, '<Resources>') \n _p(2, '<Resource Language= \" en-us \" />') \n _p(1, '</Resources>') \n _p(1, '<Applications>') \n _p(2, '<Application Id= \" App \" ') \n _p(3, 'Executable= \" $targetnametoken$.exe \" ') \n _p(3, 'EntryPoint= \" ' .. prj.name .. '.App \" >') \n if vstudio.storeapp == \" 10.0 \" then \n _p(3, '<uap:VisualElements') \n _p(4, 'DisplayName= \" ' .. prj.name .. ' \" ') \n _p(4, 'Square150x150Logo= \" ' .. prj.name .. ' \\ \\ Logo.png \" ') \n png1x1(prj, \" %%/Logo.pn "
" g \" ) \n if vstudio.storeapp == \" 10.0 \" then \n _p(4, 'Square44x44Logo= \" ' .. prj.name .. ' \\ \\ SmallLogo.png \" ') \n png1x1(prj, \" %%/SmallLogo.png \" ) \n else \n _p(4, 'Square30x30Logo= \" ' .. prj.name .. ' \\ \\ SmallLogo.png \" ') \n png1x1(prj, \" %%/SmallLogo.png \" ) \n end \n _p(4, 'Description= \" ' .. prj.name .. ' \" ') \n _p(4, 'BackgroundColor= \" transparent \" >') \n _p(4, '<uap:SplashScreen Image= \" ' .. prj.name .. ' \\ \\ SplashScreen.png \" />') \n png1x1(prj, \" %%/SplashScreen.png \" ) \n _p(3, '</uap:VisualElements>') \n elseif vstudio.storeapp == \" durango \" then \n _p(3, '<VisualElements') \n _p(4, 'DisplayName= \" ' .. prj.name .. ' \" ') \n _p(4, 'Logo= \" ' .. prj.name .. ' \\ \\ Logo.png \" ') \n png1x1(prj, \" %%/Logo.png \" ) \n _p(4, 'SmallLogo= \" ' .. prj.name .. ' \\ \\ SmallLogo.png \" ') \n png1x1(prj, \" %%/SmallLogo.png \" ) \n _p(4, 'Description= \" ' .. prj.name .. ' \" ') \n _p(4, 'ForegroundText= \" light \" ') \n _p(4, 'BackgroundColor= \" transparent \" >') \n _p(5, '<SplashScreen Image= \" ' .. prj.name .. ' \\ \\ SplashScreen.png \" />') \n png1x1(prj, \" %%/SplashScreen.png \" ) \n _p "
" (3, '</VisualElements>') \n _p(3, '<Extensions>') \n _p(4, '<mx:Extension Category= \" xbox.system.resources \" >') \n _p(4, '<mx:XboxSystemResources />') \n _p(4, '</mx:Extension>') \n _p(3, '</Extensions>') \n end \n _p(2, '</Application>') \n _p(1, '</Applications>') \n _p('</Package>') \n end \n " ,
/* actions/vstudio/vstudio_vcxproj_filters.lua */
" local vc2010 = premake.vstudio.vc2010 \n local project = premake.project \n function vc2010.filteridgroup(prj) \n local filters = { } \n local filterfound = false \n for file in premake.project.eachfile(prj, true) do \n local folders = string.explode(file.vpath, \" / \" , true) \n local path = \" \" \n for i = 1, #folders - 1 do \n if not filterfound then \n filterfound = true \n _p(1,'<ItemGroup>') \n end \n path = path .. folders[i] \n if not filters[path] then \n filters[path] = true \n _p(2, '<Filter Include= \" %s \" >', path) \n _p(3, '<UniqueIdentifier>{%s}</UniqueIdentifier>', os.uuid(path)) \n _p(2, '</Filter>') \n end \n path = path .. \" \\ \\ \" \n end \n end \n for _, custombuildtask in ipairs(prj.custombuildtask or {}) do \n for _, buildtask in ipairs(custombuildtask or {}) do \n local folders = string.explode(path.trimdots(path.getrelative(prj.location,buildtask[1])), \" / \" , true) \n local path = \" \" \n for i = 1, #folders - 1 do \n if not filterfound then \n filterfound = true \n _p(1,'<ItemGroup>') \n end \n path = path .. folders[i] \n if not filters[path] then \n filt "
" ers[path] = true \n _p(2, '<Filter Include= \" %s \" >', path) \n _p(3, '<UniqueIdentifier>{%s}</UniqueIdentifier>', os.uuid(path)) \n _p(2, '</Filter>') \n end \n path = path .. \" \\ \\ \" \n end \n end \n end \n if filterfound then \n _p(1,'</ItemGroup>') \n end \n end \n function vc2010.filefiltergroup(prj, section, kind) \n local files = vc2010.getfilegroup(prj, section) or {} \n if kind == nill then \n kind = section \n end \n if (section == \" CustomBuild \" ) then \n for _, custombuildtask in ipairs(prj.custombuildtask or {}) do \n for _, buildtask in ipairs(custombuildtask or {}) do \n local fcfg = { } \n fcfg.name = path.getrelative(prj.location,buildtask[1]) \n fcfg.vpath = path.trimdots(fcfg.name) \n table.insert(files, fcfg) \n end \n end \n end \n if #files > 0 then \n _p(1,'<ItemGroup>') \n for _, file in ipairs(files) do \n local filter \n if file.name ~= file.vpath then \n filter = path.getdirectory(file.vpath) \n else \n filter = path.getdirectory(file.name) \n end \n if filter ~= \" . \" then \n _p(2,'<%s Include= \\ \" %s \\ \" >', kind, path.translate(file.name, \" \\ \\ \" )) \n _p(3,'< "
" Filter>%s</Filter>', path.translate(filter, \" \\ \\ \" )) \n _p(2,'</%s>', kind) \n else \n _p(2,'<%s Include= \\ \" %s \\ \" />', kind, path.translate(file.name, \" \\ \\ \" )) \n end \n end \n _p(1,'</ItemGroup>') \n end \n end \n function vc2010.generate_filters(prj) \n io.indent = \" \" \n vc2010.header() \n vc2010.filteridgroup(prj) \n vc2010.filefiltergroup(prj, \" None \" ) \n vc2010.filefiltergroup(prj, \" ClInclude \" ) \n vc2010.filefiltergroup(prj, \" ClCompile \" ) \n vc2010.filefiltergroup(prj, \" ResourceCompile \" ) \n vc2010.filefiltergroup(prj, \" CustomBuild \" ) \n vc2010.filefiltergroup(prj, \" AppxManifest \" ) \n vc2010.filefiltergroup(prj, \" Natvis \" ) \n vc2010.filefiltergroup(prj, \" Image \" ) \n vc2010.filefiltergroup(prj, \" DeploymentContent \" , \" None \" ) \n vc2010.filefiltergroup(prj, \" MASM \" ) \n _p('</Project>') \n end \n " ,
" Filter>%s</Filter>', path.translate(filter, \" \\ \\ \" )) \n _p(2,'</%s>', kind) \n else \n _p(2,'<%s Include= \\ \" %s \\ \" />', kind, path.translate(file.name, \" \\ \\ \" )) \n end \n end \n _p(1,'</ItemGroup>') \n end \n end \n function vc2010.generate_filters(prj) \n io.indent = \" \" \n vc2010.header() \n vc2010.filteridgroup(prj) \n vc2010.filefiltergroup(prj, \" None \" ) \n vc2010.filefiltergroup(prj, \" ClInclude \" ) \n vc2010.filefiltergroup(prj, \" ClCompile \" ) \n vc2010.filefiltergroup(prj, \" Object\" ) \n vc2010.filefiltergroup(prj, \" ResourceCompile\" ) \n vc2010.filefiltergroup(prj, \" CustomBuild \" ) \n vc2010.filefiltergroup(prj, \" AppxManifest \" ) \n vc2010.filefiltergroup(prj, \" Natvis \" ) \n vc2010.filefiltergroup(prj, \" Image \" ) \n vc2010.filefiltergroup(prj, \" DeploymentContent \" , \" None \" ) \n vc2010.filefiltergroup(prj, \" MASM \" ) \n _p('</Project>') \n end \n " ,
/* actions/vstudio/vs2010.lua */
" local vc2010 = premake.vstudio.vc2010 \n local vstudio = premake.vstudio \n newaction \n { \n trigger = \" vs2010 \" , \n shortname = \" Visual Studio 2010 \" , \n description = \" Generate Microsoft Visual Studio 2010 project files \" , \n os = \" windows \" , \n valid_kinds = { \" ConsoleApp \" , \" WindowedApp \" , \" StaticLib \" , \" SharedLib \" , \" Bundle \" }, \n valid_languages = { \" C \" , \" C++ \" , \" C# \" }, \n valid_tools = { \n cc = { \" msc \" }, \n dotnet = { \" msnet \" }, \n }, \n onsolution = function(sln) \n premake.generate(sln, \" %%.sln \" , vstudio.sln2005.generate) \n end, \n onproject = function(prj) \n if premake.isdotnetproject(prj) then \n premake.generate(prj, \" %%.csproj \" , vstudio.cs2005.generate) \n premake.generate(prj, \" %%.csproj.user \" , vstudio.cs2005.generate_user) \n else \n premake.generate(prj, \" %%.vcxproj \" , premake.vs2010_vcxproj) \n premake.generate(prj, \" %%.vcxproj.user \" , premake.vs2010_vcxproj_user) \n premake.generate(prj, \" %%.vcxproj.filters \" , vstudio.vc2010.generate_filters) \n end \n end, \n oncleanso "
@ -336,79 +361,106 @@ const char* builtin_scripts[] = {
/* actions/vstudio/vs2017.lua */
" premake.vstudio.vc2017 = {} \n local vc2017 = premake.vstudio.vc2017 \n local vstudio = premake.vstudio \n newaction \n { \n trigger = \" vs2017 \" , \n shortname = \" Visual Studio 2017 \" , \n description = \" Generate Microsoft Visual Studio 2017 project files \" , \n os = \" windows \" , \n valid_kinds = { \" ConsoleApp \" , \" WindowedApp \" , \" StaticLib \" , \" SharedLib \" , \" Bundle \" }, \n valid_languages = { \" C \" , \" C++ \" , \" C# \" }, \n valid_tools = { \n cc = { \" msc \" }, \n dotnet = { \" msnet \" }, \n }, \n onsolution = function(sln) \n premake.generate(sln, \" %%.sln \" , vstudio.sln2005.generate) \n end, \n onproject = function(prj) \n if premake.isdotnetproject(prj) then \n premake.generate(prj, \" %%.csproj \" , vstudio.cs2005.generate) \n premake.generate(prj, \" %%.csproj.user \" , vstudio.cs2005.generate_user) \n else \n premake.vstudio.needAppxManifest = false \n premake.generate(prj, \" %%.vcxproj \" , premake.vs2010_vcxproj) \n premake.generate(prj, \" %%.vcxproj.user \" , premake.vs2010_vcxproj_user) \n premake.generate(prj, \" %%.v "
" cxproj.filters \" , vstudio.vc2010.generate_filters) \n if premake.vstudio.needAppxManifest then \n premake.generate(prj, \" %%/Package.appxmanifest \" , premake.vs2010_appxmanifest) \n end \n end \n end, \n oncleansolution = premake.vstudio.cleansolution, \n oncleanproject = premake.vstudio.cleanproject, \n oncleantarget = premake.vstudio.cleantarget, \n vstudio = { \n solutionVersion = \" 12 \" , \n targetFramework = \" 4.5.2 \" , \n toolsVersion = \" 15.0 \" , \n windowsTargetPlatformVersion = \" 8.1 \" , \n supports64bitEditContinue = true, \n intDirAbsolute = true, \n } \n } \n " ,
" cxproj.filters \" , vstudio.vc2010.generate_filters) \n if premake.vstudio.needAppxManifest then \n premake.generate(prj, \" %%/Package.appxmanifest \" , premake.vs2010_appxmanifest) \n end \n end \n end, \n oncleansolution = premake.vstudio.cleansolution, \n oncleanproject = premake.vstudio.cleanproject, \n oncleantarget = premake.vstudio.cleantarget, \n vstudio = { \n solutionVersion = \" 12 \" , \n targetFramework = \" 4.5.2 \" , \n toolsVersion = \" 15.0 \" , \n windowsTargetPlatformVersion = \" 8.1 \" , \n supports64bitEditContinue = true, \n intDirAbsolute = false, \n } \n } \n " ,
/* actions/vstudio/vs2019.lua */
" premake.vstudio.vc2019 = {} \n local vc2019 = premake.vstudio.vc2019 \n local vstudio = premake.vstudio \n newaction \n { \n trigger = \" vs2019 \" , \n shortname = \" Visual Studio 2019 \" , \n description = \" Generate Microsoft Visual Studio 2019 project files \" , \n os = \" windows \" , \n valid_kinds = { \" ConsoleApp \" , \" WindowedApp \" , \" StaticLib \" , \" SharedLib \" , \" Bundle \" }, \n valid_languages = { \" C \" , \" C++ \" , \" C# \" }, \n valid_tools = { \n cc = { \" msc \" }, \n dotnet = { \" msnet \" }, \n }, \n onsolution = function(sln) \n premake.generate(sln, \" %%.sln \" , vstudio.sln2005.generate) \n end, \n onproject = function(prj) \n if premake.isdotnetproject(prj) then \n premake.generate(prj, \" %%.csproj \" , vstudio.cs2005.generate) \n premake.generate(prj, \" %%.csproj.user \" , vstudio.cs2005.generate_user) \n else \n premake.vstudio.needAppxManifest = false \n premake.generate(prj, \" %%.vcxproj \" , premake.vs2010_vcxproj) \n premake.generate(prj, \" %%.vcxproj.user \" , premake.vs2010_vcxproj_user) \n premake.generate(prj, \" %%.v "
" cxproj.filters \" , vstudio.vc2010.generate_filters) \n if premake.vstudio.needAppxManifest then \n premake.generate(prj, \" %%/Package.appxmanifest \" , premake.vs2010_appxmanifest) \n end \n end \n end, \n oncleansolution = premake.vstudio.cleansolution, \n oncleanproject = premake.vstudio.cleanproject, \n oncleantarget = premake.vstudio.cleantarget, \n vstudio = { \n solutionVersion = \" 12 \" , \n targetFramework = \" 4.7.2 \" , \n toolsVersion = \" 16.0 \" , \n windowsTargetPlatformVersion = \" 10.0 \" , \n supports64bitEditContinue = true, \n intDirAbsolute = false, \n } \n } \n " ,
/* actions/vstudio/vsllvm.lua */
" premake.vstudio.vcllvm = {} \n local vcllvm = premake.vstudio.vcllvm \n local vstudio = premake.vstudio \n newaction \n { \n trigger = \" vsllvm \" , \n shortname = \" Visual Studio LLVM \" , \n description = \" Generate Microsoft Visual Studio LLVM project files \" , \n os = \" windows \" , \n valid_kinds = { \" ConsoleApp \" , \" WindowedApp \" , \" StaticLib \" , \" SharedLib \" , \" Bundle \" }, \n valid_languages = { \" C \" , \" C++ \" , \" C# \" }, \n valid_tools = { \n cc = { \" msc \" }, \n dotnet = { \" msnet \" }, \n }, \n onsolution = function(sln) \n premake.generate(sln, \" %%.sln \" , vstudio.sln2005.generate) \n end, \n onproject = function(prj) \n if premake.isdotnetproject(prj) then \n premake.generate(prj, \" %%.csproj \" , vstudio.cs2005.generate) \n premake.generate(prj, \" %%.csproj.user \" , vstudio.cs2005.generate_user) \n else \n premake.vstudio.needAppxManifest = false \n premake.generate(prj, \" %%.vcxproj \" , premake.vs2010_vcxproj) \n premake.generate(prj, \" %%.vcxproj.user \" , premake.vs2010_vcxproj_user) \n premake.generate(prj, \" %%.v "
" cxproj.filters \" , vstudio.vc2010.generate_filters) \n if premake.vstudio.needAppxManifest then \n premake.generate(prj, \" %%/Package.appxmanifest \" , premake.vs2010_appxmanifest) \n end \n end \n end, \n oncleansolution = premake.vstudio.cleansolution, \n oncleanproject = premake.vstudio.cleanproject, \n oncleantarget = premake.vstudio.cleantarget, \n vstudio = { \n solutionVersion = \" 12 \" , \n targetFramework = \" 4.5.2 \" , \n toolsVersion = \" 15.0 \" , \n windowsTargetPlatformVersion = \" 8.1 \" , \n supports64bitEditContinue = true, \n intDirAbsolute = true, \n } \n } \n " ,
/* actions/xcode/_xcode.lua */
" premake.xcode = { } \n premake.xcode.xcode6 = { } \n local function checkproject(prj) \n local last \n for cfg in premake.eachconfig(prj) do \n if last and last ~= cfg.kind then \n error( \" Project ' \" .. prj.name .. \" ' uses more than one target kind; not supported by Xcode \" , 0) \n end \n last = cfg.kind \n end \n end \n premake.xcode.toolset = \" macosx \" \n newaction \n { \n trigger = \" xcode3 \" , \n shortname = \" Xcode 3 \" , \n description = \" Generate Apple Xcode 3 project files (experimental) \" , \n os = \" macosx \" , \n valid_kinds = { \" ConsoleApp \" , \" WindowedApp \" , \" StaticLib \" , \" SharedLib \" , \" Bundle \" }, \n valid_languages = { \" C \" , \" C++ \" }, \n valid_tools = { \n cc = { \" gcc \" }, \n }, \n valid_platforms = { \n Native = \" Native \" , \n x32 = \" Native 32-bit \" , \n x64 = \" Native 64-bit \" , \n Universal32 = \" 32-bit Universal \" , \n Universal64 = \" 64-bit Universal \" , \n Universal = \" Universal \" , \n }, \n default_platform = \" Universal \" , \n onsolution = function(sln) \n premake.xcode.preparesolution(sln) \n end, \n onproject = "
" function(prj) \n premake.generate(prj, \" %%.xcodeproj/project.pbxproj \" , premake.xcode.project) \n end, \n oncleanproject = function(prj) \n premake.clean.directory(prj, \" %%.xcodeproj \" ) \n end, \n oncheckproject = checkproject, \n } \n newaction \n { \n trigger = \" xcode4 \" , \n shortname = \" Xcode 4 \" , \n description = \" Generate Apple Xcode 4 project files (experimental) \" , \n os = \" macosx \" , \n valid_kinds = { \" ConsoleApp \" , \" WindowedApp \" , \" StaticLib \" , \" SharedLib \" , \" Bundle \" }, \n valid_languages = { \" C \" , \" C++ \" }, \n valid_tools = { \n cc = { \" gcc \" }, \n }, \n valid_platforms = { \n Native = \" Native \" , \n x32 = \" Native 32-bit \" , \n x64 = \" Native 64-bit \" , \n Universal32 = \" 32-bit Universal \" , \n Universal64 = \" 64-bit Universal \" , \n Universal = \" Universal \" , \n }, \n default_platform = \" Universal \" , \n onsolution = function(sln) \n premake.generate(sln, \" %%.xcworkspace/contents.xcworkspacedata \" , premake.xcode4.workspace_generate) \n end, \n onproject = function(prj) \n premake.generate(prj, \" %%.xcodepr "
" oj/project.pbxproj \" , premake.xcode.project) \n end, \n oncleanproject = function(prj) \n premake.clean.directory(prj, \" %%.xcodeproj \" ) \n premake.clean.directory(prj, \" %%.xcworkspace \" ) \n end, \n oncheckproject = checkproject, \n } \n " ,
" premake.xcode = { } \n function premake.xcode.checkproject(prj) \n local last \n for cfg in premake.eachconfig(prj) do \n if last and last ~= cfg.kind then \n error( \" Project ' \" .. prj.name .. \" ' uses more than one target kind; not supported by Xcode \" , 0) \n end \n last = cfg.kind \n end \n end \n premake.xcode.toolset = \" macosx \" \n " ,
/* actions/xcode/xcode_common.lua */
" premake.xcode.parameters = { } \n local xcode = premake.xcode \n local tree = premake.tree \n function xcode.getbuildcategory(node) \n local categories = { \n [ \" .a \" ] = \" Frameworks \" , \n [ \" .c \" ] = \" Sources \" , \n [ \" .cc \" ] = \" Sources \" , \n [ \" .cpp \" ] = \" Sources \" , \n [ \" .cxx \" ] = \" Sources \" , \n [ \" .dylib \" ] = \" Frameworks \" , \n [ \" .bundle \" ] = \" Frameworks \" , \n [ \" .framework \" ] = \" Frameworks \" , \n [ \" .tbd \" ] = \" Frameworks \" , \n [ \" .m \" ] = \" Sources \" , \n [ \" .mm \" ] = \" Sources \" , \n [ \" .S \" ] = \" Sources \" , \n [ \" .strings \" ] = \" Resources \" , \n [ \" .nib \" ] = \" Resources \" , \n [ \" .xib \" ] = \" Resources \" , \n [ \" .icns \" ] = \" Resources \" , \n [ \" .bmp \" ] = \" Resources \" , \n [ \" .wav \" ] = \" Resources \" , \n [ \" .xcassets \" ] = \" Resources \" , \n [ \" .xcdatamodeld \" ] = \" Sources \" , \n [ \" .swift \" ] = \" Sources \" , \n } \n return categories[path.getextension(node.name)] \n end \n function xcode.getconfigname(cfg) \n local name = cfg.name \n if #cfg.project.solution.xcode.platforms > 1 then \n name = name .. \" \" .. premake.action.current().valid_platforms[cfg.platform] \n end \n retur "
" n name \n end \n function xcode.getfiletype(node) \n local types = { \n [ \" .c \" ] = \" sourcecode.c.c \" , \n [ \" .cc \" ] = \" sourcecode.cpp.cpp \" , \n [ \" .cpp \" ] = \" sourcecode.cpp.cpp \" , \n [ \" .css \" ] = \" text.css \" , \n [ \" .cxx \" ] = \" sourcecode.cpp.cpp \" , \n [ \" .entitlements \" ] = \" text.xml \" , \n [ \" .bundle \" ] = \" wrapper.cfbundle \" , \n [ \" .framework \" ] = \" wrapper.framework \" , \n [ \" .tbd \" ] = \" sourcecode.text-based-dylib-definition \" , \n [ \" .gif \" ] = \" image.gif \" , \n [ \" .h \" ] = \" sourcecode.c.h \" , \n [ \" .html \" ] = \" text.html \" , \n [ \" .lua \" ] = \" sourcecode.lua \" , \n [ \" .m \" ] = \" sourcecode.c.objc \" , \n [ \" .mm \" ] = \" sourcecode.cpp.objcpp \" , \n [ \" .S \" ] = \" sourcecode.asm \" , \n [ \" .nib \" ] = \" wrapper.nib \" , \n [ \" .pch \" ] = \" sourcecode.c.h \" , \n [ \" .plist \" ] = \" text.plist.xml \" , \n [ \" .strings \" ] = \" text.plist.strings \" , \n [ \" .xib \" ] = \" file.xib \" , \n [ \" .icns \" ] = \" image.icns \" , \n [ \" .bmp \" ] = \" image.bmp \" , \n [ \" .wav \" ] = \" au "
" dio.wav \" , \n [ \" .xcassets \" ] = \" folder.assetcatalog \" , \n [ \" .xcdatamodeld \" ] = \" wrapper.xcdatamodeld \" , \n [ \" .swift \" ] = \" sourcecode.swift \" , \n } \n return types[path.getextension(node.path)] or \" text \" \n end \n function xcode.getfiletypeForced(node) \n local types = { \n [ \" .c \" ] = \" sourcecode.cpp.cpp \" , \n [ \" .cc \" ] = \" sourcecode.cpp.cpp \" , \n [ \" .cpp \" ] = \" sourcecode.cpp.cpp \" , \n [ \" .css \" ] = \" text.css \" , \n [ \" .cxx \" ] = \" sourcecode.cpp.cpp \" , \n [ \" .entitlements \" ] = \" text.xml \" , \n [ \" .bundle \" ] = \" wrapper.cfbundle \" , \n [ \" .framework \" ] = \" wrapper.framework \" , \n [ \" .tbd \" ] = \" wrapper.framework \" , \n [ \" .gif \" ] = \" image.gif \" , \n [ \" .h \" ] = \" sourcecode.cpp.h \" , \n [ \" .html \" ] = \" text.html \" , \n [ \" .lua \" ] = \" sourcecode.lua \" , \n [ \" .m \" ] = \" sourcecode.cpp.objcpp \" , \n [ \" .mm \" ] = \" sourcecode.cpp.objcpp \" , \n [ \" .nib \" ] = \" wrapper.nib \" , \n [ \" .pch \" ] = \" sourcecode.cpp.h \" , \n [ \" .plist \" ] = \" text.plist.xml \" , \n [ \" .strings \" ] "
" = \" text.plist.strings \" , \n [ \" .xib \" ] = \" file.xib \" , \n [ \" .icns \" ] = \" image.icns \" , \n [ \" .bmp \" ] = \" image.bmp \" , \n [ \" .wav \" ] = \" audio.wav \" , \n [ \" .xcassets \" ] = \" folder.assetcatalog \" , \n [ \" .xcdatamodeld \" ] = \" wrapper.xcdatamodeld \" , \n [ \" .swift \" ] = \" sourcecode.swift \" , \n } \n return types[path.getextension(node.path)] or \" text \" \n end \n function xcode.getproducttype(node) \n local types = { \n ConsoleApp = \" com.apple.product-type.tool \" , \n WindowedApp = \" com.apple.product-type.application \" , \n StaticLib = \" com.apple.product-type.library.static \" , \n SharedLib = \" com.apple.product-type.library.dynamic \" , \n Bundle = \" com.apple.product-type.bundle \" , \n } \n return types[node.cfg.kind] \n end \n function xcode.gettargettype(node) \n local types = { \n ConsoleApp = \" \\ \" compiled.mach-o.executable \\ \" \" , \n WindowedApp = \" wrapper.application \" , \n StaticLib = \" archive.ar \" , \n SharedLib = \" \\ \" compiled.mach-o.dylib \\ \" \" , \n Bundle = \" wrapper.cfbundle \" , \n } \n return types[node.cfg.kind] "
" \n end \n function xcode.getxcodeprojname(prj) \n local fname = premake.project.getfilename(prj, \" %%.xcodeproj \" ) \n return fname \n end \n function xcode.isframework(fname) \n return (path.getextension(fname) == \" .framework \" or path.getextension(fname) == \" .tbd \" ) \n end \n function xcode.newid() \n return string.format( \" %04X%04X%04X%04X%04X%04X \" , \n math.random(0, 32767), \n math.random(0, 32767), \n math.random(0, 32767), \n math.random(0, 32767), \n math.random(0, 32767), \n math.random(0, 32767)) \n end \n function xcode.preparesolution(sln) \n sln.xcode = { } \n sln.xcode.platforms = premake.filterplatforms(sln, premake.action.current().valid_platforms, \" Universal \" ) \n for prj in premake.solution.eachproject(sln) do \n local cfg = premake.getconfig(prj, prj.configurations[1], sln.xcode.platforms[1]) \n local node = premake.tree.new(path.getname(cfg.buildtarget.bundlepath)) \n node.cfg = cfg \n node.id = premake.xcode.newid(node, \" product \" ) \n node.targetid = premake.xcode.newid(node, \" target \" ) \n prj.xcode = {} \n prj.xcode.projectnode = node \n en "
" d \n end \n function xcode.printlist(list, tag) \n if #list > 0 then \n _p(4,'%s = (', tag) \n for _, item in ipairs(list) do \n local escaped_item = item:gsub( \" \\ \" \" , \" \\ \\ \\ \" \" ) \n _p(5, ' \" %s \" ,', escaped_item) \n end \n _p(4,');') \n end \n end \n function xcode.Header() \n _p('// !$*UTF8*$!') \n _p('{') \n _p(1,'archiveVersion = 1;') \n _p(1,'classes = {') \n _p(1,'};') \n _p(1,'objectVersion = 45;') \n _p(1,'objects = {') \n _p('') \n end \n function xcode.PBXBuildFile(tr) \n _p('/* Begin PBXBuildFile section */') \n tree.traverse(tr, { \n onnode = function(node) \n if node.buildid then \n _p(2,'%s /* %s in %s */ = {isa = PBXBuildFile; fileRef = %s /* %s */; };', \n node.buildid, node.name, xcode.getbuildcategory(node), node.id, node.name) \n end \n end \n }) \n _p('/* End PBXBuildFile section */') \n _p('') \n end \n function xcode.PBXContainerItemProxy(tr) \n if #tr.projects.children > 0 then \n _p('/* Begin PBXContainerItemProxy section */') \n for _, node in ipairs(tr.projects.children) do \n _p(2,'%s /* PBXContainerItemProxy */ = {', node.productproxyid) \n _p(3,'isa = PBXC "
" ontainerItemProxy;') \n _p(3,'containerPortal = %s /* %s */;', node.id, path.getname(node.path)) \n _p(3,'proxyType = 2;') \n _p(3,'remoteGlobalIDString = %s;', node.project.xcode.projectnode.id) \n _p(3,'remoteInfo = \" %s \" ;', node.project.xcode.projectnode.name) \n _p(2,'};') \n _p(2,'%s /* PBXContainerItemProxy */ = {', node.targetproxyid) \n _p(3,'isa = PBXContainerItemProxy;') \n _p(3,'containerPortal = %s /* %s */;', node.id, path.getname(node.path)) \n _p(3,'proxyType = 1;') \n _p(3,'remoteGlobalIDString = %s;', node.project.xcode.projectnode.targetid) \n _p(3,'remoteInfo = \" %s \" ;', node.project.xcode.projectnode.name) \n _p(2,'};') \n end \n _p('/* End PBXContainerItemProxy section */') \n _p('') \n end \n end \n function xcode.PBXFileReference(tr,prj) \n _p('/* Begin PBXFileReference section */') \n tree.traverse(tr, { \n onleaf = function(node) \n if not node.path then \n return \n end \n if node.kind == \" product \" then \n _p(2,'%s /* %s */ = {isa = PBXFileReference; explicitFileType = %s; includeInIndex = 0; name = \" %s \" ; path = \" %s \" ; sourceTree "
" = BUILT_PRODUCTS_DIR; };', \n node.id, node.name, xcode.gettargettype(node), node.name, path.getname(node.cfg.buildtarget.bundlepath)) \n elseif node.parent.parent == tr.projects then \n local relpath = path.getrelative(tr.project.location, node.parent.project.location) \n _p(2,'%s /* %s */ = {isa = PBXFileReference; lastKnownFileType = \" wrapper.pb-project \" ; name = \" %s \" ; path = \" %s \" ; sourceTree = SOURCE_ROOT; };', \n node.parent.id, node.parent.name, node.parent.name, path.join(relpath, node.parent.name)) \n else \n local pth, src \n if xcode.isframework(node.path) then \n local nodePath = node.path \n local _, matchEnd, variable = string.find(nodePath, \" ^%$%((.+)%)/ \" ) \n if variable then \n nodePath = string.sub(nodePath, matchEnd + 1) \n end \n if string.find(nodePath,'/') then \n if string.find(nodePath,'^%.')then \n error('relative paths are not currently supported for frameworks') \n end \n pth = nodePath \n elseif path.getextension(nodePath)=='.tbd' then \n pth = \" /usr/lib/ \" .. nodePath \n else \n pth = \" /System/Library/Frameworks/ \" "
" .. nodePath \n end \n if variable then \n src = variable \n if string.find(pth, '^/') then \n pth = string.sub(pth, 2) \n end \n else \n src = \" <absolute> \" \n end \n else \n src = \" <group> \" \n if node.parent.isvpath then \n pth = node.cfg.name \n else \n pth = tree.getlocalpath(node) \n end \n end \n if (not prj.options.ForceCPP) then \n _p(2,'%s /* %s */ = {isa = PBXFileReference; lastKnownFileType = %s; name = \" %s \" ; path = \" %s \" ; sourceTree = \" %s \" ; };', \n node.id, node.name, xcode.getfiletype(node), node.name, pth, src) \n else \n _p(2,'%s /* %s */ = {isa = PBXFileReference; explicitFileType = %s; name = \" %s \" ; path = \" %s \" ; sourceTree = \" %s \" ; };', \n node.id, node.name, xcode.getfiletypeForced(node), node.name, pth, src) \n end \n end \n end \n }) \n _p('/* End PBXFileReference section */') \n _p('') \n end \n function xcode.PBXFrameworksBuildPhase(tr) \n _p('/* Begin PBXFrameworksBuildPhase section */') \n _p(2,'%s /* Frameworks */ = {', tr.products.children[1].fxstageid) \n _p(3,'isa = PBXFrameworksBuildPhase;') \n _p(3,'buildActionMask = 2147483647;') \n _p(3,' "
" files = (') \n tree.traverse(tr.frameworks, { \n onleaf = function(node) \n _p(4,'%s /* %s in Frameworks */,', node.buildid, node.name) \n end \n }) \n tree.traverse(tr.projects, { \n onleaf = function(node) \n _p(4,'%s /* %s in Frameworks */,', node.buildid, node.name) \n end \n }) \n _p(3,');') \n _p(3,'runOnlyForDeploymentPostprocessing = 0;') \n _p(2,'};') \n _p('/* End PBXFrameworksBuildPhase section */') \n _p('') \n end \n function xcode.PBXGroup(tr) \n _p('/* Begin PBXGroup section */') \n tree.traverse(tr, { \n onnode = function(node) \n if (node.path and #node.children == 0) or node.kind == \" vgroup \" then \n return \n end \n if node.parent == tr.projects then \n _p(2,'%s /* Products */ = {', node.productgroupid) \n else \n _p(2,'%s /* %s */ = {', node.id, node.name) \n end \n _p(3,'isa = PBXGroup;') \n _p(3,'children = (') \n for _, childnode in ipairs(node.children) do \n _p(4,'%s /* %s */,', childnode.id, childnode.name) \n end \n _p(3,');') \n if node.parent == tr.projects then \n _p(3,'name = Products;') \n else \n _p(3,'name = \" %s \" ;', node.name) \n if node.path and not "
" node.isvpath then \n local p = node.path \n if node.parent.path then \n p = path.getrelative(node.parent.path, node.path) \n end \n _p(3,'path = \" %s \" ;', p) \n end \n end \n _p(3,'sourceTree = \" <group> \" ;') \n _p(2,'};') \n end \n }, true) \n _p('/* End PBXGroup section */') \n _p('') \n end \n function xcode.PBXNativeTarget(tr) \n _p('/* Begin PBXNativeTarget section */') \n for _, node in ipairs(tr.products.children) do \n local name = tr.project.name \n local function hasBuildCommands(which) \n if #tr.project[which] > 0 then \n return true \n end \n for _, cfg in ipairs(tr.configs) do \n if #cfg[which] > 0 then \n return true \n end \n end \n end \n _p(2,'%s /* %s */ = {', node.targetid, name) \n _p(3,'isa = PBXNativeTarget;') \n _p(3,'buildConfigurationList = %s /* Build configuration list for PBXNativeTarget \" %s \" */;', node.cfgsection, name) \n _p(3,'buildPhases = (') \n if hasBuildCommands('prebuildcommands') then \n _p(4,'9607AE1010C857E500CD1376 /* Prebuild */,') \n end \n _p(4,'%s /* Resources */,', node.resstageid) \n _p(4,'%s /* Sources */,', node.sourcesid) \n if hasB "
" uildCommands('prelinkcommands') then \n _p(4,'9607AE3510C85E7E00CD1376 /* Prelink */,') \n end \n _p(4,'%s /* Frameworks */,', node.fxstageid) \n if hasBuildCommands('postbuildcommands') then \n _p(4,'9607AE3710C85E8F00CD1376 /* Postbuild */,') \n end \n _p(3,');') \n _p(3,'buildRules = (') \n _p(3,');') \n _p(3,'dependencies = (') \n for _, node in ipairs(tr.projects.children) do \n _p(4,'%s /* PBXTargetDependency */,', node.targetdependid) \n end \n _p(3,');') \n _p(3,'name = \" %s \" ;', name) \n local p \n if node.cfg.kind == \" ConsoleApp \" then \n p = \" $(HOME)/bin \" \n elseif node.cfg.kind == \" WindowedApp \" then \n p = \" $(HOME)/Applications \" \n end \n if p then \n _p(3,'productInstallPath = \" %s \" ;', p) \n end \n _p(3,'productName = \" %s \" ;', name) \n _p(3,'productReference = %s /* %s */;', node.id, node.name) \n _p(3,'productType = \" %s \" ;', xcode.getproducttype(node)) \n _p(2,'};') \n end \n _p('/* End PBXNativeTarget section */') \n _p('') \n end \n function xcode.PBXProject(tr) \n _p('/* Begin PBXProject section */') \n _p(2,'__RootObject_ /* Project object */ = {') \n _ "
" p(3,'isa = PBXProject;') \n _p(3,'buildConfigurationList = 1DEB928908733DD80010E9CD /* Build configuration list for PBXProject \" %s \" */;', tr.name) \n _p(3,'compatibilityVersion = \" Xcode 3.2 \" ;') \n _p(3,'hasScannedForEncodings = 1;') \n _p(3,'mainGroup = %s /* %s */;', tr.id, tr.name) \n _p(3,'projectDirPath = \" \" ;') \n if #tr.projects.children > 0 then \n _p(3,'projectReferences = (') \n for _, node in ipairs(tr.projects.children) do \n _p(4,'{') \n _p(5,'ProductGroup = %s /* Products */;', node.productgroupid) \n _p(5,'ProjectRef = %s /* %s */;', node.id, path.getname(node.path)) \n _p(4,'},') \n end \n _p(3,');') \n end \n _p(3,'projectRoot = \" \" ;') \n _p(3,'targets = (') \n for _, node in ipairs(tr.products.children) do \n _p(4,'%s /* %s */,', node.targetid, node.name) \n end \n _p(3,');') \n _p(2,'};') \n _p('/* End PBXProject section */') \n _p('') \n end \n function xcode.PBXReferenceProxy(tr) \n if #tr.projects.children > 0 then \n _p('/* Begin PBXReferenceProxy section */') \n tree.traverse(tr.projects, { \n onleaf = function(node) \n _p(2,'%s /* %s */ = {' "
" , node.id, node.name) \n _p(3,'isa = PBXReferenceProxy;') \n _p(3,'fileType = %s;', xcode.gettargettype(node)) \n _p(3,'path = \" %s \" ;', node.path) \n _p(3,'remoteRef = %s /* PBXContainerItemProxy */;', node.parent.productproxyid) \n _p(3,'sourceTree = BUILT_PRODUCTS_DIR;') \n _p(2,'};') \n end \n }) \n _p('/* End PBXReferenceProxy section */') \n _p('') \n end \n end \n function xcode.PBXResourcesBuildPhase(tr) \n _p('/* Begin PBXResourcesBuildPhase section */') \n for _, target in ipairs(tr.products.children) do \n _p(2,'%s /* Resources */ = {', target.resstageid) \n _p(3,'isa = PBXResourcesBuildPhase;') \n _p(3,'buildActionMask = 2147483647;') \n _p(3,'files = (') \n tree.traverse(tr, { \n onnode = function(node) \n if xcode.getbuildcategory(node) == \" Resources \" then \n _p(4,'%s /* %s in Resources */,', node.buildid, node.name) \n end \n end \n }) \n _p(3,');') \n _p(3,'runOnlyForDeploymentPostprocessing = 0;') \n _p(2,'};') \n end \n _p('/* End PBXResourcesBuildPhase section */') \n _p('') \n end \n function xcode.PBXShellScriptBuildPhase(tr) \n local wrapperWritten = fals "
" e \n local function doblock(id, name, which) \n local commands = {} \n for _, cfg in ipairs(tr.configs) do \n local cfgcmds = cfg[which] \n if #cfgcmds > 0 then \n table.insert(commands, 'if [ \" ${CONFIGURATION} \" = \" ' .. xcode.getconfigname(cfg) .. ' \" ]; then') \n for i = 1, #cfgcmds do \n local cmd = cfgcmds[i] \n cmd = cmd:gsub(' \\ \\ ',' \\ \\ \\ \\ ') \n table.insert(commands, cmd) \n end \n table.insert(commands, 'fi') \n end \n end \n if #commands > 0 then \n if not wrapperWritten then \n _p('/* Begin PBXShellScriptBuildPhase section */') \n wrapperWritten = true \n end \n _p(2,'%s /* %s */ = {', id, name) \n _p(3,'isa = PBXShellScriptBuildPhase;') \n _p(3,'buildActionMask = 2147483647;') \n _p(3,'files = (') \n _p(3,');') \n _p(3,'inputPaths = ('); \n _p(3,');'); \n _p(3,'name = %s;', name); \n _p(3,'outputPaths = ('); \n _p(3,');'); \n _p(3,'runOnlyForDeploymentPostprocessing = 0;'); \n _p(3,'shellPath = /bin/sh;'); \n _p(3,'shellScript = \" %s \" ;', table.concat(commands, \" \\ \\ n \" ):gsub(' \" ', ' \\ \\ \" ')) \n _p(2,'};') \n end \n end \n doblock( \" 9607AE1010C857E500CD1376 \" , \" Pre "
" build \" , \" prebuildcommands \" ) \n doblock( \" 9607AE3510C85E7E00CD1376 \" , \" Prelink \" , \" prelinkcommands \" ) \n doblock( \" 9607AE3710C85E8F00CD1376 \" , \" Postbuild \" , \" postbuildcommands \" ) \n if wrapperWritten then \n _p('/* End PBXShellScriptBuildPhase section */') \n end \n end \n function xcode.PBXSourcesBuildPhase(tr,prj) \n _p('/* Begin PBXSourcesBuildPhase section */') \n for _, target in ipairs(tr.products.children) do \n _p(2,'%s /* Sources */ = {', target.sourcesid) \n _p(3,'isa = PBXSourcesBuildPhase;') \n _p(3,'buildActionMask = 2147483647;') \n _p(3,'files = (') \n tree.traverse(tr, { \n onleaf = function(node) \n if xcode.getbuildcategory(node) == \" Sources \" then \n if not table.icontains(prj.excludes, node.cfg.name) then -- if not excluded \n _p(4,'%s /* %s in Sources */,', node.buildid, node.name) \n end \n end \n end \n }) \n _p(3,');') \n _p(3,'runOnlyForDeploymentPostprocessing = 0;') \n _p(2,'};') \n end \n _p('/* End PBXSourcesBuildPhase section */') \n _p('') \n end \n function xcode.PBXVariantGroup(tr) \n _p('/* Begin PBXVariantGroup section */') \n tree "
" .traverse(tr, { \n onbranch = function(node) \n if node.kind == \" vgroup \" then \n _p(2,'%s /* %s */ = {', node.id, node.name) \n _p(3,'isa = PBXVariantGroup;') \n _p(3,'children = (') \n for _, lang in ipairs(node.children) do \n _p(4,'%s /* %s */,', lang.id, lang.name) \n end \n _p(3,');') \n _p(3,'name = %s;', node.name) \n _p(3,'sourceTree = \" <group> \" ;') \n _p(2,'};') \n end \n end \n }) \n _p('/* End PBXVariantGroup section */') \n _p('') \n end \n function xcode.PBXTargetDependency(tr) \n if #tr.projects.children > 0 then \n _p('/* Begin PBXTargetDependency section */') \n tree.traverse(tr.projects, { \n onleaf = function(node) \n _p(2,'%s /* PBXTargetDependency */ = {', node.parent.targetdependid) \n _p(3,'isa = PBXTargetDependency;') \n _p(3,'name = \" %s \" ;', node.name) \n _p(3,'targetProxy = %s /* PBXContainerItemProxy */;', node.parent.targetproxyid) \n _p(2,'};') \n end \n }) \n _p('/* End PBXTargetDependency section */') \n _p('') \n end \n end \n function xcode.XCBuildConfiguration_Target(tr, target, cfg) \n local cfgname = xcode.getconfigname(cfg) \n _p(2,'%s /* %s * "
" / = {', cfg.xcode.targetid, cfgname) \n _p(3,'isa = XCBuildConfiguration;') \n _p(3,'buildSettings = {') \n _p(4,'ALWAYS_SEARCH_USER_PATHS = NO;') \n if not cfg.flags.Symbols then \n _p(4,'DEBUG_INFORMATION_FORMAT = \" dwarf-with-dsym \" ;') \n end \n if cfg.kind ~= \" StaticLib \" and cfg.buildtarget.prefix ~= \" \" then \n _p(4,'EXECUTABLE_PREFIX = %s;', cfg.buildtarget.prefix) \n end \n if cfg.targetextension then \n local ext = cfg.targetextension \n ext = iif(ext:startswith( \" . \" ), ext:sub(2), ext) \n _p(4,'EXECUTABLE_EXTENSION = %s;', ext) \n end \n if cfg.flags.ObjcARC then \n _p(4,'CLANG_ENABLE_OBJC_ARC = YES;') \n end \n local outdir = path.getdirectory(cfg.buildtarget.bundlepath) \n if outdir ~= \" . \" then \n _p(4,'CONFIGURATION_BUILD_DIR = %s;', outdir) \n end \n _p(4,'GCC_DYNAMIC_NO_PIC = NO;') \n _p(4,'GCC_MODEL_TUNING = G5;') \n if tr.infoplist then \n _p(4,'INFOPLIST_FILE = \" %s \" ;', tr.infoplist.cfg.name) \n end \n installpaths = { \n ConsoleApp = '/usr/local/bin', \n WindowedApp = ' \" $(HOME)/Applications \" ', \n SharedLib = '/usr/local/lib', \n StaticLib = '/us "
" r/local/lib', \n Bundle = ' \" $(LOCAL_LIBRARY_DIR)/Bundles \" ', \n } \n _p(4,'INSTALL_PATH = %s;', installpaths[cfg.kind]) \n local infoplist_file = nil \n for _, v in ipairs(cfg.files) do \n if (string.find (string.lower (v), 'info.plist') ~= nil) then \n infoplist_file = string.format('$(SRCROOT)/%s', v) \n end \n end \n if infoplist_file ~= nil then \n _p(4,'INFOPLIST_FILE = \" %s \" ;', infoplist_file) \n end \n if cfg.kind == \" Bundle \" then \n _p(4, 'PRODUCT_BUNDLE_IDENTIFIER = \" genie.%s \" ;', cfg.buildtarget.basename:gsub( \" %s+ \" , '.')) --replace spaces with . \n end \n _p(4,'PRODUCT_NAME = \" %s \" ;', cfg.buildtarget.basename) \n if cfg.kind == \" Bundle \" then \n _p(4, 'WRAPPER_EXTENSION = bundle;') \n end \n _p(3,'};') \n _p(3,'name = \" %s \" ;', cfgname) \n _p(2,'};') \n end \n local function cfg_excluded_files(prj, cfg) \n local excluded = {} \n local function exclude_pattern(file) \n if path.isabsolute(file) then \n return file \n end \n local start, term = file:findlast( \" /%.%./ \" ) \n if term then \n return path.join( \" * \" , file:sub(term + 1)) \n end \n start, term = fi "
" le:find( \" %.%./ \" ) \n if start == 1 then \n return path.join( \" * \" , file:sub(term + 1)) \n end \n return path.join( \" * \" , file) \n end \n local function add_file(file) \n local name = exclude_pattern(file) \n if not table.icontains(excluded, name) then \n table.insert(excluded, name) \n end \n end \n local function verify_file(file) \n local name = exclude_pattern(file) \n if table.icontains(excluded, name) then \n error( \" ' \" .. file .. \" ' would be excluded by the rule to exclude ' \" .. name .. \" ' \" ) \n end \n end \n for _, file in ipairs(cfg.excludes) do \n add_file(file) \n end \n for _, file in ipairs(prj.allfiles) do \n if not table.icontains(prj.excludes, file) and not table.icontains(cfg.excludes, file) then \n if not table.icontains(cfg.files, file) then \n add_file(file) \n else \n verify_file(file) \n end \n end \n end \n table.sort(excluded) \n return excluded \n end \n function xcode.XCBuildConfiguration_Project(tr, prj, cfg) \n local cfgname = xcode.getconfigname(cfg) \n _p(2,'%s /* %s */ = {', cfg.xcode.projectid, cfgname) \n _p(3,'isa = XCBuildConfiguration;') \n _p "
" (3,'buildSettings = {') \n local archs = { \n Native = \" $(NATIVE_ARCH_ACTUAL) \" , \n x32 = \" i386 \" , \n x64 = \" x86_64 \" , \n Universal32 = \" $(ARCHS_STANDARD_32_BIT) \" , \n Universal64 = \" $(ARCHS_STANDARD_64_BIT) \" , \n Universal = \" $(ARCHS_STANDARD_32_64_BIT) \" , \n } \n _p(4,'ARCHS = \" %s \" ;', archs[cfg.platform]) \n _p(4,'SDKROOT = \" %s \" ;', xcode.toolset) \n if tr.entitlements then \n _p(4,'CODE_SIGN_ENTITLEMENTS = \" %s \" ;', tr.entitlements.cfg.name) \n end \n local targetdir = path.getdirectory(cfg.buildtarget.bundlepath) \n if targetdir ~= \" . \" then \n _p(4,'CONFIGURATION_BUILD_DIR = \" $(SYMROOT) \" ;'); \n end \n _p(4,'CONFIGURATION_TEMP_DIR = \" $(OBJROOT) \" ;') \n if cfg.flags.Symbols then \n _p(4,'COPY_PHASE_STRIP = NO;') \n end \n local excluded = cfg_excluded_files(prj, cfg) \n if #excluded > 0 then \n _p(4, 'EXCLUDED_SOURCE_FILE_NAMES = (') \n for _, file in ipairs(excluded) do \n _p(5, ' \" ' .. file .. ' \" ,') \n end \n _p(4, ');') \n end \n _p(4,'GCC_C_LANGUAGE_STANDARD = gnu99;') \n if cfg.flags.NoExceptions then \n _p(4,'GCC_ENABLE_CPP_EXCEPTIONS = NO;') \n "
" end \n if cfg.flags.NoRTTI then \n _p(4,'GCC_ENABLE_CPP_RTTI = NO;') \n end \n if _ACTION ~= \" xcode4 \" and cfg.flags.Symbols and not cfg.flags.NoEditAndContinue then \n _p(4,'GCC_ENABLE_FIX_AND_CONTINUE = YES;') \n end \n if cfg.flags.NoExceptions then \n _p(4,'GCC_ENABLE_OBJC_EXCEPTIONS = NO;') \n end \n if cfg.flags.Optimize or cfg.flags.OptimizeSize then \n _p(4,'GCC_OPTIMIZATION_LEVEL = s;') \n elseif cfg.flags.OptimizeSpeed then \n _p(4,'GCC_OPTIMIZATION_LEVEL = 3;') \n else \n _p(4,'GCC_OPTIMIZATION_LEVEL = 0;') \n end \n if cfg.pchheader and not cfg.flags.NoPCH then \n _p(4,'GCC_PRECOMPILE_PREFIX_HEADER = YES;') \n _p(4,'GCC_PREFIX_HEADER = \" %s \" ;', cfg.pchheader) \n end \n xcode.printlist(cfg.defines, 'GCC_PREPROCESSOR_DEFINITIONS') \n _p(4,'GCC_SYMBOLS_PRIVATE_EXTERN = NO;') \n if cfg.flags.FatalWarnings then \n _p(4,'GCC_TREAT_WARNINGS_AS_ERRORS = YES;') \n end \n _p(4,'GCC_WARN_ABOUT_RETURN_TYPE = YES;') \n _p(4,'GCC_WARN_UNUSED_VARIABLE = YES;') \n xcode.printlist(cfg.includedirs, 'HEADER_SEARCH_PATHS') \n xcode.printlist(cfg.userincludedirs, 'USER_HEAD "
" ER_SEARCH_PATHS') \n xcode.printlist(cfg.libdirs, 'LIBRARY_SEARCH_PATHS') \n _p(4,'OBJROOT = \" %s \" ;', cfg.objectsdir) \n _p(4,'ONLY_ACTIVE_ARCH = %s;',iif(premake.config.isdebugbuild(cfg),'YES','NO')) \n local checks = { \n [ \" -ffast-math \" ] = cfg.flags.FloatFast, \n [ \" -ffloat-store \" ] = cfg.flags.FloatStrict, \n [ \" -fomit-frame-pointer \" ] = cfg.flags.NoFramePointer, \n } \n local flags = { } \n for flag, check in pairs(checks) do \n if check then \n table.insert(flags, flag) \n end \n end \n for _, val in ipairs(premake.xcode.parameters) do \n _p(4, val ..';') \n end \n xcode.printlist(table.join(flags, cfg.buildoptions, cfg.buildoptions_c), 'OTHER_CFLAGS') \n xcode.printlist(table.join(flags, cfg.buildoptions, cfg.buildoptions_cpp), 'OTHER_CPLUSPLUSFLAGS') \n flags = { } \n for _, lib in ipairs(premake.getlinks(cfg, \" system \" )) do \n if not xcode.isframework(lib) then \n table.insert(flags, \" -l \" .. lib) \n end \n end \n flags = table.join(flags, cfg.linkoptions) \n xcode.printlist(flags, 'OTHER_LDFLAGS') \n if cfg.flags.StaticRuntime then \n _p "
" (4,'STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = static;') \n end \n if targetdir ~= \" . \" then \n _p(4,'SYMROOT = \" %s \" ;', targetdir) \n end \n if cfg.flags.PedanticWarnings \n or cfg.flags.ExtraWarnings \n then \n _p(4,'WARNING_CFLAGS = \" -Wall \" ;') \n end \n _p(3,'};') \n _p(3,'name = \" %s \" ;', cfgname) \n _p(2,'};') \n end \n function xcode.XCBuildConfiguration(tr, prj) \n _p('/* Begin XCBuildConfiguration section */') \n for _, target in ipairs(tr.products.children) do \n for _, cfg in ipairs(tr.configs) do \n xcode.XCBuildConfiguration_Target(tr, target, cfg) \n end \n end \n for _, cfg in ipairs(tr.configs) do \n xcode.XCBuildConfiguration_Project(tr, prj, cfg) \n end \n _p('/* End XCBuildConfiguration section */') \n _p('') \n end \n function xcode.XCBuildConfigurationList(tr) \n local sln = tr.project.solution \n _p('/* Begin XCConfigurationList section */') \n for _, target in ipairs(tr.products.children) do \n _p(2,'%s /* Build configuration list for PBXNativeTarget \" %s \" */ = {', target.cfgsection, target.name) \n _p(3,'isa = XCConfigurationList;') \n _p(3,'buildConfigu "
" rations = (') \n for _, cfg in ipairs(tr.configs) do \n _p(4,'%s /* %s */,', cfg.xcode.targetid, xcode.getconfigname(cfg)) \n end \n _p(3,');') \n _p(3,'defaultConfigurationIsVisible = 0;') \n _p(3,'defaultConfigurationName = \" %s \" ;', xcode.getconfigname(tr.configs[1])) \n _p(2,'};') \n end \n _p(2,'1DEB928908733DD80010E9CD /* Build configuration list for PBXProject \" %s \" */ = {', tr.name) \n _p(3,'isa = XCConfigurationList;') \n _p(3,'buildConfigurations = (') \n for _, cfg in ipairs(tr.configs) do \n _p(4,'%s /* %s */,', cfg.xcode.projectid, xcode.getconfigname(cfg)) \n end \n _p(3,');') \n _p(3,'defaultConfigurationIsVisible = 0;') \n _p(3,'defaultConfigurationName = \" %s \" ;', xcode.getconfigname(tr.configs[1])) \n _p(2,'};') \n _p('/* End XCConfigurationList section */') \n _p('') \n end \n function xcode.Footer() \n _p(1,'};') \n _p(' \\ trootObject = __RootObject_ /* Project object */;') \n _p('}') \n end \n " ,
" premake.xcode.parameters = { } \n local xcode = premake.xcode \n local tree = premake.tree \n function xcode.getbuildcategory(node) \n local categories = { \n [ \" .a \" ] = \" Frameworks \" , \n [ \" .h \" ] = \" Headers \" , \n [ \" .hh \" ] = \" Headers \" , \n [ \" .hpp \" ] = \" Headers \" , \n [ \" .hxx \" ] = \" Headers \" , \n [ \" .inl \" ] = \" Headers \" , \n [ \" .c \" ] = \" Sources \" , \n [ \" .cc \" ] = \" Sources \" , \n [ \" .cpp \" ] = \" Sources \" , \n [ \" .cxx \" ] = \" Sources \" , \n [ \" .c++ \" ] = \" Sources \" , \n [ \" .dylib \" ] = \" Frameworks \" , \n [ \" .bundle \" ] = \" Frameworks \" , \n [ \" .framework \" ] = \" Frameworks \" , \n [ \" .tbd \" ] = \" Frameworks \" , \n [ \" .m \" ] = \" Sources \" , \n [ \" .mm \" ] = \" Sources \" , \n [ \" .S \" ] = \" Sources \" , \n [ \" .strings \" ] = \" Resources \" , \n [ \" .nib \" ] = \" Resources \" , \n [ \" .xib \" ] = \" Resources \" , \n [ \" .icns \" ] = \" Resources \" , \n [ \" .bmp \" ] = \" Resources \" , \n [ \" .wav \" ] = \" Resources \" , \n [ \" .xcassets \" ] = \" Resources \" , \n [ \" .xcdatamodeld \" ] = \" Sources \" , \n [ \" .swift \" ] = \" Sources \" , \n } \n return categories[path.getextension(node.name)] or \n categories[string.lower(path.getextension( "
" node.name))] \n end \n function xcode.getconfigname(cfg) \n local name = cfg.name \n if #cfg.project.solution.xcode.platforms > 1 then \n name = name .. \" \" .. premake.action.current().valid_platforms[cfg.platform] \n end \n return name \n end \n function xcode.getfiletype(node) \n local types = { \n [ \" .c \" ] = \" sourcecode.c.c \" , \n [ \" .cc \" ] = \" sourcecode.cpp.cpp \" , \n [ \" .cpp \" ] = \" sourcecode.cpp.cpp \" , \n [ \" .css \" ] = \" text.css \" , \n [ \" .cxx \" ] = \" sourcecode.cpp.cpp \" , \n [ \" .c++ \" ] = \" sourcecode.cpp.cpp \" , \n [ \" .entitlements \" ] = \" text.xml \" , \n [ \" .bundle \" ] = \" wrapper.cfbundle \" , \n [ \" .framework \" ] = \" wrapper.framework \" , \n [ \" .tbd \" ] = \" sourcecode.text-based-dylib-definition \" , \n [ \" .gif \" ] = \" image.gif \" , \n [ \" .h \" ] = \" sourcecode.c.h \" , \n [ \" .hh \" ] = \" sourcecode.cpp.h \" , \n [ \" .hpp \" ] = \" sourcecode.cpp.h \" , \n [ \" .hxx \" ] = \" sourcecode.cpp.h \" , \n [ \" .inl \" ] = \" sourcecode.cpp.h \" , \n [ \" .html \" ] = \" text.html \" , \n [ \" .lua \" ] = \" sourceco "
" de.lua \" , \n [ \" .m \" ] = \" sourcecode.c.objc \" , \n [ \" .mm \" ] = \" sourcecode.cpp.objcpp \" , \n [ \" .S \" ] = \" sourcecode.asm \" , \n [ \" .nib \" ] = \" wrapper.nib \" , \n [ \" .pch \" ] = \" sourcecode.c.h \" , \n [ \" .plist \" ] = \" text.plist.xml \" , \n [ \" .strings \" ] = \" text.plist.strings \" , \n [ \" .xib \" ] = \" file.xib \" , \n [ \" .icns \" ] = \" image.icns \" , \n [ \" .bmp \" ] = \" image.bmp \" , \n [ \" .wav \" ] = \" audio.wav \" , \n [ \" .xcassets \" ] = \" folder.assetcatalog \" , \n [ \" .xcdatamodeld \" ] = \" wrapper.xcdatamodeld \" , \n [ \" .swift \" ] = \" sourcecode.swift \" , \n } \n return types[path.getextension(node.path)] or \n (types[string.lower(path.getextension(node.path))] or \" text \" ) \n end \n function xcode.getfiletypeForced(node) \n local types = { \n [ \" .c \" ] = \" sourcecode.cpp.cpp \" , \n [ \" .cc \" ] = \" sourcecode.cpp.cpp \" , \n [ \" .cpp \" ] = \" sourcecode.cpp.cpp \" , \n [ \" .css \" ] = \" text.css \" , \n [ \" .cxx \" ] = \" sourcecode.cpp.cpp \" , \n [ \" .c++ \" ] = \" sourcecode.cpp.cpp \" , \n [ \" .entitlements "
" \" ] = \" text.xml \" , \n [ \" .bundle \" ] = \" wrapper.cfbundle \" , \n [ \" .framework \" ] = \" wrapper.framework \" , \n [ \" .tbd \" ] = \" wrapper.framework \" , \n [ \" .gif \" ] = \" image.gif \" , \n [ \" .h \" ] = \" sourcecode.cpp.h \" , \n [ \" .hh \" ] = \" sourcecode.cpp.h \" , \n [ \" .hpp \" ] = \" sourcecode.cpp.h \" , \n [ \" .hxx \" ] = \" sourcecode.cpp.h \" , \n [ \" .inl \" ] = \" sourcecode.cpp.h \" , \n [ \" .html \" ] = \" text.html \" , \n [ \" .lua \" ] = \" sourcecode.lua \" , \n [ \" .m \" ] = \" sourcecode.cpp.objcpp \" , \n [ \" .mm \" ] = \" sourcecode.cpp.objcpp \" , \n [ \" .nib \" ] = \" wrapper.nib \" , \n [ \" .pch \" ] = \" sourcecode.cpp.h \" , \n [ \" .plist \" ] = \" text.plist.xml \" , \n [ \" .strings \" ] = \" text.plist.strings \" , \n [ \" .xib \" ] = \" file.xib \" , \n [ \" .icns \" ] = \" image.icns \" , \n [ \" .bmp \" ] = \" image.bmp \" , \n [ \" .wav \" ] = \" audio.wav \" , \n [ \" .xcassets \" ] = \" folder.assetcatalog \" , \n [ \" .xcdatamodeld \" ] = \" wrapper.xcdatamodeld \" , \n [ \" .swift \" ] = \" sourcecode.swift \" , \n } \n return types[path.ge "
" textension(node.path)] or \n (types[string.lower(path.getextension(node.path))] or \" text \" ) \n end \n function xcode.getproducttype(node) \n local types = { \n ConsoleApp = \" com.apple.product-type.tool \" , \n WindowedApp = node.cfg.options.SkipBundling and \" com.apple.product-type.tool \" or \" com.apple.product-type.application \" , \n StaticLib = \" com.apple.product-type.library.static \" , \n SharedLib = \" com.apple.product-type.library.dynamic \" , \n Bundle = node.cfg.options.SkipBundling and \" com.apple.product-type.tool \" or \" com.apple.product-type.bundle \" , \n } \n return types[node.cfg.kind] \n end \n function xcode.gettargettype(node) \n local types = { \n ConsoleApp = \" \\ \" compiled.mach-o.executable \\ \" \" , \n WindowedApp = node.cfg.options.SkipBundling and \" \\ \" compiled.mach-o.executable \\ \" \" or \" wrapper.application \" , \n StaticLib = \" archive.ar \" , \n SharedLib = \" \\ \" compiled.mach-o.dylib \\ \" \" , \n Bundle = node.cfg.options.SkipBundling and \" \\ \" compiled.mach-o.bundle \\ \" \" or \" wrapper.cfbundle \" , \n } \n return types "
" [node.cfg.kind] \n end \n function xcode.getxcodeprojname(prj) \n local fname = premake.project.getfilename(prj, \" %%.xcodeproj \" ) \n return fname \n end \n function xcode.isframework(fname) \n return (path.getextension(fname) == \" .framework \" or path.getextension(fname) == \" .tbd \" ) \n end \n function xcode.uuid(param) \n return os.uuid(param):upper():gsub('-',''):sub(0,24) \n end \n function xcode.newid(node, usage) \n local base = '' \n local prj = node.project \n if prj == nil then \n local parent = node.parent \n while parent ~= nil do \n if parent.project ~= nil then \n prj = parent.project \n break \n end \n parent = parent.parent \n end \n end \n if prj ~= nil then \n prj.uuidcounter = (prj.uuidcounter or 0) + 1 \n base = base .. prj.name .. \" $ \" .. prj.uuidcounter .. \" $ \" \n end \n base = base .. \" $ \" .. (node.path or node.name or \" \" ) \n base = base .. \" $ \" .. (usage or \" \" ) \n return xcode.uuid(base) \n end \n function xcode.getscriptphaselabel(cmd, count, cfg) \n return string.format( \" \\ \" Script Phase %s [%s] (%s) \\ \" \" , count, cmd:match( \" (%w+)(.+) \" ), iif "
" (cfg, xcode.getconfigname(cfg), \" all \" )) \n end \n function xcode.getcopyphaselabel(type, count, target) \n return string.format( \" \\ \" Copy %s %s [%s] \\ \" \" , type, count, target) \n end \n function xcode.preparesolution(sln) \n sln.xcode = { } \n sln.xcode.platforms = premake.filterplatforms(sln, premake.action.current().valid_platforms, \" Universal \" ) \n for prj in premake.solution.eachproject(sln) do \n local cfg = premake.getconfig(prj, prj.configurations[1], sln.xcode.platforms[1]) \n local node = premake.tree.new(path.getname(cfg.buildtarget.bundlepath)) \n node.cfg = cfg \n node.id = premake.xcode.newid(node, \" product \" ) \n node.targetid = premake.xcode.newid(node, \" target \" ) \n prj.xcode = {} \n prj.xcode.projectnode = node \n end \n end \n function xcode.printlist(list, tag, sort) \n if #list > 0 then \n if sort ~= nil and sort == true then \n table.sort(list) \n end \n _p(4,'%s = (', tag) \n for _, item in ipairs(list) do \n local escaped_item = item:gsub( \" \\ \" \" , \" \\ \\ \\ \\ \\ \\ \\ \" \" ):gsub( \" ' \" , \" \\ \\ \\ \\ ' \" ) \n _p(5, ' \" %s \" ,', escaped_item) \n e "
" nd \n _p(4,');') \n end \n end \n function xcode.quotestr(str) \n if str:match( \" [^a-zA-Z0-9$._/] \" ) == nil then \n return str \n end \n return \" \\ \" \" .. str:gsub( \" [ \\ \" \\ \\ \\ \" ] \" , \" \\ \\ %0 \" ) .. \" \\ \" \" \n end \n function xcode.Header(tr, objversion) \n _p('// !$*UTF8*$!') \n _p('{') \n _p(1,'archiveVersion = 1;') \n _p(1,'classes = {') \n _p(1,'};') \n _p(1,'objectVersion = %d;', objversion) \n _p(1,'objects = {') \n _p('') \n end \n function xcode.PBXBuildFile(tr) \n local function gatherCopyFiles(which) \n local copyfiles = {} \n local targets = tr.project[which] \n if #targets > 0 then \n for _, t in ipairs(targets) do \n for __, tt in ipairs(t) do \n table.insertflat(copyfiles, tt[2]) \n end \n end \n end \n return table.translate(copyfiles, path.getname) \n end \n local function gatherCopyFrameworks(which) \n local copyfiles = {} \n local targets = tr.project[which] \n if #targets > 0 then \n table.insertflat(copyfiles, targets) \n end \n return table.translate(copyfiles, path.getname) \n end \n local copyfiles = table.flatten({ \n gatherCopyFiles('xcodecopyresources'), \n gatherCop "
" yFrameworks('xcodecopyframeworks') \n }) \n _p('/* Begin PBXBuildFile section */') \n tree.traverse(tr, { \n onnode = function(node) \n if node.buildid then \n _p(2,'%s /* %s in %s */ = {isa = PBXBuildFile; fileRef = %s /* %s */; };', \n node.buildid, node.name, xcode.getbuildcategory(node), node.id, node.name) \n end \n if table.icontains(copyfiles, node.name) then \n _p(2,'%s /* %s in %s */ = {isa = PBXBuildFile; fileRef = %s /* %s */; %s };', \n xcode.uuid(node.name .. 'in CopyFiles'), node.name, 'CopyFiles', node.id, node.name, \n iif(xcode.isframework(node.name), \" settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; \" , \" \" ) \n ) \n end \n end \n }) \n _p('/* End PBXBuildFile section */') \n _p('') \n end \n function xcode.PBXContainerItemProxy(tr) \n if #tr.projects.children > 0 then \n _p('/* Begin PBXContainerItemProxy section */') \n for _, node in ipairs(tr.projects.children) do \n _p(2,'%s /* PBXContainerItemProxy */ = {', node.productproxyid) \n _p(3,'isa = PBXContainerItemProxy;') \n _p(3,'containerPortal = %s /* %s */;', node.id, path.getname(node.pat "
" h)) \n _p(3,'proxyType = 2;') \n _p(3,'remoteGlobalIDString = %s;', node.project.xcode.projectnode.id) \n _p(3,'remoteInfo = \" %s \" ;', node.project.xcode.projectnode.name) \n _p(2,'};') \n _p(2,'%s /* PBXContainerItemProxy */ = {', node.targetproxyid) \n _p(3,'isa = PBXContainerItemProxy;') \n _p(3,'containerPortal = %s /* %s */;', node.id, path.getname(node.path)) \n _p(3,'proxyType = 1;') \n _p(3,'remoteGlobalIDString = %s;', node.project.xcode.projectnode.targetid) \n _p(3,'remoteInfo = \" %s \" ;', node.project.xcode.projectnode.name) \n _p(2,'};') \n end \n _p('/* End PBXContainerItemProxy section */') \n _p('') \n end \n end \n function xcode.PBXFileReference(tr,prj) \n _p('/* Begin PBXFileReference section */') \n tree.traverse(tr, { \n onleaf = function(node) \n if not node.path then \n return \n end \n if node.kind == \" product \" then \n _p(2,'%s /* %s */ = {isa = PBXFileReference; explicitFileType = %s; includeInIndex = 0; name = \" %s \" ; path = \" %s \" ; sourceTree = BUILT_PRODUCTS_DIR; };', \n node.id, node.name, xcode.gettargettype(node), node.name, path "
" .getname(node.cfg.buildtarget.bundlepath)) \n elseif node.parent.parent == tr.projects then \n local relpath = path.getrelative(tr.project.location, node.parent.project.location) \n _p(2,'%s /* %s */ = {isa = PBXFileReference; lastKnownFileType = \" wrapper.pb-project \" ; name = \" %s \" ; path = \" %s \" ; sourceTree = SOURCE_ROOT; };', \n node.parent.id, node.parent.name, node.parent.name, path.join(relpath, node.parent.name)) \n else \n local pth, src \n if xcode.isframework(node.path) then \n local nodePath = node.path \n local _, matchEnd, variable = string.find(nodePath, \" ^%$%((.+)%)/ \" ) \n if variable then \n nodePath = string.sub(nodePath, matchEnd + 1) \n end \n if string.find(nodePath,'/') then \n if string.find(nodePath,'^%.')then \n nodePath = path.getabsolute(path.join(tr.project.location, nodePath)) \n end \n pth = nodePath \n elseif path.getextension(nodePath)=='.tbd' then \n pth = \" /usr/lib/ \" .. nodePath \n else \n pth = \" /System/Library/Frameworks/ \" .. nodePath \n end \n if variable then \n src = variable \n if string.find(pth, '^/') then \n pth "
" = string.sub(pth, 2) \n end \n else \n src = \" <absolute> \" \n end \n else \n src = \" <group> \" \n if node.location then \n pth = node.location \n elseif node.parent.isvpath then \n pth = node.cfg.name \n else \n pth = tree.getlocalpath(node) \n end \n end \n if (not prj.options.ForceCPP) then \n _p(2,'%s /* %s */ = {isa = PBXFileReference; lastKnownFileType = %s; name = \" %s \" ; path = \" %s \" ; sourceTree = \" %s \" ; };', \n node.id, node.name, xcode.getfiletype(node), node.name, pth, src) \n else \n _p(2,'%s /* %s */ = {isa = PBXFileReference; explicitFileType = %s; name = \" %s \" ; path = \" %s \" ; sourceTree = \" %s \" ; };', \n node.id, node.name, xcode.getfiletypeForced(node), node.name, pth, src) \n end \n end \n end \n }) \n _p('/* End PBXFileReference section */') \n _p('') \n end \n function xcode.PBXFrameworksBuildPhase(tr) \n _p('/* Begin PBXFrameworksBuildPhase section */') \n _p(2,'%s /* Frameworks */ = {', tr.products.children[1].fxstageid) \n _p(3,'isa = PBXFrameworksBuildPhase;') \n _p(3,'buildActionMask = 2147483647;') \n _p(3,'files = (') \n tree.traverse(tr.frameworks "
" , { \n onleaf = function(node) \n _p(4,'%s /* %s in Frameworks */,', node.buildid, node.name) \n end \n }) \n tree.traverse(tr.projects, { \n onleaf = function(node) \n _p(4,'%s /* %s in Frameworks */,', node.buildid, node.name) \n end \n }) \n _p(3,');') \n _p(3,'runOnlyForDeploymentPostprocessing = 0;') \n _p(2,'};') \n _p('/* End PBXFrameworksBuildPhase section */') \n _p('') \n end \n function xcode.PBXGroup(tr) \n _p('/* Begin PBXGroup section */') \n tree.traverse(tr, { \n onnode = function(node) \n if (node.path and #node.children == 0) or node.kind == \" vgroup \" then \n return \n end \n if node.parent == tr.projects then \n _p(2,'%s /* Products */ = {', node.productgroupid) \n else \n _p(2,'%s /* %s */ = {', node.id, node.name) \n end \n _p(3,'isa = PBXGroup;') \n _p(3,'children = (') \n for _, childnode in ipairs(node.children) do \n _p(4,'%s /* %s */,', childnode.id, childnode.name) \n end \n _p(3,');') \n if node.parent == tr.projects then \n _p(3,'name = Products;') \n else \n _p(3,'name = \" %s \" ;', node.name) \n if node.location then \n _p(3,'path = \" %s \" ;', node.location) "
" \n elseif node.path and not node.isvpath then \n local p = node.path \n if node.parent.path then \n p = path.getrelative(node.parent.path, node.path) \n end \n _p(3,'path = \" %s \" ;', p) \n end \n end \n _p(3,'sourceTree = \" <group> \" ;') \n _p(2,'};') \n end \n }, true) \n _p('/* End PBXGroup section */') \n _p('') \n end \n function xcode.PBXNativeTarget(tr) \n _p('/* Begin PBXNativeTarget section */') \n for _, node in ipairs(tr.products.children) do \n local name = tr.project.name \n local function hasBuildCommands(which) \n if #tr.project[which] > 0 then \n return true \n end \n for _, cfg in ipairs(tr.configs) do \n if #cfg[which] > 0 then \n return true \n end \n end \n end \n local function dobuildblock(id, label, which, action) \n if hasBuildCommands(which) then \n local commandcount = 0 \n for _, cfg in ipairs(tr.configs) do \n commandcount = commandcount + #cfg[which] \n end \n if commandcount > 0 then \n action(id, label) \n end \n end \n end \n local function doscriptphases(which, action) \n local i = 0 \n for _, cfg in ipairs(tr.configs) do \n local cfgcmds = cfg[which] \n if cfgcmds ~ "
" = nil then \n for __, scripts in ipairs(cfgcmds) do \n for ___, script in ipairs(scripts) do \n local cmd = script[1] \n local label = xcode.getscriptphaselabel(cmd, i, cfg) \n local id = xcode.uuid(label) \n action(id, label) \n i = i + 1 \n end \n end \n end \n end \n end \n local function docopyresources(which, action) \n if hasBuildCommands(which) then \n local targets = tr.project[which] \n if #targets > 0 then \n local i = 0 \n for _, t in ipairs(targets) do \n for __, tt in ipairs(t) do \n local label = xcode.getcopyphaselabel('Resources', i, tt[1]) \n local id = xcode.uuid(label) \n action(id, label) \n i = i + 1 \n end \n end \n end \n end \n end \n local function docopyframeworks(which, action) \n if hasBuildCommands(which) then \n local targets = tr.project[which] \n if #targets > 0 then \n local label = \" Copy Frameworks \" \n local id = xcode.uuid(label) \n action(id, label) \n end \n end \n end \n local function _p_label(id, label) \n _p(4, '%s /* %s */,', id, label) \n end \n _p(2,'%s /* %s */ = {', node.targetid, name) \n _p(3,'isa = PBXNativeTarget;') \n _p(3,'buildConfigurationLi "
" st = %s /* Build configuration list for PBXNativeTarget \" %s \" */;', node.cfgsection, name) \n _p(3,'buildPhases = (') \n dobuildblock('9607AE1010C857E500CD1376', 'Prebuild', 'prebuildcommands', _p_label) \n _p(4,'%s /* Resources */,', node.resstageid) \n _p(4,'%s /* Sources */,', node.sourcesid) \n dobuildblock('9607AE3510C85E7E00CD1376', 'Prelink', 'prelinkcommands', _p_label) \n _p(4,'%s /* Frameworks */,', node.fxstageid) \n dobuildblock('9607AE3710C85E8F00CD1376', 'Postbuild', 'postbuildcommands', _p_label) \n doscriptphases( \" xcodescriptphases \" , _p_label) \n docopyresources( \" xcodecopyresources \" , _p_label) \n if tr.project.kind == \" WindowedApp \" then \n docopyframeworks( \" xcodecopyframeworks \" , _p_label) \n end \n _p(3,');') \n _p(3,'buildRules = (') \n _p(3,');') \n _p(3,'dependencies = (') \n for _, node in ipairs(tr.projects.children) do \n _p(4,'%s /* PBXTargetDependency */,', node.targetdependid) \n end \n _p(3,');') \n _p(3,'name = \" %s \" ;', name) \n local p \n if node.cfg.kind == \" ConsoleApp \" then \n p = \" $(HOME)/bin \" \n elseif node.cfg.ki "
" nd == \" WindowedApp \" then \n p = \" $(HOME)/Applications \" \n end \n if p then \n _p(3,'productInstallPath = \" %s \" ;', p) \n end \n _p(3,'productName = \" %s \" ;', name) \n _p(3,'productReference = %s /* %s */;', node.id, node.name) \n _p(3,'productType = \" %s \" ;', xcode.getproducttype(node)) \n _p(2,'};') \n end \n _p('/* End PBXNativeTarget section */') \n _p('') \n end \n function xcode.PBXProject(tr, compatVersion) \n _p('/* Begin PBXProject section */') \n _p(2,'__RootObject_ /* Project object */ = {') \n _p(3,'isa = PBXProject;') \n _p(3,'buildConfigurationList = 1DEB928908733DD80010E9CD /* Build configuration list for PBXProject \" %s \" */;', tr.name) \n _p(3,'compatibilityVersion = \" Xcode %s \" ;', compatVersion) \n _p(3,'hasScannedForEncodings = 1;') \n _p(3,'mainGroup = %s /* %s */;', tr.id, tr.name) \n _p(3,'projectDirPath = \" \" ;') \n if #tr.projects.children > 0 then \n _p(3,'projectReferences = (') \n for _, node in ipairs(tr.projects.children) do \n _p(4,'{') \n _p(5,'ProductGroup = %s /* Products */;', node.productgroupid) \n _p(5,'ProjectRef = %s /* %s "
" */;', node.id, path.getname(node.path)) \n _p(4,'},') \n end \n _p(3,');') \n end \n _p(3,'projectRoot = \" \" ;') \n _p(3,'targets = (') \n for _, node in ipairs(tr.products.children) do \n _p(4,'%s /* %s */,', node.targetid, node.name) \n end \n _p(3,');') \n _p(2,'};') \n _p('/* End PBXProject section */') \n _p('') \n end \n function xcode.PBXReferenceProxy(tr) \n if #tr.projects.children > 0 then \n _p('/* Begin PBXReferenceProxy section */') \n tree.traverse(tr.projects, { \n onleaf = function(node) \n _p(2,'%s /* %s */ = {', node.id, node.name) \n _p(3,'isa = PBXReferenceProxy;') \n _p(3,'fileType = %s;', xcode.gettargettype(node)) \n _p(3,'path = \" %s \" ;', node.path) \n _p(3,'remoteRef = %s /* PBXContainerItemProxy */;', node.parent.productproxyid) \n _p(3,'sourceTree = BUILT_PRODUCTS_DIR;') \n _p(2,'};') \n end \n }) \n _p('/* End PBXReferenceProxy section */') \n _p('') \n end \n end \n function xcode.PBXResourcesBuildPhase(tr) \n _p('/* Begin PBXResourcesBuildPhase section */') \n for _, target in ipairs(tr.products.children) do \n _p(2,'%s /* Resources */ = {', target.r "
" esstageid) \n _p(3,'isa = PBXResourcesBuildPhase;') \n _p(3,'buildActionMask = 2147483647;') \n _p(3,'files = (') \n tree.traverse(tr, { \n onnode = function(node) \n if xcode.getbuildcategory(node) == \" Resources \" then \n _p(4,'%s /* %s in Resources */,', node.buildid, node.name) \n end \n end \n }) \n _p(3,');') \n _p(3,'runOnlyForDeploymentPostprocessing = 0;') \n _p(2,'};') \n end \n _p('/* End PBXResourcesBuildPhase section */') \n _p('') \n end \n function xcode.PBXShellScriptBuildPhase(tr) \n local wrapperWritten = false \n local function doblock(id, name, commands, files) \n if commands ~= nil then \n commands = table.flatten(commands) \n end \n if #commands > 0 then \n if not wrapperWritten then \n _p('/* Begin PBXShellScriptBuildPhase section */') \n wrapperWritten = true \n end \n _p(2,'%s /* %s */ = {', id, name) \n _p(3,'isa = PBXShellScriptBuildPhase;') \n _p(3,'buildActionMask = 2147483647;') \n _p(3,'files = (') \n _p(3,');') \n _p(3,'inputPaths = ('); \n if files ~= nil then \n files = table.flatten(files) \n if #files > 0 then \n for _, file in ipairs(files) do \n _p( "
" 4, ' \" %s \" ,', file) \n end \n end \n end \n _p(3,');'); \n _p(3,'name = %s;', name); \n _p(3,'outputPaths = ('); \n _p(3,');'); \n _p(3,'runOnlyForDeploymentPostprocessing = 0;'); \n _p(3,'shellPath = /bin/sh;'); \n _p(3,'shellScript = \" %s \" ;', table.concat(commands, \" \\ \\ n \" ):gsub(' \" ', ' \\ \\ \" ')) \n _p(2,'};') \n end \n end \n local function wrapcommands(cmds, cfg) \n local commands = {} \n if #cmds > 0 then \n table.insert(commands, 'if [ \" ${CONFIGURATION} \" = \" ' .. xcode.getconfigname(cfg) .. ' \" ]; then') \n for i = 1, #cmds do \n local cmd = cmds[i] \n cmd = cmd:gsub(' \\ \\ ',' \\ \\ \\ \\ ') \n table.insert(commands, cmd) \n end \n table.insert(commands, 'fi') \n end \n return commands \n end \n local function dobuildblock(id, name, which) \n local commands = {} \n for _, cfg in ipairs(tr.configs) do \n local cfgcmds = wrapcommands(cfg[which], cfg) \n if #cfgcmds > 0 then \n for i, cmd in ipairs(cfgcmds) do \n table.insert(commands, cmd) \n end \n end \n end \n doblock(id, name, commands) \n end \n local function doscriptphases(which) \n local i = 0 \n for _, cfg in ipairs(tr.configs) d "
" o \n local cfgcmds = cfg[which] \n if cfgcmds ~= nil then \n for __, scripts in ipairs(cfgcmds) do \n for ___, script in ipairs(scripts) do \n local cmd = script[1] \n local files = script[2] \n local label = xcode.getscriptphaselabel(cmd, i, cfg) \n local id = xcode.uuid(label) \n doblock(id, label, wrapcommands({cmd}, cfg), files) \n i = i + 1 \n end \n end \n end \n end \n end \n dobuildblock( \" 9607AE1010C857E500CD1376 \" , \" Prebuild \" , \" prebuildcommands \" ) \n dobuildblock( \" 9607AE3510C85E7E00CD1376 \" , \" Prelink \" , \" prelinkcommands \" ) \n dobuildblock( \" 9607AE3710C85E8F00CD1376 \" , \" Postbuild \" , \" postbuildcommands \" ) \n doscriptphases( \" xcodescriptphases \" ) \n if wrapperWritten then \n _p('/* End PBXShellScriptBuildPhase section */') \n end \n end \n function xcode.PBXSourcesBuildPhase(tr,prj) \n _p('/* Begin PBXSourcesBuildPhase section */') \n for _, target in ipairs(tr.products.children) do \n _p(2,'%s /* Sources */ = {', target.sourcesid) \n _p(3,'isa = PBXSourcesBuildPhase;') \n _p(3,'buildActionMask = 2147483647;') \n _p(3,'files = (') \n tree.traverse(tr, { \n o "
" nleaf = function(node) \n if xcode.getbuildcategory(node) == \" Sources \" then \n if not table.icontains(prj.excludes, node.cfg.name) then -- if not excluded \n _p(4,'%s /* %s in Sources */,', node.buildid, node.name) \n end \n end \n end \n }) \n _p(3,');') \n _p(3,'runOnlyForDeploymentPostprocessing = 0;') \n _p(2,'};') \n end \n _p('/* End PBXSourcesBuildPhase section */') \n _p('') \n end \n function xcode.PBXCopyFilesBuildPhase(tr) \n local wrapperWritten = false \n local function doblock(id, name, folderSpec, path, files) \n if #files > 0 then \n if not wrapperWritten then \n _p('/* Begin PBXCopyFilesBuildPhase section */') \n wrapperWritten = true \n end \n _p(2,'%s /* %s */ = {', id, name) \n _p(3,'isa = PBXCopyFilesBuildPhase;') \n _p(3,'buildActionMask = 2147483647;') \n _p(3,'dstPath = \\ \" %s \\ \" ;', path) \n _p(3,'dstSubfolderSpec = \\ \" %s \\ \" ;', folderSpec) \n _p(3,'files = (') \n tree.traverse(tr, { \n onleaf = function(node) \n if table.icontains(files, node.name) then \n _p(4,'%s /* %s in %s */,', \n xcode.uuid(node.name .. 'in CopyFiles'), node.name, 'CopyFile "
" s') \n end \n end \n }) \n _p(3,');') \n _p(3,'runOnlyForDeploymentPostprocessing = 0;'); \n _p(2,'};') \n end \n end \n local function docopyresources(which) \n local targets = tr.project[which] \n if #targets > 0 then \n local i = 0 \n for _, t in ipairs(targets) do \n for __, tt in ipairs(t) do \n local label = xcode.getcopyphaselabel('Resources', i, tt[1]) \n local id = xcode.uuid(label) \n local files = table.translate(table.flatten(tt[2]), path.getname) \n doblock(id, label, 7, tt[1], files) \n i = i + 1 \n end \n end \n end \n end \n local function docopyframeworks(which) \n local targets = tr.project[which] \n if #targets > 0 then \n local label = \" Copy Frameworks \" \n local id = xcode.uuid(label) \n local files = table.translate(table.flatten(targets), path.getname) \n doblock(id, label, 10, \" \" , files) \n end \n end \n docopyresources( \" xcodecopyresources \" ) \n if tr.project.kind == \" WindowedApp \" then \n docopyframeworks( \" xcodecopyframeworks \" ) \n end \n if wrapperWritten then \n _p('/* End PBXCopyFilesBuildPhase section */') \n end \n end \n function xcode.PBXVariantGroup(tr "
" ) \n _p('/* Begin PBXVariantGroup section */') \n tree.traverse(tr, { \n onbranch = function(node) \n if node.kind == \" vgroup \" then \n _p(2,'%s /* %s */ = {', node.id, node.name) \n _p(3,'isa = PBXVariantGroup;') \n _p(3,'children = (') \n for _, lang in ipairs(node.children) do \n _p(4,'%s /* %s */,', lang.id, lang.name) \n end \n _p(3,');') \n _p(3,'name = %s;', node.name) \n _p(3,'sourceTree = \" <group> \" ;') \n _p(2,'};') \n end \n end \n }) \n _p('/* End PBXVariantGroup section */') \n _p('') \n end \n function xcode.PBXTargetDependency(tr) \n if #tr.projects.children > 0 then \n _p('/* Begin PBXTargetDependency section */') \n tree.traverse(tr.projects, { \n onleaf = function(node) \n _p(2,'%s /* PBXTargetDependency */ = {', node.parent.targetdependid) \n _p(3,'isa = PBXTargetDependency;') \n _p(3,'name = \" %s \" ;', node.name) \n _p(3,'targetProxy = %s /* PBXContainerItemProxy */;', node.parent.targetproxyid) \n _p(2,'};') \n end \n }) \n _p('/* End PBXTargetDependency section */') \n _p('') \n end \n end \n function xcode.cfg_excluded_files(prj, cfg) \n local excluded = {} \n loc "
" al function exclude_pattern(file) \n if path.isabsolute(file) then \n return file \n end \n local start, term = file:findlast( \" /%.%./ \" ) \n if term then \n return path.join( \" * \" , file:sub(term + 1)) \n end \n start, term = file:find( \" %.%./ \" ) \n if start == 1 then \n return path.join( \" * \" , file:sub(term + 1)) \n end \n return path.join( \" * \" , file) \n end \n local function add_file(file) \n local name = exclude_pattern(file) \n if not table.icontains(excluded, name) then \n table.insert(excluded, name) \n end \n end \n local function verify_file(file) \n local name = exclude_pattern(file) \n if table.icontains(excluded, name) then \n error( \" ' \" .. file .. \" ' would be excluded by the rule to exclude ' \" .. name .. \" ' \" ) \n end \n end \n for _, file in ipairs(cfg.excludes) do \n add_file(file) \n end \n for _, file in ipairs(prj.allfiles) do \n if not table.icontains(prj.excludes, file) and not table.icontains(cfg.excludes, file) then \n if not table.icontains(cfg.files, file) then \n add_file(file) \n else \n verify_file(file) \n end \n end \n end \n table.sort(excluded) \n return "
" excluded \n end \n function xcode.XCBuildConfiguration_Impl(tr, id, opts, cfg) \n local cfgname = xcode.getconfigname(cfg) \n _p(2,'%s /* %s */ = {', id, cfgname) \n _p(3,'isa = XCBuildConfiguration;') \n _p(3,'buildSettings = {') \n for k, v in table.sortedpairs(opts) do \n if type(v) == \" table \" then \n if #v > 0 then \n _p(4,'%s = (', k) \n for i, v2 in ipairs(v) do \n _p(5,'%s,', xcode.quotestr(tostring(v2))) \n end \n _p(4,');') \n end \n else \n _p(4,'%s = %s;', k, xcode.quotestr(tostring(v))) \n end \n end \n _p(3,'};') \n _p(3,'name = %s;', xcode.quotestr(cfgname)) \n _p(2,'};') \n end \n local function add_options(options, extras) \n for _, tbl in ipairs(extras) do \n for tkey, tval in pairs(tbl) do \n options[tkey] = tval \n end \n end \n end \n local function add_wholearchive_links(opts, cfg) \n if #cfg.wholearchive > 0 then \n local linkopts = {} \n for _, depcfg in ipairs(premake.getlinks(cfg, \" siblings \" , \" object \" )) do \n if table.icontains(cfg.wholearchive, depcfg.project.name) then \n local linkpath = path.rebase(depcfg.linktarget.fullpath, depcfg.location, cf "
" g.location) \n table.insert(linkopts, \" -force_load \" ) \n table.insert(linkopts, linkpath) \n end \n end \n if opts.OTHER_LDFLAGS then \n linkopts = table.join(linkopts, opts.OTHER_LDFLAGS) \n end \n opts.OTHER_LDFLAGS = linkopts \n end \n end \n function xcode.XCBuildConfiguration(tr, prj, opts) \n _p('/* Begin XCBuildConfiguration section */') \n for _, target in ipairs(tr.products.children) do \n for _, cfg in ipairs(tr.configs) do \n local values = opts.ontarget(tr, target, cfg) \n add_options(values, cfg.xcodetargetopts) \n xcode.XCBuildConfiguration_Impl(tr, cfg.xcode.targetid, values, cfg) \n end \n end \n for _, cfg in ipairs(tr.configs) do \n local values = opts.onproject(tr, prj, cfg) \n add_options(values, cfg.xcodeprojectopts) \n add_wholearchive_links(values, cfg) \n xcode.XCBuildConfiguration_Impl(tr, cfg.xcode.projectid, values, cfg) \n end \n _p('/* End XCBuildConfiguration section */') \n _p('') \n end \n function xcode.XCBuildConfigurationList(tr) \n local sln = tr.project.solution \n _p('/* Begin XCConfigurationList section */') \n for _, target in ipair "
" s(tr.products.children) do \n _p(2,'%s /* Build configuration list for PBXNativeTarget \" %s \" */ = {', target.cfgsection, target.name) \n _p(3,'isa = XCConfigurationList;') \n _p(3,'buildConfigurations = (') \n for _, cfg in ipairs(tr.configs) do \n _p(4,'%s /* %s */,', cfg.xcode.targetid, xcode.getconfigname(cfg)) \n end \n _p(3,');') \n _p(3,'defaultConfigurationIsVisible = 0;') \n _p(3,'defaultConfigurationName = \" %s \" ;', xcode.getconfigname(tr.configs[1])) \n _p(2,'};') \n end \n _p(2,'1DEB928908733DD80010E9CD /* Build configuration list for PBXProject \" %s \" */ = {', tr.name) \n _p(3,'isa = XCConfigurationList;') \n _p(3,'buildConfigurations = (') \n for _, cfg in ipairs(tr.configs) do \n _p(4,'%s /* %s */,', cfg.xcode.projectid, xcode.getconfigname(cfg)) \n end \n _p(3,');') \n _p(3,'defaultConfigurationIsVisible = 0;') \n _p(3,'defaultConfigurationName = \" %s \" ;', xcode.getconfigname(tr.configs[1])) \n _p(2,'};') \n _p('/* End XCConfigurationList section */') \n _p('') \n end \n function xcode.Footer() \n _p(1,'};') \n _p(' \\ trootObject = __RootObject_ /* "
" Project object */;') \n _p('}') \n end \n " ,
/* actions/xcode/xcode_project.lua */
" local xcode = premake.xcode \n local tree = premake.tree \n function xcode.buildprjtree(prj) \n local tr = premake.project.buildsourcetree(prj, true) \n tr.configs = {} \n for _, cfgname in ipairs(prj.solution.configurations) do \n for _, platform in ipairs(prj.solution.xcode.platforms) do \n local cfg = premake.getconfig(prj, cfgname, platform) \n cfg.xcode = {} \n cfg.xcode.targetid = xcode.newid(prj.xcode.projectnode, cfgname) \n cfg.xcode.projectid = xcode.newid(tr, cfgname) \n table.insert(tr.configs, cfg) \n end \n end \n tree.traverse(tr, { \n onbranch = function(node) \n if path.getextension(node.name) == \" .lproj \" then \n local lang = path.getbasename(node.name) -- \" English \" , \" French \" , etc. \n for _, filenode in ipairs(node.children) do \n local grpnode = node.parent.children[filenode.name] \n if not grpnode then \n grpnode = tree.insert(node.parent, tree.new(filenode.name)) \n grpnode.kind = \" vgroup \" \n end \n filenode.name = path.getbasename(lang) \n tree.insert(grpnode, filenode) \n end \n tree.remove(node) \n end \n end \n }) \n tree.traverse(tr, { \n "
" onbranch = function(node) \n if path.getextension(node.name) == \" .xcassets \" then \n node.children = {} \n end \n end \n }) \n tr.frameworks = tree.new( \" Frameworks \" ) \n for cfg in premake.eachconfig(prj) do \n for _, link in ipairs(premake.getlinks(cfg, \" system \" , \" fullpath \" )) do \n local name = path.getname(link) \n if xcode.isframework(name) and not tr.frameworks.children[name] then \n node = tree.insert(tr.frameworks, tree.new(name)) \n node.path = link \n end \n end \n end \n if #tr.frameworks.children > 0 then \n tree.insert(tr, tr.frameworks) \n end \n tr.products = tree.insert(tr, tree.new( \" Products \" )) \n tr.projects = tree.new( \" Projects \" ) \n for _, dep in ipairs(premake.getdependencies(prj, \" sibling \" , \" object \" )) do \n local xcpath = xcode.getxcodeprojname(dep) \n local xcnode = tree.insert(tr.projects, tree.new(path.getname(xcpath))) \n xcnode.path = xcpath \n xcnode.project = dep \n xcnode.productgroupid = xcode.newid(xcnode, \" prodgrp \" ) \n xcnode.productproxyid = xcode.newid(xcnode, \" prodprox \" ) \n xcnode.targetproxyid = xcode.newid(xcnod "
" e, \" targprox \" ) \n xcnode.targetdependid = xcode.newid(xcnode, \" targdep \" ) \n local cfg = premake.getconfig(dep, prj.configurations[1]) \n node = tree.insert(xcnode, tree.new(cfg.linktarget.name)) \n node.path = cfg.linktarget.fullpath \n node.cfg = cfg \n end \n if #tr.projects.children > 0 then \n tree.insert(tr, tr.projects) \n end \n tree.traverse(tr, { \n on node = function(node)\n node.id = xcode.newid(node) \n if xcode.getbuildcategory(node) then \n node.buildid = xcode.newid(node, \" build \" ) \n end \n if string.endswith(node.name, \" Info.plist \" ) then \n tr.infoplist = node \n end \n if string.endswith(node.name, \" .entitlements \" ) then \n tr.entitlements = node \n end \n end \n }, true) \n node = tree.insert(tr.products, prj.xcode.projectnode) \n node.kind = \" product \" \n node.path = node.cfg.buildtarget.fullpath \n node.cfgsection = xcode.newid(node, \" cfg \" ) \n node.resstageid = xcode.newid(node, \" rez \" ) \n node.sourcesid = xcode.newid(node, \" src \" ) \n node.fxstageid = xcode.newid(node, \" fxs \" ) \n return tr \n end \n function premake.xcode.project(prj) \n lo "
" cal tr = xcode.buildprjtree(prj)\n xcode.Header(tr) \n xcode.PBXBuildFile(tr) \n xcode.PBXContainerItemProxy(tr) \n xcode.PBXFileReference(tr,prj) \n xcode.PBXFrameworksBuildPhase(tr) \n xcode.PBXGroup(tr) \n xcode.PBXNativeTarget(tr) \n xcode.PBXProject(tr) \n xcode.PBXReferenceProxy(tr) \n xcode.PBXResourcesBuildPhase(tr) \n xcode.PBXShellScriptBuildPhase(tr) \n xcode.PBXSourcesBuildPhase(tr,prj) \n xcode.PBXVariantGroup(tr) \n xcode.PBXTargetDependency(tr) \n xcode.XCBuildConfiguration(tr, prj) \n xcode.XCBuildConfigurationList(tr) \n xcode.Footer(tr) \n end \n " ,
" local xcode = premake.xcode \n local tree = premake.tree \n function xcode.buildprjtree(prj) \n local tr = premake.project.buildsourcetree(prj, true) \n tr.configs = {} \n for _, cfgname in ipairs(prj.solution.configurations) do \n for _, platform in ipairs(prj.solution.xcode.platforms) do \n local cfg = premake.getconfig(prj, cfgname, platform) \n cfg.xcode = {} \n cfg.xcode.targetid = xcode.newid(prj.xcode.projectnode, \" tgt: \" ..platform.. cfgname)\n cfg.xcode.projectid = xcode.newid(tr, \" prj: \" ..platform.. cfgname)\n table.insert(tr.configs, cfg) \n end \n end \n tree.traverse(tr, { \n onbranch = function(node) \n if path.getextension(node.name) == \" .lproj \" then \n local lang = path.getbasename(node.name) -- \" English \" , \" French \" , etc. \n for _, filenode in ipairs(node.children) do \n local grpnode = node.parent.children[filenode.name] \n if not grpnode then \n grpnode = tree.insert(node.parent, tree.new(filenode.name)) \n grpnode.kind = \" vgroup \" \n end \n filenode.name = path.getbasename(lang) \n tree.insert(grpnode, filenode) \n end \n tree.remove(no "
" de)\n end \n end \n }) \n tree.traverse(tr, { \n onbranch = function(node)\n if path.getextension(node.name) == \" .xcassets \" then \n node.children = {} \n end \n end \n }) \n tr.frameworks = tree.new( \" Frameworks \" ) \n for cfg in premake.eachconfig(prj) do \n for _, link in ipairs(premake.getlinks(cfg, \" system \" , \" fullpath \" )) do \n local name = path.getname(link) \n if xcode.isframework(name) and not tr.frameworks.children[name] then \n node = tree.insert(tr.frameworks, tree.new(name)) \n node.path = link \n end \n end \n end \n if #tr.frameworks.children > 0 then \n tree.insert(tr, tr.frameworks) \n end \n tr.products = tree.insert(tr, tree.new( \" Products \" )) \n tr.projects = tree.new( \" Projects \" ) \n for _, dep in ipairs(premake.getdependencies(prj, \" sibling \" , \" object \" )) do \n local xcpath = xcode.getxcodeprojname(dep) \n local xcnode = tree.insert(tr.projects, tree.new(path.getname(xcpath))) \n xcnode.path = xcpath \n xcnode.project = dep \n xcnode.productgroupid = xcode.newid(xcnode, \" prodgrp \" ) \n xcnode.productproxyid = xcode.newid(xcnode, \" prodprox \" ) \n x "
" cnode.targetproxyid = xcode.newid(xcnod e, \" targprox \" ) \n xcnode.targetdependid = xcode.newid(xcnode, \" targdep \" ) \n local cfg = premake.getconfig(dep, prj.configurations[1]) \n node = tree.insert(xcnode, tree.new(cfg.linktarget.name)) \n node.path = cfg.linktarget.fullpath \n node.cfg = cfg \n end \n if #tr.projects.children > 0 then \n tree.insert(tr, tr.projects) \n end \n tree.traverse(tr, { \n on branchexit = function(node)\n for _, child in ipairs(node.children) do \n if (child.location) then \n if (node.location) then \n while (not string.startswith(child.location, node.location)) do \n node.location = path.getdirectory(node.location) \n end \n else \n node.location = path.getdirectory(child.location) \n end \n end \n end \n end, \n onleaf = function(node) \n if (node.cfg) then \n node.location = node.cfg.name \n end \n end \n }, true) \n tree.traverse(tr, { \n onbranchexit = function(node, depth) \n if (node.location and node.parent and node.parent.location) then \n node.location = path.getrelative(node.parent.location, node.location) \n end \n end, \n onleaf = function "
" (node, depth)\n if (node.location and node.parent and node.parent.location) then \n node.location = path.getrelative(node.parent.location, node.location) \n end \n end \n }, true) \n tree.traverse(tr, { \n onnode = function(node) \n node.id = xcode.newid(node) \n if xcode.getbuildcategory(node) then \n node.buildid = xcode.newid(node, \" build \" ) \n end \n if string.endswith(node.name, \" Info.plist \" ) then \n tr.infoplist = node \n end \n if string.endswith(node.name, \" .entitlements \" ) then \n tr.entitlements = node \n end \n end \n }, true) \n node = tree.insert(tr.products, prj.xcode.projectnode) \n node.kind = \" product \" \n node.path = node.cfg.buildtarget.fullpath \n node.cfgsection = xcode.newid(node, \" cfg \" ) \n node.resstageid = xcode.newid(node, \" rez \" ) \n node.sourcesid = xcode.newid(node, \" src \" ) \n node.fxstageid = xcode.newid(node, \" fxs \" ) \n return tr \n end \n " ,
/* actions/xcode/xcode4_workspace.lua */
" premake.xcode4 = {} \n local xcode4 = premake.xcode4 \n function xcode4.workspace_head() \n _p('<?xml version= \" 1.0 \" encoding= \" UTF-8 \" ?>') \n _p('<Workspace') \n _p(1,'version = \" 1.0 \" >') \n end \n function xcode4.workspace_tail() \n _p('</Workspace>') \n end \n function xcode4.workspace_file_ref(prj, indent) \n local projpath = path.getrelative(prj.solution.location, prj.location) \n if projpath == '.' then projpath = '' \n else projpath = projpath ..'/' \n end \n _p(indent, '<FileRef') \n _p(indent + 1, 'location = \" group:%s \" >', projpath .. prj.name .. '.xcodeproj') \n _p(indent, '</FileRef>') \n end \n function xcode4.workspace_group(grp, indent) \n _p(indent, '<Group') \n _p(indent + 1, 'location = \" container: \" ') \n _p(indent + 1, 'name = \" %s \" >', grp.name) \n for _, child in ipairs(grp.groups) do \n xcode4.workspace_group(child, indent + 1) \n end \n for _, prj in ipairs(grp.projects) do \n xcode4.workspace_file_ref(prj, indent + 1) \n end \n _p(indent, '</Group>') \n end \n function xcode4.workspace_generate(sln) \n premake.xcode.preparesolution(sln) \n xcode4. "
" workspace_head() \n xcode4.reorderProjects(sln) \n for grp in premake.solution.eachgroup(sln) do \n if grp.parent == nil then \n xcode4.workspace_group(grp, 1) \n end \n end \n for prj in premake.solution.eachproject(sln) do \n if prj.group == nil then \n xcode4.workspace_file_ref(prj, 1) \n end \n end \n xcode4.workspace_tail() \n end \n function xcode4.reorderProjects(sln) \n if sln.startproject then \n for i, prj in ipairs(sln.projects) do \n if sln.startproject == prj.name then \n local cur = prj.group \n while cur ~= nil do \n for j, group in ipairs(sln.groups) do \n if group == cur then \n table.remove(sln.groups, j) \n break \n end \n end \n table.insert(sln.groups, 1, cur) \n cur = cur.parent \n end \n table.remove(sln.projects, i) \n table.insert(sln.projects, 1, prj) \n break \n end \n end \n end \n end \n " ,
/* actions/xcode/xcode_scheme.lua */
" local premake = premake \n local xcode = premake.xcode \n local function buildableref(indent, prj, cfg) \n cfg = cfg or premake.eachconfig(prj)() \n _p(indent + 0, '<BuildableReference') \n _p(indent + 1, 'BuildableIdentifier = \" primary \" ') \n _p(indent + 1, 'BlueprintIdentifier = \" %s \" ', prj.xcode.projectnode.targetid) \n _p(indent + 1, 'BuildableName = \" %s \" ', cfg.buildtarget.name) \n _p(indent + 1, 'BlueprintName = \" %s \" ', prj.name) \n _p(indent + 1, 'ReferencedContainer = \" container:%s.xcodeproj \" >', prj.name) \n _p(indent + 0, '</BuildableReference>') \n end \n local function cmdlineargs(indent, cfg) \n if #cfg.debugargs > 0 then \n _p(indent, '<CommandLineArguments>') \n for _, arg in ipairs(cfg.debugargs) do \n _p(indent + 1, '<CommandLineArgument') \n _p(indent + 2, 'argument = \" %s \" ', arg) \n _p(indent + 2, 'isEnabled = \" YES \" >') \n _p(indent + 1, '</CommandLineArgument>') \n end \n _p(indent, '</CommandLineArguments>') \n end \n end \n local function envvars(indent, cfg) \n if #cfg.debugenvs > 0 then \n _p(indent, '<EnvironmentVariables>') \n f "
" or _, arg in ipairs(cfg.debugenvs) do \n local eq = arg:find( \" = \" ) \n local k = arg:sub(1, eq) \n local v = arg:sub(eq + 1) \n _p(indent + 1, '<EnvironmentVariable') \n _p(indent + 2, 'key = \" %s \" ', arg:sub(1, eq)) \n _p(indent + 2, 'value = \" %s \" ', arg:sub(eq)) \n _p(indent + 2, 'isEnabled = \" YES \" >') \n _p(indent + 1, '</EnvironmentVariable>') \n end \n _p(indent, '</EnvironmentVariables>') \n end \n end \n local function workingdir(dir) \n if not path.isabsolute(dir) then \n dir = \" $PROJECT_DIR/ \" .. dir \n end \n return dir \n end \n local function bestconfig(prj, fordebug) \n local bestcfg = nil \n local bestscore = -1 \n for cfg in premake.eachconfig(prj) do \n local score = 0 \n if cfg.platform == \" Native \" then \n score = score + 10 \n end \n if fordebug and cfg.name == \" Debug \" then \n score = score + 1 \n end \n if not fordebug and cfg.name == \" Release \" then \n score = score + 1 \n end \n if score > bestscore then \n bestcfg = cfg \n bestscore = score \n end \n end \n return bestcfg \n end \n function xcode.scheme(tobuild, primary, schemecfg) \n _p('<?xml version= \" 1.0 \" "
" encoding= \" UTF-8 \" ?>') \n _p('<Scheme') \n _p(1, 'LastUpgradeVersion = \" 0940 \" ') \n _p(1, 'version = \" 1.3 \" >') \n _p(1, '<BuildAction') \n _p(2, 'parallelizeBuildables = \" YES \" ') \n _p(2, 'buildImplicitDependencies = \" YES \" >') \n _p(2, '<BuildActionEntries>') \n for _, prj in ipairs(tobuild) do \n _p(3, '<BuildActionEntry') \n _p(4, 'buildForTesting = \" YES \" ') \n _p(4, 'buildForRunning = \" YES \" ') \n _p(4, 'buildForProfiling = \" YES \" ') \n _p(4, 'buildForArchiving = \" YES \" ') \n _p(4, 'buildForAnalyzing = \" YES \" >') \n buildableref(4, prj) \n _p(3, '</BuildActionEntry>') \n end \n local debugcfg = schemecfg or bestconfig(primary, true) \n local releasecfg = schemecfg or bestconfig(primary, false) \n local debugname = xcode.getconfigname(debugcfg) \n local releasename = xcode.getconfigname(releasecfg) \n _p(2, '</BuildActionEntries>') \n _p(1, '</BuildAction>') \n _p(1, '<TestAction') \n _p(2, 'buildConfiguration = \" %s \" ', debugname) \n _p(2, 'selectedDebuggerIdentifier = \" Xcode.DebuggerFoundation.Debugger.LLDB \" ') \n _p(2, 'selectedLauncherIdentifier "
" = \" Xcode.DebuggerFoundation.Launcher.LLDB \" ') \n _p(2, 'shouldUseLaunchSchemeArgsEnv = \" YES \" >') \n _p(2, '<Testables>') \n _p(2, '</Testables>') \n _p(2, '<MacroExpansion>') \n buildableref(3, primary, debugcfg) \n _p(2, '</MacroExpansion>') \n _p(2, '<AdditionalOptions>') \n _p(2, '</AdditionalOptions>') \n _p(1, '</TestAction>') \n _p(1, '<LaunchAction') \n _p(2, 'buildConfiguration = \" %s \" ', debugname) \n _p(2, 'selectedDebuggerIdentifier = \" Xcode.DebuggerFoundation.Debugger.LLDB \" ') \n _p(2, 'selectedLauncherIdentifier = \" Xcode.DebuggerFoundation.Launcher.LLDB \" ') \n _p(2, 'launchStyle = \" 0 \" ') \n if debugcfg.debugdir then \n _p(2, 'useCustomWorkingDirectory = \" YES \" ') \n _p(2, 'customWorkingDirectory = \" %s \" ', workingdir(debugcfg.debugdir)) \n else \n _p(2, 'useCustomWorkingDirectory = \" NO \" ') \n end \n _p(2, 'ignoresPersistentStateOnLaunch = \" NO \" ') \n _p(2, 'debugDocumentVersioning = \" YES \" ') \n _p(2, 'debugServiceExtension = \" internal \" ') \n _p(2, 'allowLocationSimulation = \" YES \" >') \n if debugcfg.debugcmd then \n _p(2, '<PathRunnable') "
" \n _p(3, 'runnableDebuggingMode = \" 0 \" ') \n _p(3, 'FilePath = \" %s \" >', debugcfg.debugcmd) \n _p(2, '</PathRunnable>') \n else \n _p(2, '<BuildableProductRunnable') \n _p(3, 'runnableDebuggingMode = \" 0 \" >') \n buildableref(3, primary, debugcfg) \n _p(2, '</BuildableProductRunnable>') \n end \n cmdlineargs(2, debugcfg) \n envvars(2, debugcfg) \n _p(2, '<AdditionalOptions>') \n _p(2, '</AdditionalOptions>') \n _p(1, '</LaunchAction>') \n _p(1, '<ProfileAction') \n _p(2, 'buildConfiguration = \" %s \" ', releasename) \n _p(2, 'shouldUseLaunchSchemeArgsEnv = \" YES \" ') \n _p(2, 'savedToolIdentifier = \" \" ') \n if releasecfg.debugdir then \n _p(2, 'useCustomWorkingDirectory = \" YES \" ') \n _p(2, 'customWorkingDirectory = \" %s \" ', workingdir(releasecfg.debugdir)) \n else \n _p(2, 'useCustomWorkingDirectory = \" NO \" ') \n end \n _p(2, 'debugDocumentVersioning = \" YES \" >') \n _p(2, '<BuildableProductRunnable') \n _p(3, 'runnableDebuggingMode = \" 0 \" >') \n buildableref(3, primary, releasecfg) \n _p(2, '</BuildableProductRunnable>') \n cmdlineargs(2, releasecfg) \n envvars(2, release "
" cfg) \n _p(1, '</ProfileAction>') \n _p(1, '<AnalyzeAction') \n _p(2, 'buildConfiguration = \" %s \" >', debugname) \n _p(1, '</AnalyzeAction>') \n _p(1, '<ArchiveAction') \n _p(2, 'buildConfiguration = \" %s \" ', releasename) \n _p(2, 'revealArchiveInOrganizer = \" YES \" >') \n _p(1, '</ArchiveAction>') \n _p('</Scheme>') \n end \n function xcode.generate_schemes(prj, base_path) \n if (prj.kind == \" ConsoleApp \" or prj.kind == \" WindowedApp \" ) or (prj.options and prj.options.XcodeLibrarySchemes) then \n if prj.options and prj.options.XcodeSchemeNoConfigs then \n premake.generate(prj, path.join(base_path, \" %%.xcscheme \" ), \n function(prj) xcode.scheme({prj}, prj) end) \n else \n for cfg in premake.eachconfig(prj) do \n premake.generate(prj, path.join(base_path, \" %% \" .. cfg.name .. \" .xcscheme \" ), \n function(prj) xcode.scheme({prj}, prj, cfg) end) \n end \n end \n end \n end \n " ,
/* actions/xcode/xcode6_project.lua */
" local xcode = premake.xcode \n local xcode6 = xcode.xcode6 \n local tree = premake.tree \n function xcode6.buildprjtree(prj) \n local tr = premake.project.buildsourcetree(prj) \n tr.configs = {} \n for _, cfgname in ipairs(prj.solution.configurations) do \n for _, platform in ipairs(prj.solution.xcode.platforms) do \n local cfg = premake.getconfig(prj, cfgname, platform) \n cfg.xcode = {} \n cfg.xcode.targetid = xcode.newid(prj.xcode.projectnode, cfgname) \n cfg.xcode.projectid = xcode.newid(tr, cfgname) \n table.insert(tr.configs, cfg) \n end \n end \n tree.traverse(tr, { \n onbranch = function(node) \n if path.getextension(node.name) == \" .lproj \" then \n local lang = path.getbasename(node.name) -- \" English \" , \" French \" , etc. \n for _, filenode in ipairs(node.children) do \n local grpnode = node.parent.children[filenode.name] \n if not grpnode then \n grpnode = tree.insert(node.parent, tree.new(filenode.name)) \n grpnode.kind = \" vgroup \" \n end \n filenode.name = path.getbasename(lang) \n tree.insert(grpnode, filenode) \n end \n tree.remove(node) \n end \n end "
" \n }) \n tree.traverse(tr, { \n onbranch = function(node) \n if path.getextension(node.name) == \" .xcassets \" then \n node.children = {} \n end \n end \n }) \n tr.frameworks = tree.new( \" Frameworks \" ) \n for cfg in premake.eachconfig(prj) do \n for _, link in ipairs(premake.getlinks(cfg, \" system \" , \" fullpath \" )) do \n local name = path.getname(link) \n if xcode.isframework(name) and not tr.frameworks.children[name] then \n node = tree.insert(tr.frameworks, tree.new(name)) \n node.path = link \n end \n end \n end \n if #tr.frameworks.children > 0 then \n tree.insert(tr, tr.frameworks) \n end \n tr.products = tree.insert(tr, tree.new( \" Products \" )) \n tr.projects = tree.new( \" Projects \" ) \n for _, dep in ipairs(premake.getdependencies(prj, \" sibling \" , \" object \" )) do \n local xcpath = xcode.getxcodeprojname(dep) \n local xcnode = tree.insert(tr.projects, tree.new(path.getname(xcpath))) \n xcnode.path = xcpath \n xcnode.project = dep \n xcnode.productgroupid = xcode.newid(xcnode, \" prodgrp \" ) \n xcnode.productproxyid = xcode.newid(xcnode, \" prodprox \" ) \n xcnode.target "
" proxyid = xcode.newid(xcnode, \" targprox \" ) \n xcnode.targetdependid = xcode.newid(xcnode, \" targdep \" ) \n local cfg = premake.getconfig(dep, prj.configurations[1]) \n node = tree.insert(xcnode, tree.new(cfg.linktarget.name)) \n node.path = cfg.linktarget.fullpath \n node.cfg = cfg \n end \n if #tr.projects.children > 0 then \n tree.insert(tr, tr.projects) \n end \n tree.traverse(tr, { \n onnode = function(node) \n node.id = xcode.newid(node) \n if xcode.getbuildcategory(node) then \n node.buildid = xcode.newid(node, \" build \" ) \n end \n if string.endswith(node.name, \" Info.plist \" ) then \n tr.infoplist = node \n end \n if string.endswith(node.name, \" .entitlements \" ) then \n tr.entitlements = node \n end \n end \n }, true) \n node = tree.insert(tr.products, prj.xcode.projectnode) \n node.kind = \" product \" \n node.path = node.cfg.buildtarget.fullpath \n node.cfgsection = xcode.newid(node, \" cfg \" ) \n node.resstageid = xcode.newid(node, \" rez \" ) \n node.sourcesid = xcode.newid(node, \" src \" ) \n node.fxstageid = xcode.newid(node, \" fxs \" ) \n return tr \n end \n function xc "
" ode6.project(prj) \n local tr = xcode6.buildprjtree(prj) \n xcode6.Header(tr) \n xcode6.PBXProject(tr) \n xcode.PBXBuildFile(tr) \n xcode.PBXContainerItemProxy(tr) \n xcode.PBXFileReference(tr,prj) \n xcode.PBXFrameworksBuildPhase(tr) \n xcode.PBXGroup(tr) \n xcode.PBXNativeTarget(tr) \n xcode.PBXReferenceProxy(tr) \n xcode.PBXResourcesBuildPhase(tr) \n xcode.PBXShellScriptBuildPhase(tr) \n xcode.PBXSourcesBuildPhase(tr,prj) \n xcode.PBXVariantGroup(tr) \n xcode.PBXTargetDependency(tr) \n xcode.XCBuildConfiguration(tr) \n xcode.XCBuildConfigurationList(tr) \n xcode6.PBXConfigsGroup() \n xcode6.Footer(tr) \n end \n function xcode6.Header() \n _p('// !$*UTF8*$!') \n _p('{') \n _p(1,'archiveVersion = 1;') \n _p(1,'classes = {}') \n _p(1,'objectVersion = 46;') \n _p(1,'rootObject = __RootObject_;') \n _p(1,'objects = {') \n end \n function xcode6.PBXProject(tr) \n _p(2,'__RootObject_ = {') \n _p(3,'isa = PBXProject;') \n _p(3,'attributes = {LastUpgradeCheck = 9999;};') \n _p(3,'buildConfigurationList = ___RootConfs_;', tr.name) \n _p(3,'compatibilityVersion = \" Xcode 3.2 \" ;') \n _p(3, "
" 'developmentRegion = English;') \n _p(3,'hasScannedForEncodings = 0;') \n _p(3,'knownRegions = (en);') \n _p(3,'mainGroup = ___RootGroup_;') \n _p(3,'projectDirPath = \" \" ;') \n _p(3,'projectRoot = \" \" ;') \n _p(3,'targets = (') \n for _, node in ipairs(tr.products.children) do \n _p(4,'%s /* %s */,', node.targetid, node.name) \n end \n _p(3,');') \n if #tr.projects.children > 0 then \n _p(3,'projectReferences = (') \n for _, node in ipairs(tr.projects.children) do \n _p(4,'{') \n _p(5,'ProductGroup = %s /* Products */;', node.productgroupid) \n _p(5,'ProjectRef = %s /* %s */;', node.id, path.getname(node.path)) \n _p(4,'},') \n end \n _p(3,');') \n end \n _p(2,'};') \n _p('') \n end \n function xcode6.PBXConfigsGroup() \n _p(2, \" _____Configs_ = { \" ) \n _p(3, \" isa = PBXGroup; \" ) \n _p(3, \" children = ( \" ) \n _p(3, \" ); \" ) \n _p(3, \" name = Configs; \" ) \n _p(3, \" sourceTree = '<group>'; \" ) \n _p(2, \" }; \" ) \n end \n function xcode6.Footer() \n _p(1,'};') \n _p('}') \n end \n " ,
/* actions/xcode/xcode_workspace.lua */
" local premake = premake \n local xcode = premake.xcode \n xcode.allscheme = false \n function xcode.workspace_head() \n _p('<?xml version= \" 1.0 \" encoding= \" UTF-8 \" ?>') \n _p('<Workspace') \n _p(1,'version = \" 1.0 \" >') \n end \n function xcode.workspace_tail() \n _p('</Workspace>') \n end \n function xcode.workspace_file_ref(prj, indent) \n local projpath = path.getrelative(prj.solution.location, prj.location) \n if projpath == '.' then projpath = '' \n else projpath = projpath ..'/' \n end \n _p(indent, '<FileRef') \n _p(indent + 1, 'location = \" group:%s \" >', projpath .. prj.name .. '.xcodeproj') \n _p(indent, '</FileRef>') \n end \n function xcode.workspace_group(grp, indent) \n _p(indent, '<Group') \n _p(indent + 1, 'location = \" container: \" ') \n _p(indent + 1, 'name = \" %s \" >', grp.name) \n local function comparenames(a, b) \n return a.name < b.name \n end \n local groups = table.join(grp.groups) \n local projects = table.join(grp.projects) \n table.sort(groups, comparenames) \n table.sort(projects, comparenames) \n for _, child in ipairs(groups) do \n xcode.workspac "
" e_group(child, indent + 1) \n end \n for _, prj in ipairs(projects) do \n xcode.workspace_file_ref(prj, indent + 1) \n end \n _p(indent, '</Group>') \n end \n function xcode.workspace_generate(sln) \n xcode.preparesolution(sln) \n xcode.workspace_head() \n xcode.reorderProjects(sln) \n for grp in premake.solution.eachgroup(sln) do \n if grp.parent == nil then \n xcode.workspace_group(grp, 1) \n end \n end \n for prj in premake.solution.eachproject(sln) do \n if prj.group == nil then \n xcode.workspace_file_ref(prj, 1) \n end \n end \n xcode.workspace_tail() \n end \n function xcode.workspace_scheme(sln) \n if not xcode.allscheme then \n return false \n end \n local projects = {} \n local primary = nil \n for prj in premake.solution.eachproject(sln) do \n if not primary or (sln.startproject == prj.name) then \n primary = prj \n end \n table.insert(projects, prj) \n end \n xcode.scheme(projects, primary) \n end \n function xcode.workspace_settings(sln) \n _p('<?xml version= \" 1.0 \" encoding= \" UTF-8 \" ?>') \n _p('<!DOCTYPE plist PUBLIC \" -//Apple//DTD PLIST 1.0//EN \" \" http://www.apple.com/D "
" TDs/PropertyList-1.0.dtd \" >') \n _p('<plist version= \" 1.0 \" >') \n _p('<dict>') \n _p(1, '<key>IDEWorkspaceSharedSettings_AutocreateContextsIfNeeded</key>') \n _p(1, '<false/>') \n _p('</dict>') \n _p('</plist>') \n end \n function xcode.reorderProjects(sln) \n if sln.startproject then \n for i, prj in ipairs(sln.projects) do \n if sln.startproject == prj.name then \n local cur = prj.group \n while cur ~= nil do \n for j, group in ipairs(sln.groups) do \n if group == cur then \n table.remove(sln.groups, j) \n break \n end \n end \n table.insert(sln.groups, 1, cur) \n cur = cur.parent \n end \n table.remove(sln.projects, i) \n table.insert(sln.projects, 1, prj) \n break \n end \n end \n end \n end \n " ,
/* actions/xcode/xcode6_config.lua */
" local xcode6 = premake.xcode.xcode6 \n function xcode6.generate_project_config(prj) \n _p( \" PRODUCT_NAME = $(TARGET_NAME) \" ) \n if premake.isswiftproject(prj) then \n _p( \" OTHER_SWIFT_FLAGS = -DXcode \" ) \n _p( \" USE_HEADERMAP = NO \" ) \n end \n end " ,
/* actions/xcode/xcode8.lua */
" local premake = premake \n premake.xcode8 = { } \n local xcode = premake.xcode \n local xcode8 = premake.xcode8 \n function xcode8.XCBuildConfiguration_Target(tr, target, cfg) \n local cfgname = xcode.getconfigname(cfg) \n local installpaths = { \n ConsoleApp = \" /usr/local/bin \" , \n WindowedApp = \" $(HOME)/Applications \" , \n SharedLib = \" /usr/local/lib \" , \n StaticLib = \" /usr/local/lib \" , \n Bundle = \" $(LOCAL_LIBRARY_DIR)/Bundles \" , \n } \n local options = { \n ALWAYS_SEARCH_USER_PATHS = \" NO \" , \n GCC_DYNAMIC_NO_PIC = \" NO \" , \n GCC_MODEL_TUNING = \" G5 \" , \n INSTALL_PATH = installpaths[cfg.kind], \n PRODUCT_NAME = cfg.buildtarget.basename, \n } \n if not cfg.flags.Symbols then \n options.DEBUG_INFORMATION_FORMAT = \" dwarf-with-dsym \" \n end \n if cfg.kind ~= \" StaticLib \" and cfg.buildtarget.prefix ~= \" \" then \n options.EXECUTABLE_PREFIX = cfg.buildtarget.prefix \n end \n if cfg.targetextension then \n local ext = cfg.targetextension \n options.EXECUTABLE_EXTENSION = iif(ext:startswith( \" . \" ), ext:sub(2), ext) \n end \n if cfg.flags.ObjcARC then \n options.CLA "
" NG_ENABLE_OBJC_ARC = \" YES \" \n end \n local outdir = path.getdirectory(cfg.buildtarget.bundlepath) \n if outdir ~= \" . \" then \n options.CONFIGURATION_BUILD_DIR = outdir \n end \n if tr.infoplist then \n options.INFOPLIST_FILE = tr.infoplist.cfg.name \n end \n local infoplist_file = nil \n for _, v in ipairs(cfg.files) do \n if (string.find (string.lower (v), 'info.plist') ~= nil) then \n infoplist_file = string.format('$(SRCROOT)/%s', v) \n end \n end \n if infoplist_file ~= nil then \n options.INFOPLIST_FILE = infoplist_file \n end \n local action = premake.action.current() \n local get_opt = function(opt, def) \n return (opt and #opt > 0) and opt or def \n end \n local iosversion = get_opt(cfg.iostargetplatformversion, action.xcode.iOSTargetPlatformVersion) \n local macosversion = get_opt(cfg.macostargetplatformversion, action.xcode.macOSTargetPlatformVersion) \n local tvosversion = get_opt(cfg.tvostargetplatformversion, action.xcode.tvOSTargetPlatformVersion) \n if iosversion then \n options.IPHONEOS_DEPLOYMENT_TARGET = iosversion \n elseif macosversion then "
" \n options.MACOSX_DEPLOYMENT_TARGET = macosversion \n elseif tvosversion then \n options.TVOS_DEPLOYMENT_TARGET = tvosversion \n end \n if cfg.kind == \" Bundle \" and not cfg.options.SkipBundling then \n options.PRODUCT_BUNDLE_IDENTIFIER = \" genie. \" .. cfg.buildtarget.basename:gsub( \" %s+ \" , \" . \" ) --replace spaces with . \n local ext = cfg.targetextension \n if ext then \n options.WRAPPER_EXTENSION = iif(ext:startswith( \" . \" ), ext:sub(2), ext) \n else \n options.WRAPPER_EXTENSION = \" bundle \" \n end \n end \n return options \n end \n function xcode8.XCBuildConfiguration_Project(tr, prj, cfg) \n local cfgname = xcode.getconfigname(cfg) \n local archs = { \n Native = nil, \n x32 = \" i386 \" , \n x64 = \" x86_64 \" , \n Universal32 = \" $(ARCHS_STANDARD_32_BIT) \" , \n Universal64 = \" $(ARCHS_STANDARD_64_BIT) \" , \n Universal = \" $(ARCHS_STANDARD_32_64_BIT) \" , \n } \n local checks = { \n [ \" -ffast-math \" ] = cfg.flags.FloatFast, \n [ \" -ffloat-store \" ] = cfg.flags.FloatStrict, \n [ \" -fomit-frame-pointer \" ] = cfg.flags.NoFramePointer, \n } \n loc "
" al cflags = { } \n for flag, check in pairs(checks) do \n if check then \n table.insert(cflags, flag) \n end \n end \n local ldflags = { } \n for _, lib in ipairs(premake.getlinks(cfg, \" system \" )) do \n if not xcode.isframework(lib) then \n table.insert(ldflags, \" -l \" .. lib) \n end \n end \n local options = { \n ARCHS = archs[cfg.platform], \n CLANG_WARN__DUPLICATE_METHOD_MATCH = \" YES \" , \n CLANG_WARN_BOOL_CONVERSION = \" YES \" , \n CLANG_WARN_CONSTANT_CONVERSION = \" YES \" , \n CLANG_WARN_EMPTY_BODY = \" YES \" , \n CLANG_WARN_ENUM_CONVERSION = \" YES \" , \n CLANG_WARN_INFINITE_RECURSION = \" YES \" , \n CLANG_WARN_INT_CONVERSION = \" YES \" , \n CLANG_WARN_SUSPICIOUS_MOVE = \" YES \" , \n CLANG_WARN_UNREACHABLE_CODE = \" YES \" , \n CONFIGURATION_TEMP_DIR = \" $(OBJROOT) \" , \n ENABLE_STRICT_OBJC_MSGSEND = \" YES \" , \n ENABLE_TESTABILITY = \" YES \" , \n GCC_C_LANGUAGE_STANDARD = \" gnu99 \" , \n GCC_NO_COMMON_BLOCKS = \" YES \" , \n GCC_PREP "
" ROCESSOR_DEFINITIONS = cfg.defines, \n GCC_SYMBOLS_PRIVATE_EXTERN = \" NO \" , \n GCC_WARN_64_TO_32_BIT_CONVERSION = \" YES \" , \n GCC_WARN_ABOUT_RETURN_TYPE = \" YES \" , \n GCC_WARN_UNDECLARED_SELECTOR = \" YES \" , \n GCC_WARN_UNINITIALIZED_AUTOS = \" YES \" , \n GCC_WARN_UNUSED_FUNCTION = \" YES \" , \n GCC_WARN_UNUSED_VARIABLE = \" YES \" , \n HEADER_SEARCH_PATHS = table.join(cfg.includedirs, cfg.systemincludedirs), \n LIBRARY_SEARCH_PATHS = cfg.libdirs, \n OBJROOT = cfg.objectsdir, \n ONLY_ACTIVE_ARCH = \" YES \" , \n OTHER_CFLAGS = table.join(cflags, cfg.buildoptions, cfg.buildoptions_c), \n OTHER_CPLUSPLUSFLAGS = table.join(cflags, cfg.buildoptions, cfg.buildoptions_cpp), \n OTHER_LDFLAGS = table.join(ldflags, cfg.linkoptions), \n SDKROOT = xcode.toolset, \n USER_HEADER_SEARCH_PATHS = cfg.userincludedirs, \n } \n if tr.entitlements then \n op "
" tions.CODE_SIGN_ENTITLEMENTS = tr.entitlements.cfg.name \n end \n local targetdir = path.getdirectory(cfg.buildtarget.bundlepath) \n if targetdir ~= \" . \" then \n options.CONFIGURATION_BUILD_DIR = \" $(SYMROOT) \" \n options.SYMROOT = targetdir \n end \n if cfg.flags.Symbols then \n options.COPY_PHASE_STRIP = \" NO \" \n end \n local excluded = xcode.cfg_excluded_files(prj, cfg) \n if #excluded > 0 then \n options.EXCLUDED_SOURCE_FILE_NAMES = excluded \n end \n if cfg.flags.NoExceptions then \n options.GCC_ENABLE_CPP_EXCEPTIONS = \" NO \" \n end \n if cfg.flags.NoRTTI then \n options.GCC_ENABLE_CPP_RTTI = \" NO \" \n end \n if cfg.flags.Symbols and not cfg.flags.NoEditAndContinue then \n options.GCC_ENABLE_FIX_AND_CONTINUE = \" YES \" \n end \n if cfg.flags.NoExceptions then \n options.GCC_ENABLE_OBJC_EXCEPTIONS = \" NO \" \n end \n if cfg.flags.Optimize or cfg.flags.OptimizeSize then \n options.GCC_OPTIMIZATION_LEVEL = \" s \" \n elseif cfg.flags.OptimizeSpeed then \n options.GCC_OPTIMIZATION_LEVEL = 3 \n else \n options.GCC_OPTIMIZATION_LEVEL = 0 \n end \n if cfg.pchheader and not cfg.f "
" lags.NoPCH then \n options.GCC_PRECOMPILE_PREFIX_HEADER = \" YES \" \n local pch = cfg.pchheader \n for _, incdir in ipairs(cfg.includedirs) do \n local abspath = path.getabsolute(path.join(cfg.project.location, incdir)) \n local testname = path.join(abspath, pch) \n if os.isfile(testname) then \n pch = path.getrelative(cfg.location, testname) \n break \n end \n end \n options.GCC_PREFIX_HEADER = pch \n end \n if cfg.flags.FatalWarnings then \n options.GCC_TREAT_WARNINGS_AS_ERRORS = \" YES \" \n end \n if cfg.kind == \" Bundle \" then \n options.MACH_O_TYPE = \" mh_bundle \" \n end \n if cfg.flags.StaticRuntime then \n options.STANDARD_C_PLUS_PLUS_LIBRARY_TYPE = \" static \" \n end \n if cfg.flags.PedanticWarnings or cfg.flags.ExtraWarnings then \n options.WARNING_CFLAGS = \" -Wall \" \n end \n if cfg.flags.Cpp11 then \n options.CLANG_CXX_LANGUAGE_STANDARD = \" c++11 \" \n elseif cfg.flags.Cpp14 or cfg.flags.CppLatest then \n options.CLANG_CXX_LANGUAGE_STANDARD = \" c++14 \" \n elseif cfg.flags.Cpp17 then \n if premake.action.current() == premake.action.get( \" xcode8 \" ) then \n error( \" X "
" Code8 does not support C++17. \" ) \n end \n end \n for _, val in ipairs(premake.xcode.parameters) do \n local eqpos = string.find(val, \" = \" ) \n if eqpos ~= nil then \n local key = string.trim(string.sub(val, 1, eqpos - 1)) \n local value = string.trim(string.sub(val, eqpos + 1)) \n options[key] = value \n end \n end \n return options \n end \n function xcode8.project(prj) \n local tr = xcode.buildprjtree(prj) \n xcode.Header(tr, 48) \n xcode.PBXBuildFile(tr) \n xcode.PBXContainerItemProxy(tr) \n xcode.PBXFileReference(tr,prj) \n xcode.PBXFrameworksBuildPhase(tr) \n xcode.PBXGroup(tr) \n xcode.PBXNativeTarget(tr) \n xcode.PBXProject(tr, \" 8.0 \" ) \n xcode.PBXReferenceProxy(tr) \n xcode.PBXResourcesBuildPhase(tr) \n xcode.PBXShellScriptBuildPhase(tr) \n xcode.PBXCopyFilesBuildPhase(tr) \n xcode.PBXSourcesBuildPhase(tr,prj) \n xcode.PBXVariantGroup(tr) \n xcode.PBXTargetDependency(tr) \n xcode.XCBuildConfiguration(tr, prj, { \n ontarget = xcode8.XCBuildConfiguration_Target, \n onproject = xcode8.XCBuildConfiguration_Project, \n }) \n xcode.XCBuildConfigurationList(tr) \n xcode.Foote "
" r(tr) \n end \n newaction \n { \n trigger = \" xcode8 \" , \n shortname = \" Xcode 8 \" , \n description = \" Generate Apple Xcode 8 project files \" , \n os = \" macosx \" , \n valid_kinds = { \" ConsoleApp \" , \" WindowedApp \" , \" StaticLib \" , \" SharedLib \" , \" Bundle \" }, \n valid_languages = { \" C \" , \" C++ \" }, \n valid_tools = { \n cc = { \" gcc \" }, \n }, \n valid_platforms = { \n Native = \" Native \" , \n x32 = \" Native 32-bit \" , \n x64 = \" Native 64-bit \" , \n Universal = \" Universal \" , \n }, \n default_platform = \" Native \" , \n onsolution = function(sln) \n premake.generate(sln, \" %%.xcworkspace/contents.xcworkspacedata \" , xcode.workspace_generate) \n premake.generate(sln, \" %%.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings \" , xcode.workspace_settings) \n premake.generate(sln, \" %%.xcworkspace/xcshareddata/xcschemes/-ALL-.xcscheme \" , xcode.workspace_scheme) \n end, \n onproject = function(prj) \n premake.generate(prj, \" %%.xcodeproj/project.pbxproj \" , xcode8.project) \n xcode.generate_schemes(prj, \" %%.xcodeproj/xcshareddata/ "
" xcschemes \" ) \n end, \n oncleanproject = function(prj) \n premake.clean.directory(prj, \" %%.xcodeproj \" ) \n premake.clean.directory(prj, \" %%.xcworkspace \" ) \n end, \n oncheckproject = xcode.checkproject, \n xcode = { \n iOSTargetPlatformVersion = nil, \n macOSTargetPlatformVersion = nil, \n tvOSTargetPlatformVersion = nil, \n }, \n } \n " ,
/* actions/xcode/xcode9.lua */
" local premake = premake \n premake.xcode9 = { } \n local xcode = premake.xcode \n local xcode8 = premake.xcode8 \n local xcode9 = premake.xcode9 \n function xcode9.XCBuildConfiguration_Project(tr, prj, cfg) \n local options = xcode8.XCBuildConfiguration_Project(tr, prj, cfg) \n if cfg.flags.Cpp17 or cfg.flags.CppLatest then \n options.CLANG_CXX_LANGUAGE_STANDARD = \" c++17 \" \n end \n return table.merge(options, { \n CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = \" YES \" , \n CLANG_WARN_COMMA = \" YES \" , \n CLANG_WARN_NON_LITERAL_NULL_CONVERSION = \" YES \" , \n CLANG_WARN_OBJC_LITERAL_CONVERSION = \" YES \" , \n CLANG_WARN_RANGE_LOOP_ANALYSIS = \" YES \" , \n CLANG_WARN_STRICT_PROTOTYPES = \" YES \" , \n }) \n end \n function xcode9.project(prj) \n local tr = xcode.buildprjtree(prj) \n xcode.Header(tr, 48) \n xcode.PBXBuildFile(tr) \n xcode.PBXContainerItemProxy(tr) \n xcode.PBXFileReference(tr,prj) \n xcode.PBXFrameworksBuildPhase(tr) \n xcode.PBXGroup(tr) \n xcode.PBXNativeTarget(tr) \n xcode.PBXProject(tr, \" 8.0 \" ) \n xcode.PBXReferenceProxy(tr) \n xcode.PBXResourcesBuildPhase(tr) \n xc "
" ode.PBXShellScriptBuildPhase(tr) \n xcode.PBXCopyFilesBuildPhase(tr) \n xcode.PBXSourcesBuildPhase(tr,prj) \n xcode.PBXVariantGroup(tr) \n xcode.PBXTargetDependency(tr) \n xcode.XCBuildConfiguration(tr, prj, { \n ontarget = xcode8.XCBuildConfiguration_Target, \n onproject = xcode9.XCBuildConfiguration_Project, \n }) \n xcode.XCBuildConfigurationList(tr) \n xcode.Footer(tr) \n end \n newaction \n { \n trigger = \" xcode9 \" , \n shortname = \" Xcode 9 \" , \n description = \" Generate Apple Xcode 9 project files \" , \n os = \" macosx \" , \n valid_kinds = { \" ConsoleApp \" , \" WindowedApp \" , \" StaticLib \" , \" SharedLib \" , \" Bundle \" }, \n valid_languages = { \" C \" , \" C++ \" }, \n valid_tools = { \n cc = { \" gcc \" }, \n }, \n valid_platforms = { \n Native = \" Native \" , \n x32 = \" Native 32-bit \" , \n x64 = \" Native 64-bit \" , \n Universal = \" Universal \" , \n }, \n default_platform = \" Native \" , \n onsolution = function(sln) \n premake.generate(sln, \" %%.xcworkspace/contents.xcworkspacedata \" , xcode.workspace_generate) \n premake.generate(sln, \" %%.x "
" cworkspace/xcshareddata/WorkspaceSettings.xcsettings \" , xcode.workspace_settings) \n premake.generate(sln, \" %%.xcworkspace/xcshareddata/xcschemes/-ALL-.xcscheme \" , xcode.workspace_scheme) \n end, \n onproject = function(prj) \n premake.generate(prj, \" %%.xcodeproj/project.pbxproj \" , xcode9.project) \n xcode.generate_schemes(prj, \" %%.xcodeproj/xcshareddata/xcschemes \" ) \n end, \n oncleanproject = function(prj) \n premake.clean.directory(prj, \" %%.xcodeproj \" ) \n premake.clean.directory(prj, \" %%.xcworkspace \" ) \n end, \n oncheckproject = xcode.checkproject, \n xcode = { \n iOSTargetPlatformVersion = nil, \n macOSTargetPlatformVersion = nil, \n tvOSTargetPlatformVersion = nil, \n }, \n } \n " ,
/* actions/xcode/xcode10.lua */
" local premake = premake \n premake.xcode10 = { } \n local xcode = premake.xcode \n local xcode8 = premake.xcode8 \n local xcode9 = premake.xcode9 \n local xcode10 = premake.xcode10 \n function xcode10.XCBuildConfiguration_Project(tr, prj, cfg) \n local options = xcode9.XCBuildConfiguration_Project(tr, prj, cfg) \n return table.merge(options, { \n CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = \" YES \" , \n CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = \" YES \" , \n CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = \" YES \" , \n CLANG_WARN_COMMA = \" YES \" , \n CLANG_WARN_NON_LITERAL_NULL_CONVERSION = \" YES \" , \n CLANG_WARN_OBJC_LITERAL_CONVERSION = \" YES \" , \n CLANG_WARN_RANGE_LOOP_ANALYSIS = \" YES \" , \n CLANG_WARN_STRICT_PROTOTYPES = \" YES \" , \n }) \n end \n function xcode10.XCBuildConfiguration_Target(tr, target, cfg) \n local options = xcode8.XCBuildConfiguration_Target(tr, target, cfg) \n if not cfg.flags.ObjcARC then \n options.CLANG_ENABLE_OBJC_WEAK = \" YES \" \n end \n return options \n end \n function xcode10.project(prj) \n local tr = xcode.buildprjtree(prj) \n xcode.Header(tr, 48) "
" \n xcode.PBXBuildFile(tr) \n xcode.PBXContainerItemProxy(tr) \n xcode.PBXFileReference(tr,prj) \n xcode.PBXFrameworksBuildPhase(tr) \n xcode.PBXGroup(tr) \n xcode.PBXNativeTarget(tr) \n xcode.PBXProject(tr, \" 8.0 \" ) \n xcode.PBXReferenceProxy(tr) \n xcode.PBXResourcesBuildPhase(tr) \n xcode.PBXShellScriptBuildPhase(tr) \n xcode.PBXCopyFilesBuildPhase(tr) \n xcode.PBXSourcesBuildPhase(tr,prj) \n xcode.PBXVariantGroup(tr) \n xcode.PBXTargetDependency(tr) \n xcode.XCBuildConfiguration(tr, prj, { \n ontarget = xcode10.XCBuildConfiguration_Target, \n onproject = xcode10.XCBuildConfiguration_Project, \n }) \n xcode.XCBuildConfigurationList(tr) \n xcode.Footer(tr) \n end \n newaction \n { \n trigger = \" xcode10 \" , \n shortname = \" Xcode 10 \" , \n description = \" Generate Apple Xcode 10 project files (experimental) \" , \n os = \" macosx \" , \n valid_kinds = { \" ConsoleApp \" , \" WindowedApp \" , \" StaticLib \" , \" SharedLib \" , \" Bundle \" }, \n valid_languages = { \" C \" , \" C++ \" }, \n valid_tools = { \n cc = { \" gcc \" }, \n }, \n valid_platforms = { "
" \n Native = \" Native \" , \n x32 = \" Native 32-bit \" , \n x64 = \" Native 64-bit \" , \n Universal = \" Universal \" , \n }, \n default_platform = \" Native \" , \n onsolution = function(sln) \n premake.generate(sln, \" %%.xcworkspace/contents.xcworkspacedata \" , xcode.workspace_generate) \n premake.generate(sln, \" %%.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings \" , xcode.workspace_settings) \n premake.generate(sln, \" %%.xcworkspace/xcshareddata/xcschemes/-ALL-.xcscheme \" , xcode.workspace_scheme) \n end, \n onproject = function(prj) \n premake.generate(prj, \" %%.xcodeproj/project.pbxproj \" , xcode10.project) \n xcode.generate_schemes(prj, \" %%.xcodeproj/xcshareddata/xcschemes \" ) \n end, \n oncleanproject = function(prj) \n premake.clean.directory(prj, \" %%.xcodeproj \" ) \n premake.clean.directory(prj, \" %%.xcworkspace \" ) \n end, \n oncheckproject = xcode.checkproject, \n xcode = { \n iOSTargetPlatformVersion = nil, \n macOSTargetPlatformVersion = nil, \n tvOSTargetPlatformVersion = nil, \n }, \n } \n " ,
/* actions/fastbuild/_fastbuild.lua */
" premake.fastbuild = { } \n local fastbuild = premake.fastbuild \n newaction \n { \n trigger = \" vs2015-fastbuild \" , \n shortname = \" FASTBuild VS2015 \" , \n description = \" Generate FASTBuild configuration files for Visual Studio 2015. \" , \n valid_kinds = { \n \" ConsoleApp \" , \n \" WindowedApp \" , \n \" StaticLib \" , \n \" SharedLib \" , \n \" Bundle \" , \n }, \n valid_languages = { \n \" C \" , \n \" C++ \" \n }, \n valid_tools = { \n cc = { \n \" msc \" \n }, \n }, \n onsolution = function(sln) \n premake.generate(sln, \" fbuild.bff \" , premake.fastbuild.solution) \n end, \n onproject = function(prj) \n premake.generate(prj, \" %%.bff \" , premake.fastbuild.project) \n end, \n oncleansolution = function(sln) \n premake.clean.file(sln, \" fbuild.bff \" ) \n end, \n oncleanproject = function(prj) \n premake.clean.file(prj, \" %%.bff \" ) \n end, \n } \n " ,
/* actions/fastbuild/fastbuild_project.lua */
" -- Generates a FASTBuild config file for a project. \n local function add_trailing_backslash(dir) \n if dir:len() > 0 and dir:sub(-1) ~= \" \\ \\ \" then \n return dir.. \" \\ \\ \" \n end \n return dir \n end \n local function compile(indentlevel, prj, cfg, commonbasepath) \n local firstflag = true \n for _, cfgexclude in ipairs(cfg.excludes) do \n if path.issourcefile(cfgexclude) then \n if firstflag then \n _p(indentlevel, '// Excluded files:') \n firstflag = false \n end \n _p(indentlevel, \" .CompilerInputFiles - '%s' \" , cfgexclude) \n end \n end \n if not firstflag then \n _p('') \n end \n _p(indentlevel, \" .CompilerOutputPath = '%s' \" , add_trailing_backslash(cfg.objectsdir)) \n _p(indentlevel, \" .Defines = '' \" ) \n for _, define in ipairs(cfg.defines) do \n _p(indentlevel+1, \" + ' /D%s' \" , define) \n end \n if cfg.kind == 'SharedLib' then \n _p(indentlevel+1, \" + ' /D_WINDLL' \" ) \n end \n _p(indentlevel, \" .IncludeDirs = '' \" ) \n local sortedincdirs = {} \n for _, includedir in ipairs(cfg.userincludedirs) do \n if includedir ~= nil then \n table.insert(sortedincdirs, included "
" ir) \n end \n end \n for _, includedir in ipairs(cfg.includedirs) do \n if includedir ~= nil then \n table.insert(sortedincdirs, includedir) \n end \n end \n local function getpathnodecount(p) \n local nodefinder = string.gmatch(p, \" [^ \\ \\ /]+ \" ) \n local result = 0 \n local node = nodefinder() \n while node do \n result = result + ((node ~= '.' and 1) or 0) \n node = nodefinder() \n end \n return result \n end \n local stepsfrombase = {} \n for _, includedir in ipairs(sortedincdirs) do \n stepsfrombase[includedir] = getpathnodecount(path.getrelative(commonbasepath, includedir)) \n end \n local function includesort(a, b) \n if stepsfrombase[a] == stepsfrombase[b] then \n return a < b \n else \n return stepsfrombase[a] < stepsfrombase[b] \n end \n end \n table.sort(sortedincdirs, includesort) \n for _, includedir in ipairs(sortedincdirs) do \n _p(indentlevel+1, \" + ' /I \\ \" %s \\ \" ' \" , includedir) \n end \n _p(indentlevel+1, \" + .MSVCIncludes \" ) \n local compileroptions = { \n ' \" %1 \" ', \n '/nologo', \n '/c', \n '/Gy', \n '/Gm-', \n '/Zc:inline', \n '/errorReport:prompt', \n '/FS', \n } \n if cfg.op "
" tions.ForceCPP then \n table.insert(compileroptions, '/TP') \n end \n if cfg.flags.PedanticWarnings \n or cfg.flags.ExtraWarnings \n then \n table.insert(compileroptions, '/W4') \n end \n if (cfg.flags.NativeWChar == false or \n cfg.flags.NoNativeWChar) then \n table.insert(compileroptions, '/Zc:wchar_t-') \n end \n if (cfg.flags.EnableMinimalRebuild or \n cfg.flags.NoMultiProcessorCompilation) then \n end \n if cfg.flags.FloatFast then \n table.insert(compileroptions, '/fp:fast') \n elseif cfg.flags.FloatStrict then \n table.insert(compileroptions, '/fp:strict') \n else \n table.insert(compileroptions, '/fp:precise') \n end \n if cfg.flags.FastCall then \n table.insert(compileroptions, '/Gr') \n elseif cfg.flags.StdCall then \n table.insert(compileroptions, '/Gd') \n end \n if cfg.flags.UnsignedChar then \n table.insert(compileroptions, '/J') \n end \n if premake.config.isdebugbuild(cfg) then \n if cfg.flags.StaticRuntime then \n table.insert(compileroptions, '/MTd') \n else \n table.insert(compileroptions, '/MDd') \n end \n else \n if cfg.flags.StaticRuntime then \n table.insert(com "
" pileroptions, '/MT') \n else \n table.insert(compileroptions, '/MD') \n end \n end \n if cfg.flags.Symbols then \n if (cfg.flags.C7DebugInfo) then \n table.insert(compileroptions, '/Z7') \n else \n if (premake.config.isoptimizedbuild(cfg.flags) \n or cfg.flags.NoEditAndContinue) then \n table.insert(compileroptions, '/Zi') \n else \n table.insert(compileroptions, '/ZI') \n end \n local targetdir = add_trailing_backslash(cfg.buildtarget.directory) \n table.insert(compileroptions, string.format( \" /Fd \\ \" %s%s.pdb \\ \" \" , targetdir, cfg.buildtarget.basename)) \n end \n end \n local isoptimised = true \n if (cfg.flags.Optimize) then \n table.insert(compileroptions, '/Ox') \n elseif (cfg.flags.OptimizeSize) then \n table.insert(compileroptions, '/O1') \n elseif (cfg.flags.OptimizeSpeed) then \n table.insert(compileroptions, '/O2') \n else \n isoptimised = false \n end \n if isoptimised then \n table.insert(compileroptions, '/GF') \n else \n table.insert(compileroptions, '/Od') \n table.insert(compileroptions, '/RTC1') \n end \n if cfg.flags.FatalWarnings then \n table.insert(compileropti "
" ons, '/WX') \n else \n table.insert(compileroptions, '/WX-') \n end \n if cfg.platform == 'x32' then \n if cfg.flags.EnableSSE2 then \n table.insert(compileroptions, '/arch:SSE2') \n elseif cfg.flags.EnableSSE then \n table.insert(compileroptions, '/arch:SSE') \n end \n end \n if cfg.flags.NoExceptions then \n else \n if cfg.flags.SEH then \n table.insert(compileroptions, '/EHa') \n else \n table.insert(compileroptions, '/EHsc') \n end \n end \n if cfg.flags.NoRTTI then \n table.insert(compileroptions, '/GR-') \n else \n table.insert(compileroptions, '/GR') \n end \n if cfg.flags.NoFramePointer then \n table.insert(compileroptions, '/Oy-') \n else \n table.insert(compileroptions, '/Oy') \n end \n for _, addloption in ipairs(cfg.buildoptions) do \n table.insert(compileroptions, addloption) \n end \n _p(indentlevel, \" .CompilerOptions = '' \" ) \n for _, option in ipairs(compileroptions) do \n _p(indentlevel+1, \" + ' %s' \" , option) \n end \n _p(indentlevel+1, \" + .IncludeDirs \" ) \n _p(indentlevel+1, \" + .Defines \" ) \n if not cfg.flags.NoPCH and cfg.pchheader then \n _p(indentlevel, \" .Compi "
" lerInputFiles - '%s' \" , cfg.pchsource) \n _p(indentlevel, \" .PCHInputFile = '%s' \" , cfg.pchsource) \n _p(indentlevel, \" .PCHOutputFile = .CompilerOutputPath + '%s.pch' \" , prj.name) \n _p(indentlevel, \" .CompilerOptions + ' /Fp \\ \" ' + .CompilerOutputPath + '%s.pch \\ \" ' \" , prj.name) \n _p(indentlevel, \" .PCHOptions = .CompilerOptions \" ) \n _p(indentlevel+1, \" + ' /Yc \\ \" %s \\ \" ' \" , cfg.pchheader) \n _p(indentlevel+1, \" + ' /Fo \\ \" %%3 \\ \" ' \" ) \n _p(indentlevel, \" .CompilerOptions + ' /Yu \\ \" %s \\ \" ' \" , cfg.pchheader) \n end \n _p(indentlevel+1, \" + ' /Fo \\ \" %%2 \\ \" ' \" ) -- make sure the previous property is .CompilerOptions \n end \n local function library(prj, cfg, useconfig, commonbasepath) \n _p(1, \" Library('%s-%s-%s') \" , prj.name, cfg.name, cfg.platform) \n _p(1, '{') \n useconfig(2) \n compile(2, prj, cfg, commonbasepath) \n local librarianoptions = { \n ' \" %1 \" ', \n '/OUT: \" %2 \" ', \n '/NOLOGO', \n } \n if cfg.platform == 'x64' then \n table.insert(librarianoptions, '/MACHINE:X64') \n else \n table.insert(librarianoptions, '/MACHINE:X86') \n end \n _p(2, \" .Lib "
" rarianOptions = '' \" ) \n for _, option in ipairs(librarianoptions) do \n _p(3, \" + ' %s' \" , option) \n end \n _p(2, \" .LibrarianOutput = '%s' \" , cfg.buildtarget.fullpath) \n _p(1, '}') \n _p('') \n end \n local function binary(prj, cfg, useconfig, bintype, commonbasepath) \n _p(1, \" ObjectList('%s_obj-%s-%s') \" , prj.name, cfg.name, cfg.platform) \n _p(1, '{') \n useconfig(2) \n compile(2, prj, cfg, commonbasepath) \n _p(1, '}') \n _p('') \n _p(1, \" %s('%s-%s-%s') \" , bintype, prj.name, cfg.name, cfg.platform) \n _p(1, '{') \n useconfig(2) \n _p(2, '.Libraries = {') \n _p(3, \" '%s_obj-%s-%s', \" , prj.name, cfg.name, cfg.platform) -- Refer to the ObjectList \n local sorteddeplibs = {} \n for _, deplib in ipairs(premake.getlinks(cfg, \" dependencies \" , \" basename \" )) do \n table.insert(sorteddeplibs, string.format( \" '%s-%s-%s', \" , deplib, cfg.name, cfg.platform)) \n end \n table.sort(sorteddeplibs) \n for _, deplib in ipairs(sorteddeplibs) do \n _p(3, deplib) \n end \n _p(3, '}') \n _p(2, '.LinkerLinkObjects = false') \n local linkeroptions = { \n ' \" %1 \" ', \n '/OUT: \" %2 \" ', \n '/ "
" NOLOGO', \n '/errorReport:prompt', \n } \n local subsystemversion = ' \" ,5.02 \" ' \n if cfg.platform == 'x32' then \n subsystemversion = ' \" ,5.01 \" ' \n end \n if cfg.kind == 'ConsoleApp' then \n table.insert(linkeroptions, '/SUBSYSTEM:CONSOLE'..subsystemversion) \n else \n table.insert(linkeroptions, '/SUBSYSTEM:WINDOWS'..subsystemversion) \n end \n if cfg.kind == 'SharedLib' then \n table.insert(linkeroptions, '/DLL') \n end \n if cfg.platform == 'x64' then \n table.insert(linkeroptions, '/MACHINE:X64') \n else \n table.insert(linkeroptions, '/MACHINE:X86') \n end \n for _, libdir in ipairs(cfg.libdirs) do \n table.insert(linkeroptions, string.format('/LIBPATH:%s', path.translate(libdir, ' \\ \\ '))) \n end \n if not cfg.flags.WinMain and (cfg.kind == 'ConsoleApp' or cfg.kind == 'WindowedApp') then \n if cfg.flags.Unicode then \n table.insert(linkeroptions, '/ENTRY:wmainCRTStartup') \n else \n table.insert(linkeroptions, '/ENTRY:mainCRTStartup') \n end \n end \n local deffile = premake.findfile(cfg, \" .def \" ) \n if deffile then \n table.insert(linkeroptions, '/DEF:%s', deffile "
" ) \n end \n if (cfg.flags.Symbols ~= nil) then \n table.insert(linkeroptions, '/DEBUG') \n end \n if premake.config.isoptimizedbuild(cfg.flags) then \n table.insert(linkeroptions, '/OPT:REF') \n table.insert(linkeroptions, '/OPT:ICF') \n end \n table.insert(linkeroptions, '/INCREMENTAL'..((premake.config.isincrementallink(cfg) and '') or ':NO')) \n for _, addloption in ipairs(cfg.linkoptions) do \n table.insert(linkeroptions, addloption) \n end \n local linklibs = premake.getlinks(cfg, \" all \" , \" fullpath \" ) \n for _, linklib in ipairs(linklibs) do \n table.insert(linkeroptions, path.getname(linklib)) \n end \n table.sort(linkeroptions) \n _p(2, \" .LinkerOptions = '' \" ) \n for _, option in ipairs(linkeroptions) do \n _p(3, \" + ' %s' \" , option) \n end \n _p(3, \" + .MSVCLibPaths \" ) \n _p(2, \" .LinkerOutput = '%s' \" , cfg.buildtarget.fullpath) \n _p(1, '}') \n _p('') \n end \n local function executable(prj, cfg, useconfig, commonbasepath) \n binary(prj, cfg, useconfig, 'Executable', commonbasepath) \n end \n local function dll(prj, cfg, useconfig, commonbasepath) \n binary(p "
" rj, cfg, useconfig, 'DLL', commonbasepath) \n end \n local function alias(prj, cfg, target) \n _p(1, \" Alias('%s-%s-%s') \" , prj.name, cfg.name, cfg.platform) \n _p(1, '{') \n _p(2, \" .Targets = '%s' \" , target) \n _p(1, '}') \n _p('') \n end \n function premake.fastbuild.project(prj) \n io.indent = ' ' \n _p('// FASTBuild project configuration file autogenerated by GENie.') \n _p('') \n _p('{') \n local cppfiles = {} \n for file in premake.project.eachfile(prj) do \n if path.issourcefile(file.name) then \n table.insert(cppfiles, file.name) \n end \n end \n local commonbasepath = cppfiles[1] \n for _, file in ipairs(cppfiles) do \n commonbasepath = path.getcommonbasedir(commonbasepath..'/', file) \n end \n _p(1, \" .CompilerInputFilesRoot = '%s/' \" , commonbasepath) \n _p(1, '.CompilerInputFiles = {') \n for _, file in ipairs(cppfiles) do \n _p(2, \" '%s', \" , file) \n end \n _p(1, '}') \n _p('') \n local targetkindmap = { \n ConsoleApp = executable, \n WindowedApp = executable, \n SharedLib = dll, \n StaticLib = library, \n } \n local useconfigmap = { \n x32 = function(indentlevel) \n _p( "
" indentlevel, 'Using(.MSVCx86Config)') \n _p('') \n end, \n x64 = function(indentlevel) \n _p(indentlevel, 'Using(.MSVCx64Config)') \n _p('') \n end, \n } \n local nativeplatform = (os.is64bit() and 'x64') or 'x32' \n for _, platform in ipairs(prj.solution.platforms) do \n for cfg in premake.eachconfig(prj, platform) do \n if cfg.platform == 'Native' then \n alias(prj, cfg, string.format('%s-%s-%s', prj.name, cfg.name, nativeplatform)) \n else \n targetkindmap[prj.kind](prj, cfg, useconfigmap[cfg.platform], commonbasepath) \n end \n end \n end \n _p('}') \n end \n " ,
" -- Generates a FASTBuild config file for a project. \n local function add_trailing_backslash(dir) \n if dir:len() > 0 and dir:sub(-1) ~= \" \\ \\ \" then \n return dir.. \" \\ \\ \" \n end \n return dir \n end \n local function compile(indentlevel, prj, cfg, commonbasepath) \n local firstflag = true \n for _, cfgexclude in ipairs(cfg.excludes) do \n if path.issourcefile(cfgexclude) then \n if firstflag then \n _p(indentlevel, '// Excluded files:') \n firstflag = false \n end \n _p(indentlevel, \" .CompilerInputFiles - '%s' \" , cfgexclude) \n end \n end \n if not firstflag then \n _p('') \n end \n _p(indentlevel, \" .CompilerOutputPath = '%s' \" , add_trailing_backslash(cfg.objectsdir)) \n _p(indentlevel, \" .Defines = '' \" ) \n for _, define in ipairs(cfg.defines) do \n _p(indentlevel+1, \" + ' /D%s' \" , define) \n end \n if cfg.kind == 'SharedLib' then \n _p(indentlevel+1, \" + ' /D_WINDLL' \" ) \n end \n _p(indentlevel, \" .IncludeDirs = '' \" ) \n local sortedincdirs = table.join(cfg.userincludedirs, cfg.includedirs, cfg.systemincludedirs)\n local function getpathnodecount(p) \n local nodef "
" i nder = string.gmatch(p, \" [^ \\ \\ /]+ \" ) \n local result = 0 \n local node = nodefinder() \n while node do \n result = result + ((node ~= '.' and 1) or 0) \n node = nodefinder() \n end \n return result \n end \n local stepsfrombase = {} \n for _, includedir in ipairs(sortedincdirs) do \n stepsfrombase[includedir] = getpathnodecount(path.getrelative(commonbasepath, includedir)) \n end \n local function includesort(a, b) \n if stepsfrombase[a] == stepsfrombase[b] then \n return a < b \n else \n return stepsfrombase[a] < stepsfrombase[b] \n end \n end \n table.sort(sortedincdirs, includesort) \n for _, includedir in ipairs(sortedincdirs) do \n _p(indentlevel+1, \" + ' /I \\ \" %s \\ \" ' \" , includedir) \n end \n _p(indentlevel+1, \" + .MSVCIncludes \" ) \n local compileroptions = { \n ' \" %1 \" ', \n '/nologo', \n '/c', \n '/G m-',\n '/Zc:inline', \n '/errorReport:prompt', \n '/FS', \n } \n if cfg.op tions.ForceCPP then\n table.insert(compileroptions, '/TP') \n end \n if cfg.flags.PedanticWarnings \n or cfg.flags.ExtraWarnings \n then \n table.insert(compileroptions, '/W4') \n end \n if (cfg.flags.NativeWChar "
" == false or\n cfg.flags.NoNativeWChar) then \n table.insert(compileroptions, '/Zc:wchar_t-') \n end \n if (cfg.flags.EnableMinimalRebuild or \n cfg.flags.NoMultiProcessorCompilation) then \n end \n if cfg.flags.FloatFast then \n table.insert(compileroptions, '/fp:fast') \n elseif cfg.flags.FloatStrict then \n table.insert(compileroptions, '/fp:strict') \n else \n table.insert(compileroptions, '/fp:precise') \n end \n if cfg.flags.FastCall then \n table.insert(compileroptions, '/Gr') \n elseif cfg.flags.StdCall then \n table.insert(compileroptions, '/Gd') \n end \n if cfg.flags.UnsignedChar then \n table.insert(compileroptions, '/J') \n end \n if premake.config.isdebugbuild(cfg) then \n if cfg.flags.StaticRuntime then \n table.insert(compileroptions, '/MTd') \n else \n table.insert(compileroptions, '/MDd') \n end \n else \n if cfg.flags.StaticRuntime then \n table.insert(com pileroptions, '/MT')\n else \n table.insert(compileroptions, '/MD') \n end \n end \n if cfg.flags.Symbols then \n if (cfg.flags.C7DebugInfo) then \n table.insert(compileroptions, '/Z7') \n else \n if premake.config "
" .iseditandcontinue(cfg) then\n table.insert(compileroptions, '/ZI') \n else \n table.insert(compileroptions, '/Zi ')\n end \n local targetdir = add_trailing_backslash(cfg.buildtarget.directory) \n table.insert(compileroptions, string.format( \" /Fd \\ \" %s%s.pdb \\ \" \" , targetdir, cfg.buildtarget.basename)) \n end \n end \n local isoptimised = true \n if (cfg.flags.Optimize) then \n table.insert(compileroptions, '/Ox') \n elseif (cfg.flags.OptimizeSize) then \n table.insert(compileroptions, '/O1') \n elseif (cfg.flags.OptimizeSpeed) then \n table.insert(compileroptions, '/O2') \n else \n isoptimised = false \n end \n if isoptimised then \n if cfg.flags.NoOptimizeLink and cfg.flags.NoEditAndContinue then\n table.insert(compileroptions, '/GF-')\n table.insert(compileroptions, '/Gy- ')\n else \n table.insert(compileroptions, '/ GF')\n table.insert(compileroptions, '/Gy') \n end \n else \n table.insert(compileroptions, '/Gy') \n table.insert(compileroptions, '/ Od')\n table.insert(compileroptions, '/RTC1') \n end \n if cfg.flags.FatalWarnings then \n table.insert(compileropti ons, "
" '/WX')\n else \n table.insert(compileroptions, '/WX-') \n end \n if cfg.platform == 'x32' then \n if cfg.flags.EnableSSE2 then \n table.insert(compileroptions, '/arch:SSE2') \n elseif cfg.flags.EnableSSE then \n table.insert(compileroptions, '/arch:SSE') \n end \n end \n if cfg.flags.NoExceptions then \n else \n if cfg.flags.SEH then \n table.insert(compileroptions, '/EHa') \n else \n table.insert(compileroptions, '/EHsc') \n end \n end \n if cfg.flags.NoRTTI then \n table.insert(compileroptions, '/GR-') \n else \n table.insert(compileroptions, '/GR') \n end \n if cfg.flags.NoFramePointer then \n table.insert(compileroptions, '/Oy-') \n else \n table.insert(compileroptions, '/Oy') \n end \n for _, addloption in ipairs(cfg.buildoptions) do \n table.insert(compileroptions, addloption) \n end \n _p(indentlevel, \" .CompilerOptions = '' \" ) \n for _, option in ipairs(compileroptions) do \n _p(indentlevel+1, \" + ' %s' \" , option) \n end \n _p(indentlevel+1, \" + .IncludeDirs \" ) \n _p(indentlevel+1, \" + .Defines \" ) \n if not cfg.flags.NoPCH and cfg.pchheader then \n _p(indentlevel, \" .Compi lerIn "
" putFiles - '%s'\" , cfg.pchsource) \n _p(indentlevel, \" .PCHInputFile = '%s' \" , cfg.pchsource) \n _p(indentlevel, \" .PCHOutputFile = .CompilerOutputPath + '%s.pch' \" , prj.name) \n _p(indentlevel, \" .CompilerOptions + ' /Fp \\ \" ' + .CompilerOutputPath + '%s.pch \\ \" ' \" , prj.name) \n _p(indentlevel, \" .PCHOptions = .CompilerOptions \" ) \n _p(indentlevel+1, \" + ' /Yc \\ \" %s \\ \" ' \" , cfg.pchheader) \n _p(indentlevel+1, \" + ' /Fo \\ \" %%3 \\ \" ' \" ) \n _p(indentlevel, \" .CompilerOptions + ' /Yu \\ \" %s \\ \" ' \" , cfg.pchheader) \n end \n _p(indentlevel+1, \" + ' /Fo \\ \" %%2 \\ \" ' \" ) -- make sure the previous property is .CompilerOptions \n end \n local function library(prj, cfg, useconfig, commonbasepath) \n _p(1, \" Library('%s-%s-%s') \" , prj.name, cfg.name, cfg.platform) \n _p(1, '{') \n useconfig(2) \n compile(2, prj, cfg, commonbasepath) \n local librarianoptions = { \n ' \" %1 \" ', \n '/OUT: \" %2 \" ', \n '/NOLOGO', \n } \n if cfg.platform == 'x64' then \n table.insert(librarianoptions, '/MACHINE:X64') \n else \n table.insert(librarianoptions, '/MACHINE:X86') \n end \n _p(2, \" .Lib raria "
" nOptions = ''\" ) \n for _, option in ipairs(librarianoptions) do \n _p(3, \" + ' %s' \" , option) \n end \n _p(2, \" .LibrarianOutput = '%s' \" , cfg.buildtarget.fullpath) \n _p(1, '}') \n _p('') \n end \n local function binary(prj, cfg, useconfig, bintype, commonbasepath) \n _p(1, \" ObjectList('%s_obj-%s-%s') \" , prj.name, cfg.name, cfg.platform) \n _p(1, '{') \n useconfig(2) \n compile(2, prj, cfg, commonbasepath) \n _p(1, '}') \n _p('') \n _p(1, \" %s('%s-%s-%s') \" , bintype, prj.name, cfg.name, cfg.platform) \n _p(1, '{') \n useconfig(2) \n _p(2, '.Libraries = {') \n _p(3, \" '%s_obj-%s-%s', \" , prj.name, cfg.name, cfg.platform) -- Refer to the ObjectList \n local sorteddeplibs = {} \n for _, deplib in ipairs(premake.getlinks(cfg, \" dependencies \" , \" basename \" )) do \n table.insert(sorteddeplibs, string.format( \" '%s-%s-%s', \" , deplib, cfg.name, cfg.platform)) \n end \n table.sort(sorteddeplibs) \n for _, deplib in ipairs(sorteddeplibs) do \n _p(3, deplib) \n end \n _p(3, '}') \n _p(2, '.LinkerLinkObjects = false') \n local linkeroptions = { \n ' \" %1 \" ', \n '/OUT: \" %2 \" ', \n '/ NOLOG "
" O',\n '/errorReport:prompt', \n } \n local subsystemversion = ' \" ,5.02 \" ' \n if cfg.platform == 'x32' then \n subsystemversion = ' \" ,5.01 \" ' \n end \n if cfg.kind == 'ConsoleApp' then \n table.insert(linkeroptions, '/SUBSYSTEM:CONSOLE'..subsystemversion) \n else \n table.insert(linkeroptions, '/SUBSYSTEM:WINDOWS'..subsystemversion) \n end \n if cfg.kind == 'SharedLib' then \n table.insert(linkeroptions, '/DLL') \n end \n if cfg.platform == 'x64' then \n table.insert(linkeroptions, '/MACHINE:X64') \n else \n table.insert(linkeroptions, '/MACHINE:X86') \n end \n for _, libdir in ipairs(cfg.libdirs) do \n table.insert(linkeroptions, string.format('/LIBPATH:%s', path.translate(libdir, ' \\ \\ '))) \n end \n if not cfg.flags.WinMain and (cfg.kind == 'ConsoleApp' or cfg.kind == 'WindowedApp') then \n if cfg.flags.Unicode then \n table.insert(linkeroptions, '/ENTRY:wmainCRTStartup') \n else \n table.insert(linkeroptions, '/ENTRY:mainCRTStartup') \n end \n end \n local deffile = premake.findfile(cfg, \" .def \" ) \n if deffile then \n table.insert(linkeroptions, '/DEF:%s', deffile )\n en "
" d\n if (cfg.flags.Symbols ~= nil) then \n table.insert(linkeroptions, '/DEBUG') \n end \n if premake.config.is linker optimizedbuild(cfg.flags) then\n table.insert(linkeroptions, '/OPT:REF') \n table.insert(linkeroptions, '/OPT:ICF') \n end \n table.insert(linkeroptions, '/INCREMENTAL'..((premake.config.isincrementallink(cfg) and '') or ':NO')) \n for _, addloption in ipairs(cfg.linkoptions) do \n table.insert(linkeroptions, addloption) \n end \n local linklibs = premake.getlinks(cfg, \" all \" , \" fullpath \" ) \n for _, linklib in ipairs(linklibs) do \n table.insert(linkeroptions, path.getname(linklib)) \n end \n table.sort(linkeroptions) \n _p(2, \" .LinkerOptions = '' \" ) \n for _, option in ipairs(linkeroptions) do \n _p(3, \" + ' %s' \" , option) \n end \n _p(3, \" + .MSVCLibPaths \" ) \n _p(2, \" .LinkerOutput = '%s' \" , cfg.buildtarget.fullpath) \n _p(1, '}') \n _p('') \n end \n local function executable(prj, cfg, useconfig, commonbasepath) \n binary(prj, cfg, useconfig, 'Executable', commonbasepath) \n end \n local function dll(prj, cfg, useconfig, commonbasepath) \n binary( "
" p rj, cfg, useconfig, 'DLL', commonbasepath)\n end \n local function alias(prj, cfg, target) \n _p(1, \" Alias('%s-%s-%s') \" , prj.name, cfg.name, cfg.platform) \n _p(1, '{') \n _p(2, \" .Targets = '%s' \" , target) \n _p(1, '}') \n _p('') \n end \n function premake.fastbuild.project(prj) \n io.indent = ' ' \n _p('// FASTBuild project configuration file autogenerated by GENie.') \n _p('') \n _p('{') \n local cppfiles = {} \n for file in premake.project.eachfile(prj) do \n if path.issourcefile(file.name) then \n table.insert(cppfiles, file.name) \n end \n end \n local commonbasepath = cppfiles[1] \n for _, file in ipairs(cppfiles) do \n commonbasepath = path.getcommonbasedir(commonbasepath..'/', file) \n end \n _p(1, \" .CompilerInputFilesRoot = '%s/' \" , commonbasepath) \n _p(1, '.CompilerInputFiles = {') \n for _, file in ipairs(cppfiles) do \n _p(2, \" '%s', \" , file) \n end \n _p(1, '}') \n _p('') \n local targetkindmap = { \n ConsoleApp = executable, \n WindowedApp = executable, \n SharedLib = dll, \n StaticLib = library, \n } \n local useconfigmap = { \n x32 = function(indentlevel) \n _p "
" ( indentlevel, 'Using(.MSVCx86Config)')\n _p('') \n end, \n x64 = function(indentlevel) \n _p(indentlevel, 'Using(.MSVCx64Config)') \n _p('') \n end, \n } \n local nativeplatform = (os.is64bit() and 'x64') or 'x32' \n for _, platform in ipairs(prj.solution.platforms) do \n for cfg in premake.eachconfig(prj, platform) do \n if cfg.platform == 'Native' then \n alias(prj, cfg, string.format('%s-%s-%s', prj.name, cfg.name, nativeplatform)) \n else \n targetkindmap[prj.kind](prj, cfg, useconfigmap[cfg.platform], commonbasepath) \n end \n end \n end \n _p('}') \n end \n " ,
/* actions/fastbuild/fastbuild_solution.lua */
" -- Generates a FASTBuild config file for a solution. \n function premake.fastbuild.solution(sln) \n io.indent = ' ' \n _p('// FastBuild solution configuration file. Generated by GENie.') \n _p('//------------------------------------------------------------------------------------') \n _p('// %s', sln.name) \n _p('//------------------------------------------------------------------------------------') \n _p('#import VS140COMNTOOLS') \n local is64bit = os.is64bit() \n local target64 = (is64bit and ' amd64') or ' x86_amd64' \n local target32 = (is64bit and ' amd64_x86') or '' \n local getvcvarscontent = [[ \n @set INCLUDE= \n @set LIB= \n @set CommandPromptType= \n @set PreferredToolArchitecture= \n @set Platform= \n @set Path=%SystemRoot% \\ System32;%SystemRoot%;%SystemRoot% \\ System32 \\ wbem \n @call \" %VS140COMNTOOLS%.. \\ .. \\ VC \\ vcvarsall.bat \" %1 \n @echo %INCLUDE% \n @echo %LIB% \n @echo %CommandPromptType% \n @echo %PreferredToolArchitecture% \n @echo %Platform% \n @echo %Path% \n ]] \n local getvcvarsfilepath = os.getenv('TEMP')..' \\ \\ getvcvars.bat' \n local "
@ -424,8 +476,8 @@ const char* builtin_scripts[] = {
/* actions/ninja/ninja_base.lua */
" local ninja = premake.ninja \n function ninja.esc(value) \n value = value:gsub( \" %$ \" , \" $$ \" ) -- TODO maybe there is better way \n value = value:gsub( \" : \" , \" $: \" ) \n value = value:gsub( \" \\ n \" , \" $ \\ n \" ) \n value = value:gsub( \" \" , \" $ \" ) \n return value \n end \n function ninja.shesc(value) \n if type(value) == \" table \" then \n local result = {} \n local n = #value \n for i = 1, n do \n table.insert(result, ninja.shesc(value[i])) \n end \n return result \n end \n if value:find( \" \" ) then \n return \" \\ \" \" .. value .. \" \\ \" \" \n end \n return value \n end \n function ninja.list(value) \n if #value > 0 then \n return \" \" .. table.concat(value, \" \" ) \n else \n return \" \" \n end \n end \n function ninja.arglist(arg, value) \n if #value > 0 then \n local args = {} \n for _, val in ipairs(value) do \n table.insert(args, string.format( \" %s %s \" , arg, val)) \n end \n return table.concat(args, \" \" ) \n else \n return \" \" \n end \n end \n function ninja.generate_project(prj) \n if prj.language == \" Swift \" then \n ninja.generate_swift(prj) \n else \n ninja.generate_cpp(prj) \n end \n end \n loca "
" l function innerget(self, key) \n return rawget(getmetatable(self), key) or self.__inner[key] \n end \n local prj_proxy = { __index = innerget } \n local cfg_proxy = { __index = innerget } \n function new_prj_proxy(prj) \n prj = prj.project or prj \n local v = { __inner = prj } \n local __configs = {} \n for key, cfg in pairs(prj.__configs) do \n if key ~= \" \" then \n __configs[key] = ninja.get_proxy( \" cfg \" , cfg) \n else \n __configs[key] = cfg \n end \n end \n v.__configs = __configs \n return setmetatable(v, prj_proxy) \n end \n local function rebasekeys(t, keys, old, new) \n for _,key in ipairs(keys) do \n t[key] = path.rebase(t[key], old, new) \n end \n return t \n end \n local function rebasearray(t, old, new) \n local res = { } \n for _,f in ipairs(t) do \n table.insert(res, path.rebase(f, old, new)) \n end \n return res \n end \n function new_cfg_proxy(cfg) \n local keys = { \" directory \" , \" fullpath \" , \" bundlepath \" } \n local old = cfg.location \n local new = path.join(cfg.location, cfg.shortname) \n local v = { \n __inner = cfg, \n location = new, \n objectsdir = pa "
" th.rebase(cfg.objectsdir, old, new), \n buildtarget = rebasekeys(table.deepcopy(cfg.buildtarget), keys, old, new), \n linktarget = rebasekeys(table.deepcopy(cfg. build target), keys, old, new),\n } \n v.files = rebasearray(cfg.files, old, new)\n v.includedirs = rebasearray(cfg.includedirs, old, new)\n v. userincludedirs = rebasearray(cfg.userincludedirs, old, new)\n v.s wiftmodulemaps = rebasearray(cfg.swiftmodulemaps, old, new)\n return setmetatable(v, cfg_proxy) \n end \n function cfg_proxy:getprojectfilename(fullpath) \n local name = self.project.name .. \" .ninja \" \n if fullpath ~= nil then \n return path.join(self.location, name) \n end \n return name \n end \n function cfg_proxy:getoutputfilename() \n return path.join(self.buildtarget.directory, self.buildtarget.name) \n end \n local proxy_cache = { \n prj = { new = new_prj_proxy }, \n cfg = { new = new_cfg_proxy }, \n } \n function get_proxy(cache, obj) \n i f not cache[obj] then\n cache[obj] = cache.new(obj) \n end \n return cache[obj] \n end \n function ninja.get_proxy(typ, obj) \n if not proxy "
" _cache[typ] then\n error( \" invalid proxy type \" ) \n end \n return get_proxy(proxy_cache[typ], obj) \n end \n " ,
" th.rebase(cfg.objectsdir, old, new), \n buildtarget = rebasekeys(table.deepcopy(cfg.buildtarget), keys, old, new), \n linktarget = rebasekeys(table.deepcopy(cfg. link target), keys, old, new),\n } \n v.files = rebasearray(cfg.files, old, new)\n v.includedirs = rebasearray(cfg.includedirs, old, new)\n v. libdirs = rebasearray(cfg.libdirs, old, new)\n v. userincludedirs = rebasearray(cfg.userincludedirs, old, new)\n v.s ystemincludedirs = rebasearray(cfg.systemincludedirs, old, new)\n v.s wiftmodulemaps = rebasearray(cfg.swiftmodulemaps, old, new)\n return setmetatable(v, cfg_proxy) \n end \n function cfg_proxy:getprojectfilename(fullpath) \n local name = self.project.name .. \" .ninja \" \n if fullpath ~= nil then \n return path.join(self.location, name) \n end \n return name \n end \n function cfg_proxy:getoutputfilename() \n return path.join(self.buildtarget.directory, self.buildtarget.name) \n end \n local proxy_cache = { \n prj = { new = new_prj_proxy }, \n cfg = { new = new_cfg_proxy }, \n } \n function get_proxy(cache, obj) \n i "
" f not cache[obj] then\n cache[obj] = cache.new(obj) \n end \n return cache[obj] \n end \n function ninja.get_proxy(typ, obj) \n if not proxy _cache[typ] then\n error( \" invalid proxy type \" ) \n end \n return get_proxy(proxy_cache[typ], obj) \n end \n " ,
/* actions/ninja/ninja_solution.lua */
" local ninja = premake.ninja \n local p = premake \n local solution = p.solution \n function ninja.generate_solution(sln) \n local cc = premake[_OPTIONS.cc] \n local platforms = premake.filterplatforms(sln, cc.platforms, \" Native \" ) \n _p('# %s solution makefile autogenerated by GENie', premake.action.current().shortname) \n _p('# Type \" make help \" for usage help') \n _p('') \n _p('NINJA=ninja') \n _p('ifndef config') \n _p(' config=%s', _MAKE.esc(premake.getconfigname(sln.configurations[1], platforms[1], true))) \n _p('endif') \n _p('') \n local projects = table.extract(sln.projects, \" name \" ) \n table.sort(projects) \n _p('') \n _p('.PHONY: all clean help $(PROJECTS)') \n _p('') \n _p('all:') \n if (not sln.messageskip) or (not table.contains(sln.messageskip, \" SkipBuildingMessage \" )) then \n _p(1, '@echo \" ==== Building all ($(config)) ==== \" ') \n end \n _p(1, '@${NINJA} -C ${config} all') \n _p('') \n for _, prj in ipairs(sln.projects) do \n local prjx = ninja.get_proxy( \" prj \" , prj) \n _p('%s:', _MAKE.esc(prj.name)) \n if (not sln.messageskip) or (not table.c "
@ -434,14 +486,18 @@ const char* builtin_scripts[] = {
" \" \" end \n cfgs[key] = cfg:getoutputfilename() .. \" \" \n if not cfgs[ \" all \" ] then cfgs[ \" all \" ] = \" \" end \n cfgs[ \" all \" ] = cfgs[ \" all \" ] .. cfg:getoutputfilename() .. \" \" \n if (cfg_first == nil) and (cfg.kind == \" ConsoleApp \" or cfg.kind == \" WindowedApp \" ) then \n cfg_first = key \n end \n if (cfg_first_lib == nil) and (cfg.kind == \" StaticLib \" or cfg.kind == \" SharedLib \" ) then \n cfg_first_lib = key \n end \n _p( \" subninja \" .. cfg:getprojectfilename()) \n end \n _p( \" \" ) \n _p( \" # targets \" ) \n for cfg, outputs in iter.sortByKeys(cfgs) do \n _p( \" build \" .. cfg .. \" : phony \" .. outputs) \n end \n _p( \" \" ) \n _p( \" # default target \" ) \n _p( \" default \" .. (cfg_first or cfg_first_lib)) \n _p( \" \" ) \n end \n " ,
/* actions/ninja/ninja_cpp.lua */
" premake.ninja.cpp = { } \n local ninja = premake.ninja \n local cpp = premake.ninja.cpp \n local p = premake \n function ninja.generate_cpp(prj) \n local pxy = ninja.get_proxy( \" prj \" , prj) \n local tool = premake.gettool(prj) \n local platforms = premake.filterplatforms(prj.solution, tool.platforms, \" Native \" ) \n for _, platform in ipairs(platforms) do \n for cfg in p.eachconfig(pxy, platform) do \n p.generate(cfg, cfg:getprojectfilename(), function() cpp.generate_config(prj, cfg) end) \n end \n end \n end \n function cpp.generate_config(prj, cfg) \n local tool = premake.gettool(prj) \n _p('# Ninja build project file autogenerated by GENie') \n _p('# https://github.com/bkaradzic/GENie') \n _p( \" \" ) \n _p( \" ninja_required_version = 1.7 \" ) \n _p( \" \" ) \n local flags = { \n defines = ninja.list(tool.getdefines(cfg.defines)), \n includes = ninja.list(table.join(tool.getincludedirs(cfg.includedirs), tool.getquoteincludedirs(cfg.userincludedirs))), \n cppflags = ninja.list(tool.getcppflags(cfg)), \n asmflags = ninja.list(table.join(tool.getcflags(cfg), "
" cfg.buildoptions, cfg.buildoptions_asm)), \n cflags = ninja.list(table.join(tool.getcflags(cfg), cfg.buildoptions, cfg.buildoptions_c)), \n cxxflags = ninja.list(table.join(tool.getcflags(cfg), tool.getcxxflags(cfg), cfg.buildoptions, cfg.buildoptions_cpp)), \n objcflags = ninja.list(table.join(tool.getcflags(cfg), tool.getcxxflags(cfg), cfg.buildoptions, cfg.buildoptions_objc)), \n } \n _p( \" \" ) \n _p( \" # core rules for \" .. cfg.name) \n _p( \" rule cc \" ) \n _p( \" command = \" .. tool.cc .. \" $defines $includes $flags -MMD -MF $out.d -c -o $out $in \" ) \n _p( \" description = cc $out \" ) \n _p( \" depfile = $out.d \" ) \n _p( \" deps = gcc \" ) \n _p( \" \" ) \n _p( \" rule cxx \" ) \n _p( \" command = \" .. tool.cxx .. \" $defines $includes $flags -MMD -MF $out.d -c -o $out $in \" ) \n _p( \" description = cxx $out \" ) \n _p( \" depfile = $out.d \" ) \n _p( \" deps = gcc \" ) \n _p( \" \" ) \n _p( \" rule ar \" ) \n _p( \" command = \" .. tool.ar .. \" $flags $out $in $libs \" .. (os.is( \" MacOSX \" ) and \" 2>&1 > /dev/null | sed -e '/.o) has no symbols$$/d' \" or \" \" )) "
" \n _p( \" description = ar $out \" ) \n _p( \" \" ) \n local link = iif(cfg.language == \" C \" , tool.cc, tool.cxx) \n _p( \" rule link \" ) \n _p( \" command = \" .. link .. \" -o $out @$out.rsp $all_ldflags $libs \" ) \n _p( \" rspfile = $out.rsp \" ) \n _p( \" rspfile_content = $all_outputfiles \" ) \n _p( \" description = link $out \" ) \n _p( \" \" ) \n cpp.custombuildtask(prj, cfg) \n cpp.dependencyRules(prj, cfg) \n cpp.file_rules(cfg, flags) \n local objfiles = {} \n for _, file in ipairs(cfg.files) do \n if path.issourcefile(file) then \n table.insert(objfiles, cpp.objectname(cfg, file)) \n end \n end \n _p('') \n cpp.linker(prj, cfg, objfiles, tool, flags) \n _p( \" \" ) \n end \n function cpp.custombuildtask(prj, cfg) \n local cmd_index = 1 \n local seen_commands = {} \n local command_by_name = {} \n local command_files = {} \n for _, custombuildtask in ipairs(prj.custombuildtask or {}) do \n for _, buildtask in ipairs(custombuildtask or {}) do \n for _, cmd in ipairs(buildtask[4] or {}) do \n local num = 1 \n for _, depdata in ipairs(buildtask[3] or {}) do \n cmd = string.gsub(cmd, \" % "
" $%( \" .. num .. \" %) \" , string.format( \" %s \" , path.getrelative(cfg.location, depdata))) \n num = num + 1 \n end \n cmd = string.gsub(cmd, '%$%(<%)', '$in') \n cmd = string.gsub(cmd, '%$%(@%)', '$out') \n local cmd_name -- shortened command name \n if seen_commands[cmd] == nil then \n local _, _, name = string.find(cmd, '([.%w]+)%s') \n name = 'cmd' .. cmd_index .. '_' .. string.gsub(name, '[^%w]', '_') \n seen_commands[cmd] = { \n name = name, \n index = cmd_index, \n } \n cmd_index = cmd_index + 1 \n cmd_name = name \n else \n cmd_name = seen_commands[cmd].name \n end \n local index = seen_commands[cmd].index \n if command_files[index] == nil then \n command_files[index] = {} \n end \n local cmd_set = command_files[index] \n table.insert(cmd_set, { \n buildtask[1], \n buildtask[2], \n buildtask[3], \n seen_commands[cmd].name, \n }) \n command_files[index] = cmd_set \n command_by_name[cmd_name] = cmd \n end \n end \n end \n _p( \" # custom build rules \" ) \n for command, details in pairs(seen_commands) do \n _p( \" rule \" .. details.name) \n _p(1, \" command = \" .. command) \n end \n for cm "
" d_index, cmdsets in ipairs(command_files) do \n for _, cmdset in ipairs(cmdsets) do \n local file_in = path.getrelative(cfg.location, cmdset[1]) \n local file_out = path.getrelative(cfg.location, cmdset[2]) \n local deps = '' \n for i, dep in ipairs(cmdset[3]) do \n deps = deps .. path.getrelative(cfg.location, dep) .. ' ' \n end \n _p( \" build \" .. file_out .. ': ' .. cmdset[4] .. ' ' .. file_in .. ' | ' .. deps) \n _p( \" \" ) \n end \n end \n end \n function cpp.dependencyRules(prj, cfg) \n local extra_deps = {} \n for _, dependency in ipairs(prj.dependency or {}) do \n for _, dep in ipairs(dependency or {}) do \n local objfilename = cpp.objectname(cfg, path.getrelative(prj.location, dep[1])) \n local dependency = path.getrelative(cfg.location, dep[2]) \n if extra_deps[objfilename] == nil then \n extra_deps[objfilename] = {} \n end \n table.insert(extra_deps[objfilename], dependency) \n end \n end \n cfg.extra_deps = extra_deps \n end \n function cpp.objectname(cfg, file) \n return path.join(cfg.objectsdir, path.trimdots(path.removeext(file)) .. \" .o \" ) \n end \n funct "
" ion cpp.file_rules(cfg, flags) \n _p( \" # build files \" ) \n for _, file in ipairs(cfg.files) do \n _p( \" # FILE: \" .. file) \n if path.issourcefile(file) then \n local objfilename = cpp.objectname(cfg, file) \n local extra_deps = #cfg.extra_deps and '| ' .. table.concat(cfg.extra_deps[objfilename] or {}, ' ') or '' \n local cflags = \" cflags \" \n if path.isobjcfile(file) then \n _p( \" build \" .. objfilename .. \" : cxx \" .. file .. extra_deps) \n cflags = \" objcflags \" \n elseif path.isasmfile(file) then \n _p( \" build \" .. objfilename .. \" : cc \" .. file .. extra_deps) \n cflags = \" asmflags \" \n elseif path.iscfile(file) and not cfg.options.ForceCPP then \n _p( \" build \" .. objfilename .. \" : cc \" .. file .. extra_deps) \n else \n _p( \" build \" .. objfilename .. \" : cxx \" .. file .. extra_deps) \n cflags = \" cxxflags \" \n end \n _p(1, \" flags = \" .. flags[cflags]) \n _p(1, \" includes = \" .. flags.includes) \n _p(1, \" defines = \" .. flags.defines) \n elseif path.isresourcefile(file) then \n end \n end \n _p( \" \" ) \n end \n function cpp.linker(prj, cfg, ob "
" jfiles, tool) \n local all_ldflags = ninja.list(table.join(tool.getlibdirflags(cfg), tool.getldflags(cfg), cfg.linkoptions)) \n local lddeps = ninja.list(premake.getlinks(cfg, \" siblings \" , \" fullpath \" )) \n local libs = lddeps .. \" \" .. ninja.list(tool.getlinkflags(cfg)) \n local function writevars() \n _p(1, \" all_ldflags = \" .. all_ldflags) \n _p(1, \" libs = \" .. libs) \n _p(1, \" all_outputfiles = \" .. table.concat(objfiles, \" \" )) \n end \n if cfg.kind == \" StaticLib \" then \n local ar_flags = ninja.list(tool.getarchiveflags(cfg, cfg, false)) \n _p( \" # link static lib \" ) \n _p( \" build \" .. cfg:getoutputfilename() .. \" : ar \" .. table.concat(objfiles, \" \" ) .. \" | \" .. lddeps) \n _p(1, \" flags = \" .. ninja.list(tool.getarchiveflags(cfg, cfg, false))) \n _p(1, \" all_outputfiles = \" .. table.concat(objfiles, \" \" )) \n elseif cfg.kind == \" SharedLib \" then \n local output = cfg:getoutputfilename() \n _p( \" # link shared lib \" ) \n _p( \" build \" .. output .. \" : link \" .. table.concat(objfiles, \" \" ) .. \" | \" .. "
" libs) \n writevars() \n elseif (cfg.kind == \" ConsoleApp \" ) or (cfg.kind == \" WindowedApp \" ) then \n _p( \" # link executable \" ) \n _p( \" build \" .. cfg:getoutputfilename() .. \" : link \" .. table.concat(objfiles, \" \" ) .. \" | \" .. lddeps) \n writevars() \n else \n p.error( \" ninja action doesn't support this kind of target \" .. cfg.kind) \n end \n end \n " ,
" premake.ninja.cpp = { } \n local ninja = premake.ninja \n local cpp = premake.ninja.cpp \n local p = premake \n local function wrap_ninja_cmd(c) \n if os.is( \" windows \" ) then \n return 'cmd /c \" ' .. c .. ' \" ' \n else \n return c \n end \n end \n function ninja.generate_cpp(prj) \n local pxy = ninja.get_proxy( \" prj \" , prj) \n local tool = premake.gettool(prj) \n local platforms = premake.filterplatforms(prj.solution, tool.platforms, \" Native \" ) \n for _, platform in ipairs(platforms) do \n for cfg in p.eachconfig(pxy, platform) do \n p.generate(cfg, cfg:getprojectfilename(), function() cpp.generate_config(prj, cfg) end) \n end \n end \n end \n function cpp.generate_config(prj, cfg) \n local tool = premake.gettool(prj) \n _p('# Ninja build project file autogenerated by GENie') \n _p('# https://github.com/bkaradzic/GENie') \n _p( \" \" ) \n _p( \" ninja_required_version = 1.7 \" ) \n _p( \" \" ) \n local flags = { \n defines = ninja.list(tool.getdefines(cfg.defines)), \n includes = ninja.list(table.join(tool.getincludedirs(cfg.includedirs), tool.getquoteincludedirs(cfg.us "
" erincludedirs), tool.getsystemincludedirs(cfg.systemincludedirs))), \n cppflags = ninja.list(tool.getcppflags(cfg)), \n asmflags = ninja.list(table.join(tool.getcflags(cfg), cfg.buildoptions, cfg.buildoptions_asm)), \n cflags = ninja.list(table.join(tool.getcflags(cfg), cfg.buildoptions, cfg.buildoptions_c)), \n cxxflags = ninja.list(table.join(tool.getcflags(cfg), tool.getcxxflags(cfg), cfg.buildoptions, cfg.buildoptions_cpp)), \n objcflags = ninja.list(table.join(tool.getcflags(cfg), tool.getcxxflags(cfg), cfg.buildoptions, cfg.buildoptions_objc)), \n } \n _p( \" \" ) \n _p( \" # core rules for \" .. cfg.name) \n _p( \" rule cc \" ) \n _p( \" command = \" .. wrap_ninja_cmd(tool.cc .. \" $defines $includes $flags -MMD -MF $out.d -c -o $out $in \" )) \n _p( \" description = cc $out \" ) \n _p( \" depfile = $out.d \" ) \n _p( \" deps = gcc \" ) \n _p( \" \" ) \n _p( \" rule cxx \" ) \n _p( \" command = \" .. wrap_ninja_cmd(tool.cxx .. \" $defines $includes $flags -MMD -MF $out.d -c -o $out $in \" )) \n _p( \" description = cxx $out \" ) \n _p( \" de "
" pfile = $out.d \" ) \n _p( \" deps = gcc \" ) \n _p( \" \" ) \n _p( \" rule ar \" ) \n _p( \" command = \" .. wrap_ninja_cmd(tool.ar .. \" $flags $out @$out.rsp \" .. (os.is( \" MacOSX \" ) and \" 2>&1 > /dev/null | sed -e '/.o) has no symbols$$/d' \" or \" \" ))) \n _p( \" description = ar $out \" ) \n _p( \" rspfile = $out.rsp \" ) \n _p( \" rspfile_content = $in $libs \" ) \n _p( \" \" ) \n local link = iif(cfg.language == \" C \" , tool.cc, tool.cxx) \n _p( \" rule link \" ) \n local startgroup = '' \n local endgroup = '' \n if (cfg.flags.LinkSupportCircularDependencies) then \n startgroup = '-Wl,--start-group' \n endgroup = '-Wl,--end-group' \n end \n _p( \" command = \" .. wrap_ninja_cmd( \" $pre_link \" .. link .. \" -o $out @$out.rsp $all_ldflags $post_build \" )) \n _p( \" description = link $out \" ) \n _p( \" rspfile = $out.rsp \" ) \n _p( \" rspfile_content = $all_outputfiles \" .. string.format( \" %s $libs %s \" , startgroup, endgroup)) \n _p( \" \" ) \n _p( \" rule exec \" ) \n _p( \" command = \" .. wrap_ninja_cmd( \" $command \" )) \n _p( \" "
" description = Run $type commands \" ) \n _p( \" \" ) \n if #cfg.prebuildcommands > 0 then \n _p( \" build __prebuildcommands_ \" .. premake.esc(prj.name) .. \" : exec \" ) \n _p(1, \" command = \" .. wrap_ninja_cmd( \" echo Running pre-build commands && \" .. table.implode(cfg.prebuildcommands, \" \" , \" \" , \" && \" ))) \n _p(1, \" type = pre-build \" ) \n _p( \" \" ) \n end \n cfg.pchheader_full = cfg.pchheader \n for _, incdir in ipairs(cfg.includedirs) do \n local abspath = path.getabsolute(path.join(cfg.project.location, cfg.shortname, incdir)) \n local testname = path.join(abspath, cfg.pchheader_full) \n if os.isfile(testname) then \n cfg.pchheader_full = path.getrelative(cfg.location, testname) \n break \n end \n end \n cpp.custombuildtask(prj, cfg) \n cpp.dependencyRules(prj, cfg) \n cpp.file_rules(prj, cfg, flags) \n local objfiles = {} \n for _, file in ipairs(cfg.files) do \n if path.issourcefile(file) then \n table.insert(objfiles, cpp.objectname(cfg, file)) \n end \n end \n _p('') \n cpp.linker(prj, cfg, objfiles, tool, flags) \n _p( \" \" ) \n end \n function cpp.custombuildt "
" ask(prj, cfg) \n local cmd_index = 1 \n local seen_commands = {} \n local command_by_name = {} \n local command_files = {} \n local prebuildsuffix = #cfg.prebuildcommands > 0 and \" ||__prebuildcommands_ \" .. premake.esc(prj.name) or \" \" \n for _, custombuildtask in ipairs(prj.custombuildtask or {}) do \n for _, buildtask in ipairs(custombuildtask or {}) do \n for _, cmd in ipairs(buildtask[4] or {}) do \n local num = 1 \n for _, depdata in ipairs(buildtask[3] or {}) do \n cmd = string.gsub(cmd, \" %$%( \" .. num .. \" %) \" , string.format( \" %s \" , path.getrelative(cfg.location, depdata))) \n num = num + 1 \n end \n cmd = string.gsub(cmd, '%$%(<%)', '$in') \n cmd = string.gsub(cmd, '%$%(@%)', '$out') \n local cmd_name -- shortened command name \n if seen_commands[cmd] == nil then \n local _, _, name = string.find(cmd, '([.%w]+)%s') \n name = 'cmd' .. cmd_index .. '_' .. string.gsub(name, '[^%w]', '_') \n seen_commands[cmd] = { \n name = name, \n index = cmd_index, \n } \n cmd_index = cmd_index + 1 \n cmd_name = name \n else \n cmd_name = seen_commands[cmd].name \n end \n l "
" ocal index = seen_commands[cmd].index \n if command_files[index] == nil then \n command_files[index] = {} \n end \n local cmd_set = command_files[index] \n table.insert(cmd_set, { \n buildtask[1], \n buildtask[2], \n buildtask[3], \n seen_commands[cmd].name, \n }) \n command_files[index] = cmd_set \n command_by_name[cmd_name] = cmd \n end \n end \n end \n _p( \" # custom build rules \" ) \n for command, details in pairs(seen_commands) do \n _p( \" rule \" .. details.name) \n _p(1, \" command = \" .. wrap_ninja_cmd(command)) \n end \n for cmd_index, cmdsets in ipairs(command_files) do \n for _, cmdset in ipairs(cmdsets) do \n local file_in = path.getrelative(cfg.location, cmdset[1]) \n local file_out = path.getrelative(cfg.location, cmdset[2]) \n local deps = '' \n for i, dep in ipairs(cmdset[3]) do \n deps = deps .. path.getrelative(cfg.location, dep) .. ' ' \n end \n _p( \" build \" .. file_out .. ': ' .. cmdset[4] .. ' ' .. file_in .. ' | ' .. deps .. prebuildsuffix) \n _p( \" \" ) \n end \n end \n end \n function cpp.dependencyRules(prj, cfg) \n local extra_deps = {} \n local order_deps = "
" {} \n local extra_flags = {} \n for _, dependency in ipairs(prj.dependency or {}) do \n for _, dep in ipairs(dependency or {}) do \n local objfilename = cpp.objectname(cfg, path.getrelative(prj.location, dep[1])) \n local dependency = path.getrelative(cfg.location, dep[2]) \n if extra_deps[objfilename] == nil then \n extra_deps[objfilename] = {} \n end \n table.insert(extra_deps[objfilename], dependency) \n end \n end \n local pchfilename = cfg.pchheader_full and cpp.pchname(cfg, cfg.pchheader_full) or '' \n for _, file in ipairs(cfg.files) do \n local objfilename = file == cfg.pchheader and cpp.pchname(cfg, file) or cpp.objectname(cfg, file) \n if path.issourcefile(file) or file == cfg.pchheader then \n if #cfg.prebuildcommands > 0 then \n if order_deps[objfilename] == nil then \n order_deps[objfilename] = {} \n end \n table.insert(order_deps[objfilename], '__prebuildcommands_' .. premake.esc(prj.name)) \n end \n end \n if path.issourcefile(file) then \n if cfg.pchheader_full and not cfg.flags.NoPCH then \n local nopch = table.icontains(prj.nopch, file) \n if "
" not nopch then \n local suffix = path.isobjcfile(file) and '_objc' or '' \n if extra_deps[objfilename] == nil then \n extra_deps[objfilename] = {} \n end \n table.insert(extra_deps[objfilename], pchfilename .. suffix .. \" .gch \" ) \n if extra_flags[objfilename] == nil then \n extra_flags[objfilename] = {} \n end \n table.insert(extra_flags[objfilename], '-include ' .. pchfilename .. suffix) \n end \n end \n end \n end \n cfg.extra_deps = extra_deps \n cfg.order_deps = order_deps \n cfg.extra_flags = extra_flags \n end \n function cpp.objectname(cfg, file) \n return path.join(cfg.objectsdir, path.trimdots(path.removeext(file)) .. \" .o \" ) \n end \n function cpp.pchname(cfg, file) \n return path.join(cfg.objectsdir, path.trimdots(file)) \n end \n function cpp.file_rules(prj,cfg, flags) \n _p( \" # build files \" ) \n for _, file in ipairs(cfg.files) do \n _p( \" # FILE: \" .. file) \n if cfg.pchheader_full == file then \n local pchfilename = cpp.pchname(cfg, file) \n local extra_deps = #cfg.extra_deps and '| ' .. table.concat(cfg.extra_deps[pchfilename] or {}, ' ') or '' \n local "
" order_deps = #cfg.order_deps and '|| ' .. table.concat(cfg.order_deps[pchfilename] or {}, ' ') or '' \n local extra_flags = #cfg.extra_flags and ' ' .. table.concat(cfg.extra_flags[pchfilename] or {}, ' ') or '' \n _p( \" build \" .. pchfilename .. \" .gch : cxx \" .. file .. extra_deps .. order_deps) \n _p(1, \" flags = \" .. flags['cxxflags'] .. extra_flags .. iif(prj.language == \" C \" , \" -x c-header \" , \" -x c++-header \" )) \n _p(1, \" includes = \" .. flags.includes) \n _p(1, \" defines = \" .. flags.defines) \n _p( \" build \" .. pchfilename .. \" _objc.gch : cxx \" .. file .. extra_deps .. order_deps) \n _p(1, \" flags = \" .. flags['objcflags'] .. extra_flags .. iif(prj.language == \" C \" , \" -x objective-c-header \" , \" -x objective-c++-header \" )) \n _p(1, \" includes = \" .. flags.includes) \n _p(1, \" defines = \" .. flags.defines) \n elseif path.issourcefile(file) then \n local objfilename = cpp.objectname(cfg, file) \n local extra_deps = #cfg.extra_deps and '| ' .. table.concat(cfg.extra_deps[objfilename] or {}, ' ') or '' \n local o "
" rder_deps = #cfg.order_deps and '|| ' .. table.concat(cfg.order_deps[objfilename] or {}, ' ') or '' \n local extra_flags = #cfg.extra_flags and ' ' .. table.concat(cfg.extra_flags[objfilename] or {}, ' ') or '' \n local cflags = \" cflags \" \n if path.isobjcfile(file) then \n _p( \" build \" .. objfilename .. \" : cxx \" .. file .. extra_deps .. order_deps) \n cflags = \" objcflags \" \n elseif path.isasmfile(file) then \n _p( \" build \" .. objfilename .. \" : cc \" .. file .. extra_deps .. order_deps) \n cflags = \" asmflags \" \n elseif path.iscfile(file) and not cfg.options.ForceCPP then \n _p( \" build \" .. objfilename .. \" : cc \" .. file .. extra_deps .. order_deps) \n else \n _p( \" build \" .. objfilename .. \" : cxx \" .. file .. extra_deps .. order_deps) \n cflags = \" cxxflags \" \n end \n _p(1, \" flags = \" .. flags[cflags] .. extra_flags) \n _p(1, \" includes = \" .. flags.includes) \n _p(1, \" defines = \" .. flags.defines) \n elseif path.isresourcefile(file) then \n end \n end \n _p( \" \" ) \n end \n function cpp.linker(prj, cfg, objfiles, tool) \n local all "
" _ldflags = ninja.list(table.join(tool.getlibdirflags(cfg), tool.getldflags(cfg), cfg.linkoptions)) \n local lddeps = ninja.list(premake.getlinks(cfg, \" siblings \" , \" fullpath \" )) \n local libs = lddeps .. \" \" .. ninja.list(tool.getlinkflags(cfg)) \n local prebuildsuffix = #cfg.prebuildcommands > 0 and \" ||__prebuildcommands \" or \" \" \n local function writevars() \n _p(1, \" all_ldflags = \" .. all_ldflags) \n _p(1, \" libs = \" .. libs) \n _p(1, \" all_outputfiles = \" .. table.concat(objfiles, \" \" )) \n if #cfg.prelinkcommands > 0 then \n _p(1, 'pre_link = echo Running pre-link commands && ' .. table.implode(cfg.prelinkcommands, \" \" , \" \" , \" && \" ) .. \" && \" ) \n end \n if #cfg.postbuildcommands > 0 then \n _p(1, 'post_build = && echo Running post-build commands && ' .. table.implode(cfg.postbuildcommands, \" \" , \" \" , \" && \" )) \n end \n end \n if cfg.kind == \" StaticLib \" then \n local ar_flags = ninja.list(tool.getarchiveflags(cfg, cfg, false)) \n _p( \" # link static lib \" ) \n _p( \" build \" .. cfg:ge "
" toutputfilename() .. \" : ar \" .. table.concat(objfiles, \" \" ) .. \" | \" .. lddeps .. prebuildsuffix) \n _p(1, \" flags = \" .. ninja.list(tool.getarchiveflags(cfg, cfg, false))) \n _p(1, \" all_outputfiles = \" .. table.concat(objfiles, \" \" )) \n elseif cfg.kind == \" SharedLib \" or cfg.kind == \" Bundle \" then \n local output = cfg:getoutputfilename() \n _p( \" # link shared lib \" ) \n _p( \" build \" .. output .. \" : link \" .. table.concat(objfiles, \" \" ) .. \" | \" .. lddeps .. prebuildsuffix) \n writevars() \n elseif (cfg.kind == \" ConsoleApp \" ) or (cfg.kind == \" WindowedApp \" ) then \n _p( \" # link executable \" ) \n _p( \" build \" .. cfg:getoutputfilename() .. \" : link \" .. table.concat(objfiles, \" \" ) .. \" | \" .. lddeps .. prebuildsuffix) \n writevars() \n else \n p.error( \" ninja action doesn't support this kind of target \" .. cfg.kind) \n end \n end \n " ,
/* actions/ninja/ninja_swift.lua */
" local ninja = premake.ninja \n local swift = {} \n local p = premake \n function ninja.generate_swift(prj) \n local pxy = ninja.get_proxy( \" prj \" , prj) \n local tool = premake.gettool(prj) \n local platforms = premake.filterplatforms(prj.solution, tool.platforms, \" Native \" ) \n for _, platform in ipairs(platforms) do \n for cfg in p.eachconfig(pxy, platform) do \n p.generate(cfg, cfg:getprojectfilename(), function() swift.generate_config(prj, cfg) end) \n end \n end \n end \n function swift.generate_config(prj, cfg) \n local tool = premake.gettool(prj) \n local flags = { \n swiftcflags = ninja.list(tool.getswiftcflags(cfg)), \n swiftlinkflags = ninja.list(tool.getswiftlinkflags(cfg)), \n } \n _p( \" # Swift project build file \" ) \n _p( \" # generated with GENie ninja \" ) \n _p( \" \" ) \n _p( \" ninja_required_version = 1.7 \" ) \n _p( \" \" ) \n _p( \" out_dir = %s \" , cfg.buildtarget.directory) \n _p( \" obj_dir = %s \" , path.join(cfg.objectsdir, prj.name .. \" .build \" )) \n _p( \" target = $out_dir/%s \" , cfg.buildtarget.name) \n _p( \" module_name = %s \" , prj.name) \n _p( \" module_ "
@ -459,7 +515,7 @@ const char* builtin_scripts[] = {
" doc \" , output, table.concat(objfiles, \" \" ), lddeps) \n else \n p.error( \" ninja action doesn't support this kind of target \" .. cfg.kind) \n end \n end \n " ,
/* actions/qbs/_qbs.lua */
" premake.qbs = { } \n local qbs = premake.qbs \n newaction \n { \n trigger = \" qbs \" , \n shortname = \" qbs \" , \n description = \" Generate QBS build files \" , \n module = \" qbs \" , \n valid_kinds = { \" ConsoleApp \" , \" WindowedApp \" , \" StaticLib \" , \" SharedLib \" , \" Bundle \" }, \n valid_languages = { \" C \" , \" C++ \" }, \n valid_tools = { \n cc = { \" gcc \" },\n }, \n onsolution = function(sln) \n io.eol = \" \\ n \" \n io.indent = \" \\ t \" \n io.escaper(qbs.esc) \n premake.generate(sln, sln.name .. \" .creator.qbs \" , qbs.generate_solution) \n io.indent = \" \" \n premake.generate(sln, sln.name .. \" .creator.qbs.user \" , qbs.generate_user) \n end, \n onproject = function(prj) \n io.eol = \" \\ n \" \n io.indent = \" \\ t \" \n io.escaper(qbs.esc) \n premake.generate(prj, prj.name .. \" .qbs \" , qbs.generate_project) \n end, \n } \n " ,
" premake.qbs = { } \n local qbs = premake.qbs \n newaction \n { \n trigger = \" qbs \" , \n shortname = \" qbs \" , \n description = \" Generate QBS build files \" , \n module = \" qbs \" , \n valid_kinds = { \" ConsoleApp \" , \" WindowedApp \" , \" StaticLib \" , \" SharedLib \" , \" Bundle \" }, \n valid_languages = { \" C \" , \" C++ \" }, \n valid_tools = { \n cc = { \" gcc \" , \" msc \" },\n }, \n onsolution = function(sln) \n io.eol = \" \\ n \" \n io.indent = \" \\ t \" \n io.escaper(qbs.esc) \n premake.generate(sln, sln.name .. \" .creator.qbs \" , qbs.generate_solution) \n io.indent = \" \" \n premake.generate(sln, sln.name .. \" .creator.qbs.user \" , qbs.generate_user) \n end, \n onproject = function(prj) \n io.eol = \" \\ n \" \n io.indent = \" \\ t \" \n io.escaper(qbs.esc) \n premake.generate(prj, prj.name .. \" .qbs \" , qbs.generate_project) \n end, \n } \n " ,
/* actions/qbs/qbs_base.lua */
" function premake.qbs.list(indent, name, table) \n if #table > 0 then \n _p(indent, '%s: [', name) \n for _, item in ipairs(table) do \n _p(indent+1, ' \" %s \" ,', item:gsub(' \" ', ' \\ \\ \" ')) \n end \n _p(indent+1, ']') \n end \n end " ,
@ -477,12 +533,12 @@ const char* builtin_scripts[] = {
" '<data>') \n _p(2, '<variable>ProjectExplorer.Project.TargetCount</variable>') \n _p(2, '<value type= \" int \" >1</value>') \n _p(1, '</data>') \n _p(1, '<data>') \n _p(2, '<variable>Version</variable>') \n _p(2, '<value type= \" int \" >18</value>') \n _p(1, '</data>') \n _p(0, '</qtcreator>') \n end \n " ,
/* actions/qbs/qbs_cpp.lua */
" local qbs = premake.qbs \n local function is_excluded(prj, cfg, file) \n if table.icontains(prj.excludes, file) then \n return true \n end \n if table.icontains(cfg.excludes, file) then \n return true \n end \n return false \n end \n function qbs.generate_project(prj) \n local indent = 0 \n _p(indent, '/*') \n _p(indent, ' * QBS project file autogenerated by GENie') \n _p(indent, ' * https://github.com/bkaradzic/GENie') \n _p(indent, ' */') \n _p(indent, '') \n _p(indent, 'import qbs 1.0') \n _p(indent, '') \n if prj.kind == \" ConsoleApp \" then \n _p(indent, 'CppApplication {') \n _p(indent , 'consoleApplication: true')\n elseif prj.kind == \" WindowedApp \" then \n _p(indent, 'CppApplication { ')\n elseif prj.kind == \" StaticLib \" then \n _p(indent, 'StaticLibrary {') \n elseif prj.kind == \" SharedLib \" then \n _p(indent, 'DynamicLibrary {') \n end \n indent = indent + 1 \n _p(indent, 'name: \" ' .. prj.name .. ' \" ') \n _p(indent, 'cpp.cxxLanguageVersion: \" c++11 \" ') \n _p(indent, 'Depends { name: \" cpp \" }') \n local deps = premake.getdependencies(prj) \n if #deps > 0 then \n for "
" _, depprj in ipairs(deps) do \n _p(indent, 'Depends { name: \" %s \" }', depprj.name) \n end \n end \n local cc = premake.gettool(prj) \n local platforms = premake.filterplatforms(prj.solution, cc.platforms, \" Native \" ) \n for _, platform in ipairs(platforms) do \n for cfg in premake.eachconfig(prj, platform) do \n if cfg.platform ~= \" Native \" then \n _p(''); \n _p(indent, 'Properties { /* %s */', premake.getconfigname(cfg.name, cfg.platform, true)) \n indent = indent + 1 \n local arch = \" \" \n local linkerFlags = cfg.linkoptions \n if cfg.platform == \" x32 \" then \n arch = '&& qbs.architecture == \" x86 \" ' \n elseif cfg.platform == \" x64 \" then \n arch = '&& qbs.architecture == \" x86_64 \" ' \n end \n if cfg.name == \" Debug \" then \n _p(indent, 'condition: qbs.buildVariant == \" debug \" %s', arch) \n else \n _p(indent, 'condition: qbs.buildVariant == \" release \" %s', arch) \n end \n _p(indent, 'targetName: \" %s \" ', cfg.buildtarget.basename) \n _p(indent, 'destinationDirectory: \" %s \" ', path.getabsolute('projects/qbs/' .. cfg.buildtarget.directory) .. '/') \n qbs. "
" list(\n indent \n , \" cpp.commonCompilerFlags \" \n , cfg.buildoptions \n ) \n qbs.list( \n indent \n , \" cpp.cFlags \" \n , cfg.buildoptions_c \n ) \n qbs.list( \n indent \n , \" cpp.cxxFlags \" \n , cfg.buildoptions_cpp \n ) \n qbs.list( \n indent \n , \" cpp.objcFlags \" \n , cfg.buildoptions_objc \n ) \n qbs.list( \n indent \n , \" cpp.objcxxFlags \" \n , cfg.buildoptions_objc \n ) \n if cfg.flags.StaticRuntime then \n _p(indent, 'cpp.runtimeLibrary: \" static \" ') \n else \n _p(indent, 'cpp.runtimeLibrary: \" dyn amic\" ') \n end \n if cfg.flags.PedanticWarnings \n or cfg.flags.ExtraWarnings \n then \n _p(indent, 'cpp.warningLevel: \" all \" ') \n else \n _p(indent, 'cpp.warningLevel: \" default \" ') \n end \n if cfg.flags.FatalWarnings then \n _p(indent, 'cpp.treatWarningsAsErrors: true') \n else \n _p(indent, 'cpp.treatWarningsAsErrors: false') \n end \n if cfg.flags.NoRTTI then \n _p(indent, 'cpp.enableRtti: false') \n else \n _p(indent, 'cpp.enableRtti: true') \n end \n if cfg.flags.NoExceptions then \n _p(indent, 'cpp.enableExceptions: false') \n else \n _p(indent, 'cpp.enableExceptions: true') \n end \n if c "
" fg.flags.Symbols then\n _p(indent, 'cpp.debugInformation: true') \n else \n _p(indent, 'cpp.debugInformation: false') \n end \n if cfg.flags.Unicode then \n _p(indent, 'cpp.windowsApiCharacterSet: \" unicode \" ') \n else \n _p(indent, 'cpp.windowsApiCharacterSet: \" \" ') \n end \n if not cfg.pchheader or cfg.flags.NoPCH then \n _p(indent, 'cpp.usePrecompiledHeader: false') \n else \n _p(indent, 'cpp.usePrecompiledHeader: true') \n _p(indent, 'Group {') \n _p(indent+1, 'name: \" PCH \" ') \n _p(inden t+1, 'files: [\" ' .. cfg.pchheader .. ' \" ]') \n _p(indent+1, 'fileTags: [ \" cpp_pch_src \" ]') \n _p(indent, '}') \n end \n for _, value in ipairs(cfg.flags) do \n if (value == \" Optimize \" ) then \n elseif (value == \" OptimizeSize \" ) then \n _p(indent, 'cpp.optimization: \" small \" ') \n elseif (value == \" OptimizeSpeed \" ) then \n _p(indent, 'cpp.optimization: \" fast \" ') \n end \n end \n qbs.list( \n indent \n , \" cpp.defines \" \n , cfg.defines \n ) \n local sortedincdirs = {} \n for _, includedir in ipairs(cfg.userincludedirs) do \n if includedir ~= nil then \n table.insert(sortedincdirs, incl "
" udedir)\n end \n end \n for _, includedir in ipairs(cfg.includedirs) do \n if includedir ~= nil then \n table.insert(sortedincdirs, includedir) \n end \n end \n table.sort(sortedincdirs, includesort) \n qbs.list( \n indent \n , \" cpp.includePaths \" \n , sortedincdirs \n ) \n qbs.list( \n indent \n , \" cpp.staticLibraries \" \n , premake.getlinks(cfg, \" system \" , \" fullpath \" ) \n ) \n qbs.list( \n indent \n , \" cpp.libraryPaths \" \n , cfg.libdirs \n ) \n qbs.list( \n indent \n , \" cpp.linkerFlags \" \n , linkerFlags \n ) \n table.sort(prj.files) \n if #prj.files > 0 then \n _p(indent, 'files: [') \n for _, file in ipairs(prj.files) do \n if path.iscfile(file) \n or path.iscppfile(file) \n or path.isobjcfile(fil e)\n or path.iscppheader(file) then \n if not is_excluded(prj, cfg, file) then \n _p(indent+1, ' \" %s \" ,', file) \n end \n end \n end \n _p(indent+1, ']') \n end \n if #prj.excludes > 0 then \n _p(indent, 'excludeFiles: [') \n table.sort(prj.excludes) \n for _, file in ipairs(prj.excludes) do \n if path.issourcefile(file) then \n _p(indent+1, ' \" %s \" ,', file) \n end \n end \n _p(indent+1, ']') \n end \n "
" indent = indent - 1\n _p(indent, '}'); \n end \n end \n end \n indent = indent - 1 \n _p(indent, '}') \n end \n " ,
" local qbs = premake.qbs \n local function is_excluded(prj, cfg, file) \n if table.icontains(prj.excludes, file) then \n return true \n end \n if table.icontains(cfg.excludes, file) then \n return true \n end \n return false \n end \n function qbs.generate_project(prj) \n local indent = 0 \n _p(indent, '/*') \n _p(indent, ' * QBS project file autogenerated by GENie') \n _p(indent, ' * https://github.com/bkaradzic/GENie') \n _p(indent, ' */') \n _p(indent, '') \n _p(indent, 'import qbs 1.0') \n _p(indent, '') \n if prj.kind == \" ConsoleApp \" then \n _p(indent, 'CppApplication {') \n _p(indent + 1 , 'consoleApplication: true')\n elseif prj.kind == \" WindowedApp \" then \n _p(indent, 'CppApplication { ')\n _p(indent + 1, 'consoleApplication: false ')\n elseif prj.kind == \" StaticLib \" then \n _p(indent, 'StaticLibrary {') \n elseif prj.kind == \" SharedLib \" then \n _p(indent, 'DynamicLibrary {') \n end \n indent = indent + 1 \n _p(indent, 'name: \" ' .. prj.name .. ' \" ') \n _p(indent, 'Depends { name: \" cpp \" }') \n local deps = premake.getdependencies(prj) \n if #deps > 0 then \n for "
" _, depprj in ipairs(deps) do \n _p(indent, 'Depends { name: \" %s \" }', depprj.name) \n end \n end \n local cc = premake.gettool(prj) \n local platforms = premake.filterplatforms(prj.solution, cc.platforms, \" Native \" ) \n for _, platform in ipairs(platforms) do \n for cfg in premake.eachconfig(prj, platform) do \n if cfg.platform ~= \" Native \" then \n _p(''); \n _p(indent, 'Properties { /* %s */', premake.getconfigname(cfg.name, cfg.platform, true)) \n indent = indent + 1 \n local arch = \" \" \n local linkerFlags = cfg.linkoptions \n if cfg.platform == \" x32 \" then \n arch = '&& qbs.architecture == \" x86 \" ' \n elseif cfg.platform == \" x64 \" then \n arch = '&& qbs.architecture == \" x86_64 \" ' \n end \n if cfg.name == \" Debug \" then \n _p(indent, 'condition: qbs.buildVariant == \" debug \" %s', arch) \n else \n _p(indent, 'condition: qbs.buildVariant == \" release \" %s', arch) \n end \n _p(indent, 'targetName: \" %s \" ', cfg.buildtarget.basename) \n _p(indent, 'destinationDirectory: \" %s \" ', path.getabsolute('projects/qbs/' .. cfg.buildtarget.directory) .. '/') \n if c "
" fg.flags.Cpp11 then\n _p(indent, 'cpp.cxxLanguageVersion: \" c++11 \" ') \n elseif cfg.flags.Cpp14 then \n _p(indent, 'cpp.cxxLanguageVersion: \" c++14 \" ') \n elseif cfg.flags.Cpp17 then \n _p(indent, 'cpp.cxxLanguageVersion: \" c++17 \" ') \n else \n _p(indent, 'cpp.cxxLanguageVersion: \" c++98 \" ') \n end \n if os.is( \" windows \" ) then \n if not cfg.flags.WinMain and (cfg.kind == 'ConsoleApp' or cfg.kind == 'WindowedApp') then \n if cfg.flags.Unicode then \n _p(indent, 'cpp.entryPoint: \" wmainCRTStartup \" ') \n else \n _p(indent, 'cpp.entryPoint: \" mainCRTStartup \" ') \n end \n end \n end \n qbs. list(\n indent \n , \" cpp.commonCompilerFlags \" \n , cfg.buildoptions \n ) \n qbs.list( \n indent \n , \" cpp.cFlags \" \n , cfg.buildoptions_c \n ) \n qbs.list( \n indent \n , \" cpp.cxxFlags \" \n , cfg.buildoptions_cpp \n ) \n qbs.list( \n indent \n , \" cpp.objcFlags \" \n , cfg.buildoptions_objc \n ) \n qbs.list( \n indent \n , \" cpp.objcxxFlags \" \n , cfg.buildoptions_objc \n ) \n if cfg.flags.StaticRuntime then \n _p(indent, 'cpp.runtimeLibrary: \" static \" ') \n else \n _p(indent, 'cpp.runtimeLibrary: \" dyn "
" amic\" ') \n end \n if cfg.flags.PedanticWarnings \n or cfg.flags.ExtraWarnings \n then \n _p(indent, 'cpp.warningLevel: \" all \" ') \n else \n _p(indent, 'cpp.warningLevel: \" default \" ') \n end \n if cfg.flags.FatalWarnings then \n _p(indent, 'cpp.treatWarningsAsErrors: true') \n else \n _p(indent, 'cpp.treatWarningsAsErrors: false') \n end \n if cfg.flags.NoRTTI then \n _p(indent, 'cpp.enableRtti: false') \n else \n _p(indent, 'cpp.enableRtti: true') \n end \n if cfg.flags.NoExceptions then \n _p(indent, 'cpp.enableExceptions: false') \n else \n _p(indent, 'cpp.enableExceptions: true') \n end \n if c fg.flags.Symbols then\n _p(indent, 'cpp.debugInformation: true') \n else \n _p(indent, 'cpp.debugInformation: false') \n end \n if cfg.flags.Unicode then \n _p(indent, 'cpp.windowsApiCharacterSet: \" unicode \" ') \n else \n _p(indent, 'cpp.windowsApiCharacterSet: \" \" ') \n end \n if not cfg.pchheader or cfg.flags.NoPCH then \n _p(indent, 'cpp.usePrecompiledHeader: false') \n else \n _p(indent, 'cpp.usePrecompiledHeader: true') \n _p(indent, 'Group {') \n _p(indent+1, 'name: \" PCH \" ') \n _p(inden "
" t+1, 'files: [\" ' .. cfg.pchheader .. ' \" ]') \n _p(indent+1, 'fileTags: [ \" cpp_pch_src \" ]') \n _p(indent, '}') \n end \n for _, value in ipairs(cfg.flags) do \n if (value == \" Optimize \" ) then \n elseif (value == \" OptimizeSize \" ) then \n _p(indent, 'cpp.optimization: \" small \" ') \n elseif (value == \" OptimizeSpeed \" ) then \n _p(indent, 'cpp.optimization: \" fast \" ') \n end \n end \n qbs.list( \n indent \n , \" cpp.defines \" \n , cfg.defines \n ) \n local sortedincdirs = table.join(cfg.userincludedirs, cfg.includedirs, cfg.systemincludedirs) \n table.sort(sortedincdirs, includesort) \n qbs.list( \n indent \n , \" cpp.includePaths \" \n , sortedincdirs \n ) \n qbs.list( \n indent \n , \" cpp.staticLibraries \" \n , premake.getlinks(cfg, \" system \" , \" fullpath \" ) \n ) \n qbs.list( \n indent \n , \" cpp.libraryPaths \" \n , cfg.libdirs \n ) \n qbs.list( \n indent \n , \" cpp.linkerFlags \" \n , linkerFlags \n ) \n table.sort(prj.files) \n if #prj.files > 0 then \n _p(indent, 'files: [') \n for _, file in ipairs(prj.files) do \n if path.iscfile(file) \n or path.iscppfile(file) \n or path.isobjcfile(fil "
" e)\n or path.isresourcefile(file) \n or path.iscppheader(file) then \n if not is_excluded(prj, cfg, file) then \n _p(indent+1, ' \" %s \" ,', file) \n end \n end \n end \n _p(indent+1, ']') \n end \n if #prj.excludes > 0 then \n _p(indent, 'excludeFiles: [') \n table.sort(prj.excludes) \n for _, file in ipairs(prj.excludes) do \n if path.issourcefile(file) then \n _p(indent+1, ' \" %s \" ,', file) \n end \n end \n _p(indent+1, ']') \n end \n indent = indent - 1\n _p(indent, '}'); \n end \n end \n end \n indent = indent - 1 \n _p(indent, '}') \n end \n " ,
/* _premake_main.lua */
" _WORKING_DIR = os.getcwd() \n local function injectplatform(platform) \n if not platform then return true end \n platform = premake.checkvalue(platform, premake.fields.platforms.allowed) \n for sln in premake.solution.each() do \n local platforms = sln.platforms or { } \n if #platforms == 0 then \n table.insert(platforms, \" Native \" ) \n end \n if not table.contains(platforms, \" Native \" ) then \n return false, sln.name .. \" does not target native platform \\ nNative platform settings are required for the --platform feature. \" \n end \n if not table.contains(platforms, platform) then \n table.insert(platforms, platform) \n end \n sln.platforms = platforms \n end \n return true \n end \n function _premake_main(scriptpath) \n if (scriptpath) then \n local scripts = dofile(scriptpath .. \" /_manifest.lua \" ) \n for _,v in ipairs(scripts) do \n dofile(scriptpath .. \" / \" .. v) \n end \n end \n local profiler = newProfiler() \n if (nil ~= _OPTIONS[ \" debug-profiler \" ]) then \n profiler:start() \n end \n _PREMAKE_COMMAND = path.getabsolute(_PREMAKE_COMMAND) \n premake.action "