Add os.ios
option in xcode4
This commit is contained in:
parent
ca5e62bce7
commit
5cffdc4f6b
@ -6,6 +6,25 @@
|
||||
|
||||
local p = premake
|
||||
|
||||
--
|
||||
-- Register the ios extension
|
||||
--
|
||||
|
||||
local osoption = p.option.get("os")
|
||||
if type(osoption) == "table" then
|
||||
local ios = false
|
||||
table.foreachi(osoption.allowed, function(allowed)
|
||||
ios = ios or allowed[1] == "ios"
|
||||
end)
|
||||
if not ios then
|
||||
table.insert(osoption.allowed, { "ios", "iOS" })
|
||||
end
|
||||
end
|
||||
|
||||
-- add system tags for ios.
|
||||
if not os.systemTags[p.IOS] then
|
||||
os.systemTags[p.IOS] = { "ios", "mobile" }
|
||||
end
|
||||
|
||||
--
|
||||
-- Register new Xcode-specific project fields.
|
||||
|
@ -126,6 +126,19 @@
|
||||
end
|
||||
|
||||
|
||||
function suite.PBXFileReference_ListsIOSWindowedTarget()
|
||||
_TARGET_OS = "ios"
|
||||
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
|
||||
|
||||
|
||||
function suite.PBXFileReference_ListsStaticLibTarget()
|
||||
kind "StaticLib"
|
||||
prepare()
|
||||
@ -138,6 +151,19 @@
|
||||
end
|
||||
|
||||
|
||||
function suite.PBXFileReference_ListsIOSStaticLibTarget()
|
||||
_TARGET_OS = "ios"
|
||||
kind "StaticLib"
|
||||
prepare()
|
||||
xcode.PBXFileReference(tr)
|
||||
test.capture [[
|
||||
/* Begin PBXFileReference section */
|
||||
[libMyProject.a:product] /* libMyProject.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; name = libMyProject.a; path = libMyProject.a; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
/* End PBXFileReference section */
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.PBXFileReference_ListsSharedLibTarget()
|
||||
kind "SharedLib"
|
||||
prepare()
|
||||
@ -150,6 +176,19 @@
|
||||
end
|
||||
|
||||
|
||||
function suite.PBXFileReference_ListsIOSSharedLibTarget()
|
||||
_TARGET_OS = "ios"
|
||||
kind "SharedLib"
|
||||
prepare()
|
||||
xcode.PBXFileReference(tr)
|
||||
test.capture [[
|
||||
/* Begin PBXFileReference section */
|
||||
[libMyProject.dylib:product] /* libMyProject.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; name = libMyProject.dylib; path = libMyProject.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
/* End PBXFileReference section */
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.PBXFileReference_ListsOSXBundleTarget()
|
||||
kind "SharedLib"
|
||||
sharedlibtype "OSXBundle"
|
||||
@ -163,6 +202,20 @@
|
||||
end
|
||||
|
||||
|
||||
function suite.PBXFileReference_ListsIOSOSXBundleTarget()
|
||||
_TARGET_OS = "ios"
|
||||
kind "SharedLib"
|
||||
sharedlibtype "OSXBundle"
|
||||
prepare()
|
||||
xcode.PBXFileReference(tr)
|
||||
test.capture [[
|
||||
/* Begin PBXFileReference section */
|
||||
[MyProject.bundle:product] /* MyProject.bundle */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; name = MyProject.bundle; path = MyProject.bundle; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
/* End PBXFileReference section */
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
function suite.PBXFileReference_ListsOSXFrameworkTarget()
|
||||
kind "SharedLib"
|
||||
sharedlibtype "OSXFramework"
|
||||
@ -176,6 +229,21 @@
|
||||
end
|
||||
|
||||
|
||||
function suite.PBXFileReference_ListsIOSOSXFrameworkTarget()
|
||||
_TARGET_OS = "ios"
|
||||
kind "SharedLib"
|
||||
sharedlibtype "OSXFramework"
|
||||
prepare()
|
||||
xcode.PBXFileReference(tr)
|
||||
test.capture [[
|
||||
/* Begin PBXFileReference section */
|
||||
[MyProject.framework:product] /* MyProject.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; name = MyProject.framework; path = MyProject.framework; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
/* End PBXFileReference section */
|
||||
]]
|
||||
end
|
||||
|
||||
|
||||
|
||||
function suite.PBXFileReference_ListsSourceFiles()
|
||||
files { "source.c" }
|
||||
prepare()
|
||||
|
@ -1761,17 +1761,17 @@
|
||||
|
||||
-- Add variations for other Posix-like systems.
|
||||
|
||||
filter { "system:MacOSX", "kind:WindowedApp" }
|
||||
filter { "system:macosx or ios", "kind:WindowedApp" }
|
||||
targetextension ".app"
|
||||
|
||||
filter { "system:MacOSX", "kind:SharedLib" }
|
||||
filter { "system:macosx or ios", "kind:SharedLib" }
|
||||
targetextension ".dylib"
|
||||
|
||||
filter { "system:MacOSX", "kind:SharedLib", "sharedlibtype:OSXBundle" }
|
||||
filter { "system:macosx or ios", "kind:SharedLib", "sharedlibtype:OSXBundle" }
|
||||
targetprefix ""
|
||||
targetextension ".bundle"
|
||||
|
||||
filter { "system:MacOSX", "kind:SharedLib", "sharedlibtype:OSXFramework" }
|
||||
filter { "system:macosx or ios", "kind:SharedLib", "sharedlibtype:OSXFramework" }
|
||||
targetprefix ""
|
||||
targetextension ".framework"
|
||||
|
||||
@ -1797,7 +1797,7 @@
|
||||
filter { "kind:SharedLib", "system:not Windows" }
|
||||
pic "On"
|
||||
|
||||
filter { "system:macosx" }
|
||||
filter { "system:macosx or ios" }
|
||||
toolset "clang"
|
||||
|
||||
filter {}
|
||||
|
@ -48,7 +48,7 @@
|
||||
local bundlename = ""
|
||||
local bundlepath = ""
|
||||
|
||||
if cfg.system == p.MACOSX and (kind == p.WINDOWEDAPP or (kind == p.SHAREDLIB and cfg.sharedlibtype)) then
|
||||
if (cfg.system == p.MACOSX or cfg.system == p.IOS) and (kind == p.WINDOWEDAPP or (kind == p.SHAREDLIB and cfg.sharedlibtype)) then
|
||||
bundlename = basename .. extension
|
||||
bundlepath = path.join(bundlename, iif(kind == p.SHAREDLIB and cfg.sharedlibtype == "OSXFramework", "Versions/A", "Contents/MacOS"))
|
||||
end
|
||||
|
@ -69,7 +69,7 @@
|
||||
elseif os.istarget("haiku") then
|
||||
path = os.getenv("LIBRARY_PATH") or ""
|
||||
else
|
||||
if os.istarget("macosx") then
|
||||
if os.istarget("macosx") or os.istarget("ios") then
|
||||
path = os.getenv("DYLD_LIBRARY_PATH") or ""
|
||||
else
|
||||
path = os.getenv("LD_LIBRARY_PATH") or ""
|
||||
@ -90,7 +90,7 @@
|
||||
|
||||
path = path or ""
|
||||
local archpath = "/lib:/usr/lib:/usr/local/lib"
|
||||
if os.is64bit() and not os.istarget("macosx") then
|
||||
if os.is64bit() and not (os.istarget("macosx") or os.istarget("ios")) then
|
||||
archpath = "/lib64:/usr/lib64/:usr/local/lib64" .. ":" .. archpath
|
||||
end
|
||||
if (#path > 0) then
|
||||
@ -116,7 +116,7 @@
|
||||
elseif os.istarget("haiku") then
|
||||
formats = { "lib%s.so", "%s.so" }
|
||||
else
|
||||
if os.istarget("macosx") then
|
||||
if os.istarget("macosx") or os.istarget("ios") then
|
||||
formats = { "lib%s.dylib", "%s.dylib" }
|
||||
else
|
||||
formats = { "lib%s.so", "%s.so" }
|
||||
|
@ -210,7 +210,7 @@
|
||||
table.insert(r, '-Wl,--out-implib="' .. cfg.linktarget.relpath .. '"')
|
||||
elseif cfg.system == p.LINUX then
|
||||
table.insert(r, '-Wl,-soname=' .. p.quoted(cfg.linktarget.name))
|
||||
elseif cfg.system == p.MACOSX then
|
||||
elseif cfg.system == p.MACOSX or cfg.system == p.IOS then
|
||||
table.insert(r, '-Wl,-install_name,' .. p.quoted('@rpath/' .. cfg.linktarget.name))
|
||||
end
|
||||
return r
|
||||
|
@ -259,7 +259,7 @@
|
||||
function gcc.getrunpathdirs(cfg, dirs)
|
||||
local result = {}
|
||||
|
||||
if not ((cfg.system == p.MACOSX)
|
||||
if not ((cfg.system == p.MACOSX) or (cfg.system == p.IOS)
|
||||
or (cfg.system == p.LINUX)) then
|
||||
return result
|
||||
end
|
||||
@ -286,7 +286,7 @@
|
||||
end
|
||||
|
||||
for _, rpath in ipairs(rpaths) do
|
||||
if (cfg.system == p.MACOSX) then
|
||||
if (cfg.system == p.MACOSX) or (cfg.system == p.IOS) then
|
||||
rpath = "@loader_path/" .. rpath
|
||||
elseif (cfg.system == p.LINUX) then
|
||||
rpath = iif(rpath == ".", "", "/" .. rpath)
|
||||
@ -303,7 +303,7 @@
|
||||
-- get the right output flag.
|
||||
--
|
||||
function gcc.getsharedlibarg(cfg)
|
||||
if cfg.system == p.MACOSX then
|
||||
if cfg.system == p.MACOSX or cfg.system == p.IOS then
|
||||
if cfg.sharedlibtype == "OSXBundle" then
|
||||
return "-bundle"
|
||||
elseif cfg.sharedlibtype == "OSXFramework" then
|
||||
@ -323,7 +323,7 @@
|
||||
|
||||
function gcc.ldsymbols(cfg)
|
||||
-- OS X has a bug, see http://lists.apple.com/archives/Darwin-dev/2006/Sep/msg00084.html
|
||||
return iif(cfg.system == p.MACOSX, "-Wl,-x", "-s")
|
||||
return iif(cfg.system == p.MACOSX or cfg.system == p.IOS, "-Wl,-x", "-s")
|
||||
end
|
||||
|
||||
gcc.ldflags = {
|
||||
@ -341,7 +341,7 @@
|
||||
table.insert(r, '-Wl,--out-implib="' .. cfg.linktarget.relpath .. '"')
|
||||
elseif cfg.system == p.LINUX then
|
||||
table.insert(r, '-Wl,-soname=' .. p.quoted(cfg.linktarget.name))
|
||||
elseif cfg.system == p.MACOSX then
|
||||
elseif cfg.system == p.MACOSX or cfg.system == p.IOS then
|
||||
table.insert(r, '-Wl,-install_name,' .. p.quoted('@rpath/' .. cfg.linktarget.name))
|
||||
end
|
||||
return r
|
||||
@ -374,14 +374,14 @@
|
||||
architecture = {
|
||||
x86 = function (cfg)
|
||||
local r = {}
|
||||
if cfg.system ~= p.MACOSX then
|
||||
if cfg.system ~= p.MACOSX and cfg.system ~= p.IOS then
|
||||
table.insert (r, "-L/usr/lib32")
|
||||
end
|
||||
return r
|
||||
end,
|
||||
x86_64 = function (cfg)
|
||||
local r = {}
|
||||
if cfg.system ~= p.MACOSX then
|
||||
if cfg.system ~= p.MACOSX and cfg.system ~= p.IOS then
|
||||
table.insert (r, "-L/usr/lib64")
|
||||
end
|
||||
return r
|
||||
|
Loading…
Reference in New Issue
Block a user