Implemented includedirs() and defines() for Xcode

This commit is contained in:
starkos 2009-11-25 20:27:57 +00:00
parent 293b03daa2
commit 73aad5b34b
3 changed files with 76 additions and 26 deletions

View File

@ -151,25 +151,6 @@
end
--
-- Assign required Xcode specific information to each project, which is used
-- to connect dependent projects together, and to build the solution.
--
-- @param sln
-- The solution to prepare.
-- @returns
-- Nothing; information is added to the project objects.
--
function xcode.preparesolution(sln)
for prj in premake.solution.eachproject(sln) do
-- create a tree node to represent the pro
-- prj.xcode = tree.new
-- prj.xcode.productid = xcode.newid(
end
end
---------------------------------------------------------------------------
-- Section generator functions, in the same order in which they appear
-- in the .pbxproj file
@ -479,12 +460,6 @@
_p(4,'GCC_MODEL_TUNING = G5;')
if #cfg.defines > 0 then
_p(4,'GCC_PREPROCESSOR_DEFINITIONS = (')
_p(table.implode(cfg.defines, "\t\t\t\t", ",\n"))
_p(4,');')
end
if tr.infoplist then
_p(4,'INFOPLIST_FILE = "%s";', tr.infoplist.path)
end
@ -529,8 +504,25 @@
_p(4,'GCC_OPTIMIZATION_LEVEL = 0;')
end
if #cfg.defines > 0 then
_p(4,'GCC_PREPROCESSOR_DEFINITIONS = (')
for _, def in ipairs(cfg.defines) do
_p(5, '"%s",', def)
end
_p(4,');')
end
_p(4,'GCC_WARN_ABOUT_RETURN_TYPE = YES;')
_p(4,'GCC_WARN_UNUSED_VARIABLE = YES;')
if #cfg.includedirs > 0 then
_p(4,'HEADER_SEARCH_PATHS = (')
for _, incdir in ipairs(cfg.includedirs) do
_p(5, '"%s",', incdir)
end
_p(4,');')
end
_p(4,'OBJROOT = "%s";', cfg.objectsdir)
_p(4,'ONLY_ACTIVE_ARCH = YES;')
_p(4,'PREBINDING = NO;')

View File

@ -17,6 +17,7 @@
local sln, tr
function suite.setup()
premake.action.set("xcode3")
io.eol = "\n"
xcode.used_ids = { } -- reset the list of generated IDs
sln = test.createsolution()
end
@ -817,6 +818,62 @@
end
function suite.XCBuildConfigurationProject_OnDefines()
defines { "_DEBUG", "DEBUG" }
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_TEMP_DIR = "$(OBJROOT)";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"_DEBUG",
"DEBUG",
);
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
OBJROOT = "obj/Debug";
ONLY_ACTIVE_ARCH = YES;
PREBINDING = NO;
};
name = Debug;
};
]]
end
function suite.XCBuildConfigurationProject_OnIncludeDirs()
includedirs { "../include", "../libs" }
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_TEMP_DIR = "$(OBJROOT)";
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = (
"../include",
"../libs",
);
OBJROOT = "obj/Debug";
ONLY_ACTIVE_ARCH = YES;
PREBINDING = NO;
};
name = Debug;
};
]]
end
---------------------------------------------------------------------------
-- XCBuildConfigurationList tests
---------------------------------------------------------------------------

View File

@ -18,7 +18,7 @@
function test.capture(expected)
local actual = io.endcapture()
local ait = actual:gfind("(.-)" .. io.eol)
local eit = expected:gfind("(.-)\n")
@ -29,6 +29,7 @@
if (etxt ~= atxt) then
test.fail("(%d) expected:\n%s\n...but was:\n%s", linenum, etxt, atxt)
end
linenum = linenum + 1
atxt = ait()
etxt = eit()