Merge pull request #1143 from tempura-sukiyaki/xcode4-consoleapp-targetextension

Fix `targetextension` in xcode4
This commit is contained in:
Samuel Surtees 2018-07-31 19:49:24 +10:00 committed by GitHub
commit 7f92793043
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 165 additions and 7 deletions

View File

@ -976,7 +976,51 @@
end end
function suite.XCBuildConfigurationTarget_OnTargetExtension() function suite.XCBuildConfigurationTarget_OnConsoleAppTargetExtension()
kind "ConsoleApp"
targetextension ".xyz"
prepare()
xcode.XCBuildConfiguration_Target(tr, tr.products.children[1], tr.configs[1])
test.capture [[
[MyProject.xyz:Debug] /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CONFIGURATION_BUILD_DIR = bin/Debug;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_DYNAMIC_NO_PIC = NO;
INSTALL_PATH = /usr/local/bin;
PRODUCT_NAME = MyProject.xyz;
};
name = Debug;
};
]]
end
function suite.XCBuildConfigurationTarget_OnConsoleAppNoTargetExtension()
kind "ConsoleApp"
targetextension ""
prepare()
xcode.XCBuildConfiguration_Target(tr, tr.products.children[1], tr.configs[1])
test.capture [[
[MyProject:Debug] /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CONFIGURATION_BUILD_DIR = bin/Debug;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_DYNAMIC_NO_PIC = NO;
INSTALL_PATH = /usr/local/bin;
PRODUCT_NAME = MyProject;
};
name = Debug;
};
]]
end
function suite.XCBuildConfigurationTarget_OnSharedLibTargetExtension()
kind "SharedLib" kind "SharedLib"
targetextension ".xyz" targetextension ".xyz"
prepare() prepare()
@ -1000,6 +1044,122 @@
end end
function suite.XCBuildConfigurationTarget_OnSharedLibNoTargetExtension()
kind "SharedLib"
targetextension ""
prepare()
xcode.XCBuildConfiguration_Target(tr, tr.products.children[1], tr.configs[1])
test.capture [[
[libMyProject:Debug] /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CONFIGURATION_BUILD_DIR = bin/Debug;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
EXECUTABLE_EXTENSION = "";
EXECUTABLE_PREFIX = lib;
GCC_DYNAMIC_NO_PIC = NO;
INSTALL_PATH = /usr/local/lib;
PRODUCT_NAME = MyProject;
};
name = Debug;
};
]]
end
function suite.XCBuildConfigurationTarget_OnStaticLibTargetExtension()
kind "StaticLib"
targetextension ".xyz"
prepare()
xcode.XCBuildConfiguration_Target(tr, tr.products.children[1], tr.configs[1])
test.capture [[
[libMyProject.xyz:Debug] /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CONFIGURATION_BUILD_DIR = bin/Debug;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
EXECUTABLE_EXTENSION = xyz;
GCC_DYNAMIC_NO_PIC = NO;
INSTALL_PATH = /usr/local/lib;
PRODUCT_NAME = MyProject;
};
name = Debug;
};
]]
end
function suite.XCBuildConfigurationTarget_OnStaticLibNoTargetExtension()
kind "StaticLib"
targetextension ""
prepare()
xcode.XCBuildConfiguration_Target(tr, tr.products.children[1], tr.configs[1])
test.capture [[
[libMyProject:Debug] /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CONFIGURATION_BUILD_DIR = bin/Debug;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
EXECUTABLE_EXTENSION = "";
GCC_DYNAMIC_NO_PIC = NO;
INSTALL_PATH = /usr/local/lib;
PRODUCT_NAME = MyProject;
};
name = Debug;
};
]]
end
function suite.XCBuildConfigurationTarget_OnWindowedAppTargetExtension()
kind "WindowedApp"
targetextension ".xyz"
prepare()
xcode.XCBuildConfiguration_Target(tr, tr.products.children[1], tr.configs[1])
test.capture [[
[MyProject.xyz:Debug] /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CONFIGURATION_BUILD_DIR = bin/Debug;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_DYNAMIC_NO_PIC = NO;
INSTALL_PATH = "\"$(HOME)/Applications\"";
PRODUCT_NAME = MyProject;
WRAPPER_EXTENSION = xyz;
};
name = Debug;
};
]]
end
function suite.XCBuildConfigurationTarget_OnWindowedAppNoTargetExtension()
kind "WindowedApp"
targetextension ""
prepare()
xcode.XCBuildConfiguration_Target(tr, tr.products.children[1], tr.configs[1])
test.capture [[
[MyProject:Debug] /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CONFIGURATION_BUILD_DIR = bin/Debug;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
GCC_DYNAMIC_NO_PIC = NO;
INSTALL_PATH = "\"$(HOME)/Applications\"";
PRODUCT_NAME = MyProject;
WRAPPER_EXTENSION = "";
};
name = Debug;
};
]]
end
function suite.XCBuildConfigurationTarget_OnInfoPlist() function suite.XCBuildConfigurationTarget_OnInfoPlist()
files { "./a/b/c/MyProject-Info.plist" } files { "./a/b/c/MyProject-Info.plist" }
prepare() prepare()

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'