Fix targetextension in xcode4

Add support for ConsoleApp.
This commit is contained in:
tempura-sukiyaki 2018-07-31 15:51:59 +09:00
parent fec912ddac
commit b89eef55c9

View File

@ -449,10 +449,9 @@
-- is this the product node, describing the output target? -- is this the product node, describing the output target?
if node.kind == "product" then if node.kind == "product" then
local name = iif(tr.project.kind ~= "ConsoleApp", node.name, node.cfg.buildtarget.prefix .. node.cfg.buildtarget.basename)
settings[node.id] = function(level) settings[node.id] = function(level)
_p(level,'%s /* %s */ = {isa = PBXFileReference; explicitFileType = %s; includeInIndex = 0; name = %s; path = %s; sourceTree = BUILT_PRODUCTS_DIR; };', _p(level,'%s /* %s */ = {isa = PBXFileReference; explicitFileType = %s; includeInIndex = 0; name = %s; path = %s; sourceTree = BUILT_PRODUCTS_DIR; };',
node.id, node.name, xcode.gettargettype(node), stringifySetting(name), stringifySetting(path.getname(node.cfg.buildtarget.bundlename ~= "" and node.cfg.buildtarget.bundlename or node.cfg.buildtarget.relpath))) node.id, node.name, xcode.gettargettype(node), stringifySetting(node.name), stringifySetting(path.getname(node.cfg.buildtarget.bundlename ~= "" and node.cfg.buildtarget.bundlename or node.cfg.buildtarget.relpath)))
end end
-- is this a project dependency? -- is this a project dependency?
elseif node.parent.parent == tr.projects then elseif node.parent.parent == tr.projects then
@ -911,9 +910,8 @@
settings['EXECUTABLE_PREFIX'] = cfg.buildtarget.prefix settings['EXECUTABLE_PREFIX'] = cfg.buildtarget.prefix
end end
if cfg.kind ~= "ConsoleApp" and cfg.targetextension then if cfg.buildtarget.extension then
local ext = cfg.targetextension local ext = cfg.buildtarget.extension:sub(2)
ext = iif(ext:startswith('.'), ext:sub(2), ext)
if cfg.kind == "WindowedApp" and ext ~= "app" then if cfg.kind == "WindowedApp" and ext ~= "app" then
settings['WRAPPER_EXTENSION'] = ext settings['WRAPPER_EXTENSION'] = ext
elseif (cfg.kind == "StaticLib" and ext ~= "a") or (cfg.kind == "SharedLib" and ext ~= "dylib") then elseif (cfg.kind == "StaticLib" and ext ~= "a") or (cfg.kind == "SharedLib" and ext ~= "dylib") then
@ -965,7 +963,7 @@
if not table.isempty(fileNameList) then if not table.isempty(fileNameList) then
settings['EXCLUDED_SOURCE_FILE_NAMES'] = fileNameList settings['EXCLUDED_SOURCE_FILE_NAMES'] = fileNameList
end end
settings['PRODUCT_NAME'] = cfg.buildtarget.basename settings['PRODUCT_NAME'] = iif(cfg.kind == "ConsoleApp" and cfg.buildtarget.extension, cfg.buildtarget.basename .. cfg.buildtarget.extension, cfg.buildtarget.basename)
if os.istarget(p.IOS) then if os.istarget(p.IOS) then
settings['SDKROOT'] = 'iphoneos' settings['SDKROOT'] = 'iphoneos'