Cleanup on target and project config blocks
This commit is contained in:
parent
5ad56cccaa
commit
bf152cac6b
@ -65,23 +65,6 @@
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Return the default installation path, based target kind.
|
||||
--
|
||||
-- @param cfg
|
||||
-- The configuration to query.
|
||||
-- @returns
|
||||
-- The install path, string.
|
||||
--
|
||||
|
||||
function xcode.getinstallpath(cfg)
|
||||
local paths = {
|
||||
WindowedApp = "$(HOME)/Applications",
|
||||
}
|
||||
return paths[cfg.kind]
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Return the Xcode product type, based target kind.
|
||||
--
|
||||
@ -288,9 +271,17 @@
|
||||
_p(3,'dependencies = (')
|
||||
_p(3,');')
|
||||
_p(3,'name = %s;', name)
|
||||
if node.cfg.kind == "WindowedApp" then
|
||||
_p(3,'productInstallPath = "%s";', xcode.getinstallpath(node.cfg))
|
||||
|
||||
local p
|
||||
if node.cfg.kind == "ConsoleApp" then
|
||||
p = "$(HOME)/bin"
|
||||
elseif node.cfg.kind == "WindowedApp" then
|
||||
p = "$(HOME)/Applications"
|
||||
end
|
||||
if p then
|
||||
_p(3,'productInstallPath = "%s";', p)
|
||||
end
|
||||
|
||||
_p(3,'productName = %s;', name)
|
||||
_p(3,'productReference = %s /* %s */;', node.id, node.name)
|
||||
_p(3,'productType = "%s";', xcode.getproducttype(node))
|
||||
@ -391,12 +382,16 @@
|
||||
end
|
||||
|
||||
|
||||
function xcode.XCBuildConfigurationBlock(tr, target, cfg)
|
||||
function xcode.XCBuildConfiguration_Target(tr, target, cfg)
|
||||
_p(2,'%s /* %s */ = {', target.configids[cfg.name], cfg.name)
|
||||
_p(3,'isa = XCBuildConfiguration;')
|
||||
_p(3,'buildSettings = {')
|
||||
_p(4,'ALWAYS_SEARCH_USER_PATHS = NO;')
|
||||
|
||||
if not cfg.flags.Symbols then
|
||||
_p(4,'DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";')
|
||||
end
|
||||
|
||||
local outdir = path.getdirectory(cfg.buildtarget.bundlepath)
|
||||
if outdir ~= "." then
|
||||
_p(4,'CONFIGURATION_BUILD_DIR = %s;', outdir)
|
||||
@ -426,28 +421,43 @@
|
||||
|
||||
_p(4,'PRODUCT_NAME = %s;', cfg.buildtarget.basename)
|
||||
|
||||
if cfg.kind == "WindowedApp" then
|
||||
_p(4,'INSTALL_PATH = "%s";', xcode.getinstallpath(cfg))
|
||||
local p
|
||||
if cfg.kind == "ConsoleApp" then
|
||||
p = '/usr/local/bin'
|
||||
elseif cfg.kind == "WindowedApp" then
|
||||
p = '"$(HOME)/Applications"'
|
||||
end
|
||||
if p then
|
||||
_p(4,'INSTALL_PATH = %s;', p)
|
||||
end
|
||||
|
||||
_p(4,'SYMROOT = %s;', cfg.objectsdir)
|
||||
-- _p(4,'SYMROOT = %s;', cfg.objectsdir)
|
||||
_p(3,'};')
|
||||
_p(3,'name = %s;', cfg.name)
|
||||
_p(2,'};')
|
||||
end
|
||||
|
||||
|
||||
function xcode.XCBuildConfigurationDefault(tr, cfg)
|
||||
function xcode.XCBuildConfiguration_Project(tr, cfg)
|
||||
_p(2,'%s /* %s */ = {', tr.configids[cfg.name], cfg.name)
|
||||
_p(3,'isa = XCBuildConfiguration;')
|
||||
_p(3,'buildSettings = {')
|
||||
_p(4,'ARCHS = "$(ARCHS_STANDARD_32_BIT)";')
|
||||
_p(4,'GCC_C_LANGUAGE_STANDARD = c99;')
|
||||
_p(4,'ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";')
|
||||
_p(4,'GCC_C_LANGUAGE_STANDARD = gnu99;')
|
||||
|
||||
if cfg.flags.Optimize or cfg.flags.OptimizeSize then
|
||||
_p(4,'GCC_OPTIMIZATION_LEVEL = s;')
|
||||
elseif cfg.flags.OptimizeSpeed then
|
||||
_p(4,'GCC_OPTIMIZATION_LEVEL = 3;')
|
||||
else
|
||||
_p(4,'GCC_OPTIMIZATION_LEVEL = 0;')
|
||||
end
|
||||
|
||||
_p(4,'GCC_WARN_ABOUT_RETURN_TYPE = YES;')
|
||||
_p(4,'GCC_WARN_UNUSED_VARIABLE = YES;')
|
||||
_p(4,'ONLY_ACTIVE_ARCH = YES;')
|
||||
_p(4,'PREBINDING = NO;')
|
||||
_p(4,'SYMROOT = %s;', cfg.objectsdir)
|
||||
-- _p(4,'SYMROOT = %s;', cfg.objectsdir)
|
||||
_p(3,'};')
|
||||
_p(3,'name = %s;', cfg.name)
|
||||
_p(2,'};')
|
||||
@ -458,11 +468,11 @@
|
||||
_p('/* Begin XCBuildConfiguration section */')
|
||||
for _, target in ipairs(tr.products.children) do
|
||||
for cfg in premake.eachconfig(tr.project) do
|
||||
xcode.XCBuildConfigurationBlock(tr, target, cfg)
|
||||
xcode.XCBuildConfiguration_Target(tr, target, cfg)
|
||||
end
|
||||
end
|
||||
for cfg in premake.eachconfig(tr.project) do
|
||||
xcode.XCBuildConfigurationDefault(tr, cfg)
|
||||
xcode.XCBuildConfiguration_Project(tr, cfg)
|
||||
end
|
||||
_p('/* End XCBuildConfiguration section */')
|
||||
_p('')
|
||||
|
@ -370,6 +370,7 @@
|
||||
dependencies = (
|
||||
);
|
||||
name = MyProject;
|
||||
productInstallPath = "$(HOME)/bin";
|
||||
productName = MyProject;
|
||||
productReference = [MyProject:product] /* MyProject */;
|
||||
productType = "com.apple.product-type.tool";
|
||||
@ -550,50 +551,23 @@
|
||||
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
-- XCBuildConfiguration tests
|
||||
-- XCBuildConfiguration_Target tests
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
local function Call_XCBuildConfigurationBlock()
|
||||
|
||||
function suite.XCBuildConfigurationTarget_OnConsoleApp()
|
||||
prepare()
|
||||
local target = tr.products.children[1]
|
||||
local config = premake.getconfig(target.project, "Debug")
|
||||
xcode.XCBuildConfigurationBlock(target, config)
|
||||
end
|
||||
|
||||
|
||||
function suite.XCBuildConfigurationDefault_OnDefaults()
|
||||
prepare()
|
||||
xcode.XCBuildConfigurationDefault(tr, premake.getconfig(tr.project, "Debug"))
|
||||
test.capture [[
|
||||
[MyProject:Debug(2)] /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
|
||||
GCC_C_LANGUAGE_STANDARD = c99;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
PREBINDING = NO;
|
||||
SYMROOT = obj/Debug;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.XCBuildConfigurationBlock_OnConsoleAppDefaults()
|
||||
prepare()
|
||||
xcode.XCBuildConfigurationBlock(tr, tr.products.children[1], premake.getconfig(tr.project, "Debug"))
|
||||
xcode.XCBuildConfiguration_Target(tr, tr.products.children[1], premake.getconfig(tr.project, "Debug"))
|
||||
test.capture [[
|
||||
[MyProject:Debug] /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_MODEL_TUNING = G5;
|
||||
PRODUCT_NAME = MyProject;
|
||||
SYMROOT = obj/Debug;
|
||||
INSTALL_PATH = /usr/local/bin;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@ -601,61 +575,152 @@
|
||||
end
|
||||
|
||||
|
||||
function suite.XCBuildConfigurationBlock_OnStaticLibDefaults()
|
||||
kind "StaticLib"
|
||||
prepare()
|
||||
xcode.XCBuildConfigurationBlock(tr, tr.products.children[1], premake.getconfig(tr.project, "Debug"))
|
||||
test.capture [[
|
||||
[libMyProject.a:Debug] /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_MODEL_TUNING = G5;
|
||||
PRODUCT_NAME = MyProject;
|
||||
SYMROOT = obj/Debug;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.XCBuildConfigurationBlock_OnInfoPlist()
|
||||
files { "MyProject-Info.plist" }
|
||||
prepare()
|
||||
xcode.XCBuildConfigurationBlock(tr, tr.products.children[1], premake.getconfig(tr.project, "Debug"))
|
||||
test.capture [[
|
||||
[MyProject:Debug] /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_MODEL_TUNING = G5;
|
||||
INFOPLIST_FILE = "MyProject-Info.plist";
|
||||
PRODUCT_NAME = MyProject;
|
||||
SYMROOT = obj/Debug;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.XCBuildConfigurationBlock_OnWindowedApp()
|
||||
function suite.XCBuildConfigurationTarget_OnWindowedApp()
|
||||
kind "WindowedApp"
|
||||
prepare()
|
||||
xcode.XCBuildConfigurationBlock(tr, tr.products.children[1], premake.getconfig(tr.project, "Debug"))
|
||||
xcode.XCBuildConfiguration_Target(tr, tr.products.children[1], premake.getconfig(tr.project, "Debug"))
|
||||
test.capture [[
|
||||
[MyProject.app:Debug] /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_MODEL_TUNING = G5;
|
||||
PRODUCT_NAME = MyProject;
|
||||
INSTALL_PATH = "$(HOME)/Applications";
|
||||
SYMROOT = obj/Debug;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.XCBuildConfigurationTarget_OnStaticLib()
|
||||
kind "StaticLib"
|
||||
prepare()
|
||||
xcode.XCBuildConfiguration_Target(tr, tr.products.children[1], premake.getconfig(tr.project, "Debug"))
|
||||
test.capture [[
|
||||
[libMyProject.a:Debug] /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_MODEL_TUNING = G5;
|
||||
PRODUCT_NAME = MyProject;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.XCBuildConfigurationTarget_OnInfoPlist()
|
||||
files { "MyProject-Info.plist" }
|
||||
prepare()
|
||||
xcode.XCBuildConfiguration_Target(tr, tr.products.children[1], premake.getconfig(tr.project, "Debug"))
|
||||
test.capture [[
|
||||
[MyProject:Debug] /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_MODEL_TUNING = G5;
|
||||
INFOPLIST_FILE = "MyProject-Info.plist";
|
||||
PRODUCT_NAME = MyProject;
|
||||
INSTALL_PATH = /usr/local/bin;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.XCBuildConfigurationTarget_OnSymbols()
|
||||
flags { "Symbols" }
|
||||
prepare()
|
||||
xcode.XCBuildConfiguration_Target(tr, tr.products.children[1], premake.getconfig(tr.project, "Debug"))
|
||||
test.capture [[
|
||||
[MyProject:Debug] /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = NO;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_ENABLE_FIX_AND_CONTINUE = YES;
|
||||
GCC_MODEL_TUNING = G5;
|
||||
PRODUCT_NAME = MyProject;
|
||||
INSTALL_PATH = /usr/local/bin;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
]]
|
||||
end
|
||||
|
||||
---------------------------------------------------------------------------
|
||||
-- XCBuildConfiguration_Project tests
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
function suite.XCBuildConfigurationProject_OnConsoleApp()
|
||||
prepare()
|
||||
xcode.XCBuildConfiguration_Project(tr, premake.getconfig(tr.project, "Debug"))
|
||||
test.capture [[
|
||||
[MyProject:Debug(2)] /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
PREBINDING = NO;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.XCBuildConfigurationProject_OnOptimize()
|
||||
flags { "Optimize" }
|
||||
prepare()
|
||||
xcode.XCBuildConfiguration_Project(tr, premake.getconfig(tr.project, "Debug"))
|
||||
test.capture [[
|
||||
[MyProject:Debug(2)] /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_OPTIMIZATION_LEVEL = s;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
PREBINDING = NO;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.XCBuildConfigurationProject_OnOptimizeSpeed()
|
||||
flags { "OptimizeSpeed" }
|
||||
prepare()
|
||||
xcode.XCBuildConfiguration_Project(tr, premake.getconfig(tr.project, "Debug"))
|
||||
test.capture [[
|
||||
[MyProject:Debug(2)] /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
|
||||
GCC_C_LANGUAGE_STANDARD = gnu99;
|
||||
GCC_OPTIMIZATION_LEVEL = 3;
|
||||
GCC_WARN_ABOUT_RETURN_TYPE = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
PREBINDING = NO;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@ -667,7 +732,7 @@
|
||||
-- XCBuildConfigurationList tests
|
||||
---------------------------------------------------------------------------
|
||||
|
||||
function suite.XCBuildConfigurationList_OnSingleProject()
|
||||
function suite.XCBuildConfigurationList_OnProject()
|
||||
prepare()
|
||||
xcode.XCBuildConfigurationList(tr)
|
||||
test.capture [[
|
||||
|
Reference in New Issue
Block a user