Implemented location(), targetdir(), objdir()

This commit is contained in:
starkos 2009-11-17 20:30:56 +00:00
parent d15d075309
commit f47e40abbe
3 changed files with 63 additions and 5 deletions

View File

@ -174,9 +174,8 @@
end
if node.kind == "product" then
local targpath = path.getrelative(tr.project.location, node.cfg.buildtarget.bundlepath)
_p(2,'%s /* %s */ = {isa = PBXFileReference; explicitFileType = %s; includeInIndex = 0; name = "%s"; path = "%s"; sourceTree = BUILT_PRODUCTS_DIR; };',
node.id, node.name, xcode.gettargettype(node), node.name, targpath)
node.id, node.name, xcode.gettargettype(node), node.name, node.cfg.buildtarget.bundlename)
else
local pth, src
if xcode.isframework(node.path) then
@ -443,6 +442,13 @@
_p(3,'isa = XCBuildConfiguration;')
_p(3,'buildSettings = {')
_p(4,'ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";')
local targetdir = path.getdirectory(cfg.buildtarget.bundlepath)
if targetdir ~= "." then
_p(4,'CONFIGURATION_BUILD_DIR = "$(SYMROOT)";');
end
_p(4,'CONFIGURATION_TEMP_DIR = "$(OBJROOT)";')
_p(4,'GCC_C_LANGUAGE_STANDARD = gnu99;')
if cfg.flags.Optimize or cfg.flags.OptimizeSize then
@ -455,9 +461,14 @@
_p(4,'GCC_WARN_ABOUT_RETURN_TYPE = YES;')
_p(4,'GCC_WARN_UNUSED_VARIABLE = YES;')
_p(4,'OBJROOT = "%s";', cfg.objectsdir)
_p(4,'ONLY_ACTIVE_ARCH = YES;')
_p(4,'PREBINDING = NO;')
-- _p(4,'SYMROOT = %s;', cfg.objectsdir)
if targetdir ~= "." then
_p(4,'SYMROOT = "%s";', targetdir)
end
_p(3,'};')
_p(3,'name = %s;', cfg.name)
_p(2,'};')

View File

@ -442,7 +442,7 @@
local dir = cfg[field.."dir"] or cfg.targetdir or path.getrelative(cfg.location, cfg.basedir)
local prefix = ""
local suffix = ""
local bundlepath
local bundlepath, bundlename
if namestyle == "windows" then
if kind == "ConsoleApp" or kind == "WindowedApp" then
@ -454,7 +454,8 @@
end
elseif namestyle == "posix" then
if kind == "WindowedApp" and system == "macosx" then
bundlepath = path.join(dir, name .. ".app")
bundlename = name .. ".app"
bundlepath = path.join(dir, bundlename)
dir = path.join(bundlepath, "Contents/MacOS")
elseif kind == "SharedLib" then
prefix = "lib"
@ -481,6 +482,7 @@
result.name = prefix .. name .. suffix
result.directory = dir
result.fullpath = path.join(result.directory, result.name)
result.bundlename = bundlename or result.name
result.bundlepath = bundlepath or result.fullpath
if pathstyle == "windows" then

View File

@ -166,6 +166,19 @@
end
function suite.PBXFileReference_IgnoresTargetDir()
targetdir "bin"
kind "WindowedApp"
prepare()
xcode.PBXFileReference(tr)
test.capture [[
/* Begin PBXFileReference section */
[MyProject.app:product] /* MyProject.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; name = "MyProject.app"; path = "MyProject.app"; sourceTree = BUILT_PRODUCTS_DIR; };
/* End PBXFileReference section */
]]
end
---------------------------------------------------------------------------
-- PBXFrameworksBuildPhase tests
---------------------------------------------------------------------------
@ -671,10 +684,12 @@
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
CONFIGURATION_TEMP_DIR = "$(OBJROOT)";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
OBJROOT = "obj/Debug";
ONLY_ACTIVE_ARCH = YES;
PREBINDING = NO;
};
@ -693,10 +708,12 @@
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
CONFIGURATION_TEMP_DIR = "$(OBJROOT)";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_OPTIMIZATION_LEVEL = s;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
OBJROOT = "obj/Debug";
ONLY_ACTIVE_ARCH = YES;
PREBINDING = NO;
};
@ -715,10 +732,12 @@
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
CONFIGURATION_TEMP_DIR = "$(OBJROOT)";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_OPTIMIZATION_LEVEL = 3;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
OBJROOT = "obj/Debug";
ONLY_ACTIVE_ARCH = YES;
PREBINDING = NO;
};
@ -728,6 +747,32 @@
end
function suite.XCBuildConfigurationProject_OnTargetDir()
targetdir "bin"
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)";
CONFIGURATION_BUILD_DIR = "$(SYMROOT)";
CONFIGURATION_TEMP_DIR = "$(OBJROOT)";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
OBJROOT = "obj/Debug";
ONLY_ACTIVE_ARCH = YES;
PREBINDING = NO;
SYMROOT = "bin";
};
name = Debug;
};
]]
end
---------------------------------------------------------------------------
-- XCBuildConfigurationList tests
---------------------------------------------------------------------------