Merge pull request #3 from Blizzard/master
All the stuff from Blizzard.
This commit is contained in:
commit
9b1a692cb5
106
_preload.lua
106
_preload.lua
@ -22,13 +22,15 @@
|
||||
api.addAllowed("kind", p.ANDROIDPROJ)
|
||||
|
||||
premake.action._list["vs2015"].valid_kinds = table.join(premake.action._list["vs2015"].valid_kinds, { p.ANDROIDPROJ })
|
||||
premake.action._list["vs2017"].valid_kinds = table.join(premake.action._list["vs2017"].valid_kinds, { p.ANDROIDPROJ })
|
||||
|
||||
-- TODO: can I api.addAllowed() a key-value pair?
|
||||
local os = p.fields["os"];
|
||||
if os ~= nil then
|
||||
table.insert(sys.allowed, { "android", "Android" })
|
||||
local osoption = p.option.get("os")
|
||||
if osoption ~= nil then
|
||||
table.insert(osoption.allowed, { "android", "Android" })
|
||||
end
|
||||
|
||||
-- add system tags for android.
|
||||
os.systemTags[p.ANDROID] = { "android", "mobile" }
|
||||
|
||||
--
|
||||
-- Register Android properties
|
||||
@ -51,62 +53,38 @@
|
||||
kind = "integer",
|
||||
}
|
||||
|
||||
if _ACTION >= "vs2015" then
|
||||
api.register {
|
||||
name = "toolchainversion",
|
||||
scope = "config",
|
||||
kind = "string",
|
||||
allowed = {
|
||||
"4.9", -- NDK GCC versions
|
||||
"3.6", -- NDK clang versions
|
||||
},
|
||||
}
|
||||
else
|
||||
api.register {
|
||||
name = "toolchainversion",
|
||||
scope = "config",
|
||||
kind = "string",
|
||||
allowed = {
|
||||
"4.6", -- NDK GCC versions
|
||||
"4.8",
|
||||
"4.9",
|
||||
"3.4", -- NDK clang versions
|
||||
"3.5",
|
||||
"3.6",
|
||||
},
|
||||
}
|
||||
end
|
||||
api.register {
|
||||
name = "toolchainversion",
|
||||
scope = "config",
|
||||
kind = "string",
|
||||
allowed = {
|
||||
"4.6", -- NDK GCC versions
|
||||
"4.8",
|
||||
"4.9",
|
||||
"3.4", -- NDK clang versions
|
||||
"3.5",
|
||||
"3.6",
|
||||
"3.8",
|
||||
},
|
||||
}
|
||||
|
||||
if _ACTION >= "vs2015" then
|
||||
api.register {
|
||||
name = "stl",
|
||||
scope = "config",
|
||||
kind = "string",
|
||||
allowed = {
|
||||
"minimal c++ (system)",
|
||||
"c++ static",
|
||||
"c++ shared",
|
||||
"stlport static",
|
||||
"stlport shared",
|
||||
"gnu stl static",
|
||||
"gnu stl shared",
|
||||
"llvm libc++ static",
|
||||
"llvm libc++ shared",
|
||||
},
|
||||
}
|
||||
else
|
||||
api.register {
|
||||
name = "stl",
|
||||
scope = "config",
|
||||
kind = "string",
|
||||
allowed = {
|
||||
"none",
|
||||
"minimal",
|
||||
"stdc++",
|
||||
"stlport",
|
||||
},
|
||||
}
|
||||
end
|
||||
api.register {
|
||||
name = "stl",
|
||||
scope = "config",
|
||||
kind = "string",
|
||||
allowed = {
|
||||
"none",
|
||||
"minimal c++ (system)",
|
||||
"c++ static",
|
||||
"c++ shared",
|
||||
"stlport static",
|
||||
"stlport shared",
|
||||
"gnu stl static",
|
||||
"gnu stl shared",
|
||||
"llvm libc++ static",
|
||||
"llvm libc++ shared",
|
||||
},
|
||||
}
|
||||
|
||||
api.register {
|
||||
name = "thumbmode",
|
||||
@ -118,3 +96,13 @@
|
||||
"disabled",
|
||||
},
|
||||
}
|
||||
|
||||
api.register {
|
||||
name = "androidapplibname",
|
||||
scope = "config",
|
||||
kind = "string"
|
||||
}
|
||||
|
||||
return function(cfg)
|
||||
return true
|
||||
end
|
||||
|
10
android.lua
10
android.lua
@ -2,11 +2,10 @@
|
||||
--
|
||||
-- Create an android namespace to isolate the additions
|
||||
--
|
||||
premake.modules.android = {}
|
||||
local p = premake
|
||||
|
||||
local android = premake.modules.android
|
||||
|
||||
include("_preload.lua")
|
||||
if not p.modules.android then
|
||||
p.modules.android = {}
|
||||
|
||||
if _ACTION < "vs2015" then
|
||||
configuration { "Android" }
|
||||
@ -20,5 +19,6 @@
|
||||
include("vsandroid_sln2005.lua")
|
||||
include("vsandroid_vstudio.lua")
|
||||
include("vsandroid_androidproj.lua")
|
||||
end
|
||||
|
||||
return android
|
||||
return p.modules.android
|
||||
|
5
tests/_tests.lua
Normal file
5
tests/_tests.lua
Normal file
@ -0,0 +1,5 @@
|
||||
require ("android")
|
||||
|
||||
return {
|
||||
"test_android_project.lua"
|
||||
}
|
114
tests/test_android_project.lua
Normal file
114
tests/test_android_project.lua
Normal file
@ -0,0 +1,114 @@
|
||||
local p = premake
|
||||
local suite = test.declare("test_android_project")
|
||||
local vc2010 = p.vstudio.vc2010
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2015")
|
||||
wks, prj = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
system "android"
|
||||
local cfg = test.getconfig(prj, "Debug", platform)
|
||||
vc2010.clCompile(cfg)
|
||||
end
|
||||
|
||||
function suite.noOptions()
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<Optimization>Disabled</Optimization>
|
||||
</ClCompile>]]
|
||||
end
|
||||
|
||||
function suite.rttiOff()
|
||||
rtti "Off"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<ExceptionHandling>Enabled</ExceptionHandling>
|
||||
</ClCompile>]]
|
||||
end
|
||||
|
||||
function suite.rttiOn()
|
||||
rtti "On"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<ExceptionHandling>Enabled</ExceptionHandling>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.exceptionHandlingOff()
|
||||
exceptionhandling "Off"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<Optimization>Disabled</Optimization>
|
||||
</ClCompile>]]
|
||||
end
|
||||
|
||||
function suite.exceptionHandlingOn()
|
||||
exceptionhandling "On"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<ExceptionHandling>Enabled</ExceptionHandling>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.cppdialect_cpp11()
|
||||
cppdialect "C++11"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<ExceptionHandling>Enabled</ExceptionHandling>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
<CppLanguageStandard>c++11</CppLanguageStandard>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.cppdialect_cpp14()
|
||||
cppdialect "C++14"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<ExceptionHandling>Enabled</ExceptionHandling>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
<CppLanguageStandard>c++1y</CppLanguageStandard>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.cppdialect_cpp17()
|
||||
cppdialect "C++17"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<ExceptionHandling>Enabled</ExceptionHandling>
|
||||
<RuntimeTypeInfo>true</RuntimeTypeInfo>
|
||||
<AdditionalOptions>-std=c++1z %(AdditionalOptions)</AdditionalOptions>
|
||||
]]
|
||||
end
|
@ -151,17 +151,35 @@
|
||||
end
|
||||
end)
|
||||
|
||||
function android.link(cfg, file)
|
||||
local fname = path.translate(file.relpath)
|
||||
|
||||
-- Files that live outside of the project tree need to be "linked"
|
||||
-- and provided with a project relative pseudo-path. Check for any
|
||||
-- leading "../" sequences and, if found, remove them and mark this
|
||||
-- path as external.
|
||||
local link, count = fname:gsub("%.%.%/", "")
|
||||
local external = (count > 0) or fname:find(':', 1, true)
|
||||
|
||||
-- Try to provide a little bit of flexibility by allowing virtual
|
||||
-- paths for external files. Would be great to support them for all
|
||||
-- files but Visual Studio chokes if file is already in project area.
|
||||
if external and file.vpath ~= file.relpath then
|
||||
link = file.vpath
|
||||
end
|
||||
|
||||
if external then
|
||||
vc2010.element("Link", nil, path.translate(link))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
vc2010.categories.AndroidManifest = {
|
||||
name = "AndroidManifest",
|
||||
priority = 99,
|
||||
|
||||
emitFiles = function(prj, group)
|
||||
local fileCfgFunc = {
|
||||
android.manifestSubType,
|
||||
}
|
||||
|
||||
vc2010.emitFiles(prj, group, "AndroidManifest", {vc2010.generatedFile}, fileCfgFunc)
|
||||
vc2010.emitFiles(prj, group, "AndroidManifest", {vc2010.generatedFile, android.link, android.manifestSubType})
|
||||
end,
|
||||
|
||||
emitFilter = function(prj, group)
|
||||
@ -178,7 +196,7 @@
|
||||
priority = 99,
|
||||
|
||||
emitFiles = function(prj, group)
|
||||
vc2010.emitFiles(prj, group, "AntBuildXml", {vc2010.generatedFile})
|
||||
vc2010.emitFiles(prj, group, "AntBuildXml", {vc2010.generatedFile, android.link})
|
||||
end,
|
||||
|
||||
emitFilter = function(prj, group)
|
||||
@ -191,7 +209,7 @@
|
||||
priority = 99,
|
||||
|
||||
emitFiles = function(prj, group)
|
||||
vc2010.emitFiles(prj, group, "AntProjectPropertiesFile", {vc2010.generatedFile})
|
||||
vc2010.emitFiles(prj, group, "AntProjectPropertiesFile", {vc2010.generatedFile, android.link})
|
||||
end,
|
||||
|
||||
emitFilter = function(prj, group)
|
||||
@ -204,7 +222,7 @@
|
||||
priority = 99,
|
||||
|
||||
emitFiles = function(prj, group)
|
||||
vc2010.emitFiles(prj, group, "Content", {vc2010.generatedFile})
|
||||
vc2010.emitFiles(prj, group, "Content", {vc2010.generatedFile, android.link})
|
||||
end,
|
||||
|
||||
emitFilter = function(prj, group)
|
||||
|
@ -31,10 +31,10 @@
|
||||
--
|
||||
-- Extend global properties
|
||||
--
|
||||
premake.override(vc2010.elements, "globals", function (oldfn, cfg)
|
||||
local elements = oldfn(cfg)
|
||||
premake.override(vc2010.elements, "globals", function (oldfn, prj)
|
||||
local elements = oldfn(prj)
|
||||
|
||||
if cfg.system == premake.ANDROID and cfg.kind ~= premake.ANDROIDPROJ then
|
||||
if prj.system == premake.ANDROID and prj.kind ~= premake.ANDROIDPROJ then
|
||||
-- Remove "IgnoreWarnCompileDuplicatedFilename".
|
||||
local pos = table.indexof(elements, vc2010.ignoreWarnDuplicateFilename)
|
||||
table.remove(elements, pos)
|
||||
@ -51,7 +51,13 @@
|
||||
_p(2, "<RootNamespace>%s</RootNamespace>", cfg.project.name)
|
||||
_p(2, "<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>")
|
||||
_p(2, "<ApplicationType>Android</ApplicationType>")
|
||||
_p(2, "<ApplicationTypeRevision>1.0</ApplicationTypeRevision>")
|
||||
if _ACTION >= "vs2017" then
|
||||
_p(2, "<ApplicationTypeRevision>3.0</ApplicationTypeRevision>")
|
||||
elseif _ACTION >= "vs2015" then
|
||||
_p(2, "<ApplicationTypeRevision>2.0</ApplicationTypeRevision>")
|
||||
else
|
||||
_p(2, "<ApplicationTypeRevision>1.0</ApplicationTypeRevision>")
|
||||
end
|
||||
end
|
||||
|
||||
--
|
||||
@ -83,34 +89,23 @@
|
||||
|
||||
function android.androidStlType(cfg)
|
||||
if cfg.stl ~= nil then
|
||||
local stlType = {
|
||||
["none"] = "none",
|
||||
["minimal c++ (system)"] = "system",
|
||||
["c++ static"] = "gabi++_static",
|
||||
["c++ shared"] = "gabi++_shared",
|
||||
["stlport static"] = "stlport_static",
|
||||
["stlport shared"] = "stlport_shared",
|
||||
["gnu stl static"] = "gnustl_static",
|
||||
["gnu stl shared"] = "gnustl_shared",
|
||||
["llvm libc++ static"] = "c++_static",
|
||||
["llvm libc++ shared"] = "c++_shared",
|
||||
}
|
||||
|
||||
if _ACTION >= "vs2015" then
|
||||
local stlType = {
|
||||
["minimal c++ (system)"] = "system",
|
||||
["c++ static"] = "gabi++_static",
|
||||
["c++ shared"] = "gabi++_shared",
|
||||
["stlport static"] = "stlport_static",
|
||||
["stlport shared"] = "stlport_shared",
|
||||
["gnu stl static"] = "gnustl_static",
|
||||
["gnu stl shared"] = "gnustl_shared",
|
||||
["llvm libc++ static"] = "c++_static",
|
||||
["llvm libc++ shared"] = "c++_shared",
|
||||
}
|
||||
_p(2,'<UseOfStl>%s</UseOfStl>', stlType[cfg.stl])
|
||||
else
|
||||
local static = {
|
||||
none = "none",
|
||||
minimal = "system",
|
||||
["stdc++"] = "gnustl_static",
|
||||
stlport = "stlport_static",
|
||||
}
|
||||
local dynamic = {
|
||||
none = "none",
|
||||
minimal = "system",
|
||||
["stdc++"] = "gnustl_dynamic",
|
||||
stlport = "stlport_dynamic",
|
||||
}
|
||||
local stl = iif(cfg.flags.StaticRuntime, static, dynamic);
|
||||
_p(2,'<AndroidStlType>%s</AndroidStlType>', stl[cfg.stl])
|
||||
_p(2,'<AndroidStlType>%s</AndroidStlType>', stlType[cfg.stl])
|
||||
end
|
||||
end
|
||||
end
|
||||
@ -129,49 +124,67 @@
|
||||
|
||||
-- Note: this function is already patched in by vs2012...
|
||||
premake.override(vc2010, "platformToolset", function(oldfn, cfg)
|
||||
if cfg.system == premake.ANDROID then
|
||||
if _ACTION >= "vs2015" then
|
||||
if cfg.toolchainversion ~= nil then
|
||||
_p(2,'<PlatformToolset>%s_%s</PlatformToolset>', iif(cfg.toolset == "clang", "Clang", "GCC"), string.gsub(cfg.toolchainversion, "%.", "_"))
|
||||
end
|
||||
else
|
||||
local archMap = {
|
||||
arm = "armv5te", -- should arm5 be default? vs-android thinks so...
|
||||
arm5 = "armv5te",
|
||||
arm7 = "armv7-a",
|
||||
mips = "mips",
|
||||
x86 = "x86",
|
||||
}
|
||||
local arch = cfg.architecture or "arm"
|
||||
if cfg.system ~= premake.ANDROID then
|
||||
return oldfn(cfg)
|
||||
end
|
||||
|
||||
if (cfg.architecture ~= nil or cfg.toolchainversion ~= nil) and archMap[arch] ~= nil then
|
||||
local defaultToolsetMap = {
|
||||
arm = "arm-linux-androideabi-",
|
||||
armv5 = "arm-linux-androideabi-",
|
||||
armv7 = "arm-linux-androideabi-",
|
||||
aarch64 = "aarch64-linux-android-",
|
||||
mips = "mipsel-linux-android-",
|
||||
mips64 = "mips64el-linux-android-",
|
||||
x86 = "x86-",
|
||||
x86_64 = "x86_64-",
|
||||
}
|
||||
local toolset = defaultToolsetMap[arch]
|
||||
if _ACTION >= "vs2015" then
|
||||
local gcc_map = {
|
||||
["_"] = "GCC_4_9", -- default
|
||||
["4.6"] = "GCC_4_6",
|
||||
["4.8"] = "GCC_4_8",
|
||||
["4.9"] = "GCC_4_9",
|
||||
}
|
||||
local clang_map = {
|
||||
["_"] = "Clang_3_8", -- default
|
||||
["3.4"] = "Clang_3_4",
|
||||
["3.5"] = "Clang_3_5",
|
||||
["3.6"] = "Clang_3_6",
|
||||
["3.8"] = "Clang_3_8",
|
||||
}
|
||||
|
||||
if cfg.toolset == "clang" then
|
||||
error("The clang toolset is not yet supported by vs-android", 2)
|
||||
toolset = toolset .. "clang"
|
||||
elseif cfg.toolset and cfg.toolset ~= "gcc" then
|
||||
error("Toolset not supported by the android NDK: " .. cfg.toolset, 2)
|
||||
end
|
||||
|
||||
local version = cfg.toolchainversion or iif(cfg.toolset == "clang", "3.5", "4.9")
|
||||
|
||||
_p(2,'<PlatformToolset>%s</PlatformToolset>', toolset .. version)
|
||||
_p(2,'<AndroidArch>%s</AndroidArch>', archMap[arch])
|
||||
end
|
||||
local map = iif(cfg.toolset == "gcc", gcc_map, clang_map)
|
||||
local ts = map[cfg.toolchainversion or "_"]
|
||||
if ts == nil then
|
||||
p.error('Invalid toolchainversion for the selected toolset (%s).', cfg.toolset or "clang")
|
||||
end
|
||||
|
||||
_p(2, "<PlatformToolset>%s</PlatformToolset>", ts)
|
||||
else
|
||||
oldfn(cfg)
|
||||
local archMap = {
|
||||
arm = "armv5te", -- should arm5 be default? vs-android thinks so...
|
||||
arm5 = "armv5te",
|
||||
arm7 = "armv7-a",
|
||||
mips = "mips",
|
||||
x86 = "x86",
|
||||
}
|
||||
local arch = cfg.architecture or "arm"
|
||||
|
||||
if (cfg.architecture ~= nil or cfg.toolchainversion ~= nil) and archMap[arch] ~= nil then
|
||||
local defaultToolsetMap = {
|
||||
arm = "arm-linux-androideabi-",
|
||||
armv5 = "arm-linux-androideabi-",
|
||||
armv7 = "arm-linux-androideabi-",
|
||||
aarch64 = "aarch64-linux-android-",
|
||||
mips = "mipsel-linux-android-",
|
||||
mips64 = "mips64el-linux-android-",
|
||||
x86 = "x86-",
|
||||
x86_64 = "x86_64-",
|
||||
}
|
||||
local toolset = defaultToolsetMap[arch]
|
||||
|
||||
if cfg.toolset == "clang" then
|
||||
error("The clang toolset is not yet supported by vs-android", 2)
|
||||
toolset = toolset .. "clang"
|
||||
elseif cfg.toolset and cfg.toolset ~= "gcc" then
|
||||
error("Toolset not supported by the android NDK: " .. cfg.toolset, 2)
|
||||
end
|
||||
|
||||
local version = cfg.toolchainversion or iif(cfg.toolset == "clang", "3.5", "4.9")
|
||||
|
||||
_p(2,'<PlatformToolset>%s</PlatformToolset>', toolset .. version)
|
||||
_p(2,'<AndroidArch>%s</AndroidArch>', archMap[arch])
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
@ -194,9 +207,6 @@
|
||||
if _ACTION >= "vs2015" then
|
||||
table.remove(elements, table.indexof(elements, vc2010.debugInformationFormat))
|
||||
table.remove(elements, table.indexof(elements, android.thumbMode))
|
||||
elements = table.join(elements, {
|
||||
android.cppStandard,
|
||||
})
|
||||
end
|
||||
end
|
||||
return elements
|
||||
@ -234,11 +244,44 @@
|
||||
-- end
|
||||
end
|
||||
|
||||
function android.cppStandard(cfg)
|
||||
if cfg.flags["C++11"] then
|
||||
_p(3, '<CppLanguageStandard>c++11</CppLanguageStandard>')
|
||||
p.override(vc2010, "languageStandard", function(oldfn, cfg)
|
||||
if cfg.system == p.ANDROID then
|
||||
local cpp_langmap = {
|
||||
["C++98"] = "c++98",
|
||||
["C++11"] = "c++11",
|
||||
["C++14"] = "c++1y",
|
||||
["gnu++98"] = "gnu++98",
|
||||
["gnu++11"] = "gnu++11",
|
||||
["gnu++14"] = "gnu++1y",
|
||||
}
|
||||
if cpp_langmap[cfg.cppdialect] ~= nil then
|
||||
vc2010.element("CppLanguageStandard", nil, cpp_langmap[cfg.cppdialect])
|
||||
end
|
||||
else
|
||||
oldfn(cfg)
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
p.override(vc2010, "additionalCompileOptions", function(oldfn, cfg, condition)
|
||||
if cfg.system == p.ANDROID then
|
||||
local opts = cfg.buildoptions
|
||||
|
||||
local cpp_langmap = {
|
||||
["C++17"] = "-std=c++1z",
|
||||
["gnu++17"] = "-std=gnu++1z",
|
||||
}
|
||||
if cpp_langmap[cfg.cppdialect] ~= nil then
|
||||
table.insert(opts, cpp_langmap[cfg.cppdialect])
|
||||
end
|
||||
|
||||
if #opts > 0 then
|
||||
opts = table.concat(opts, " ")
|
||||
vc2010.element("AdditionalOptions", condition, '%s %%(AdditionalOptions)', opts)
|
||||
end
|
||||
else
|
||||
oldfn(cfg, condition)
|
||||
end
|
||||
end)
|
||||
|
||||
p.override(p.vstudio.vc2010, "warningLevel", function(oldfn, cfg)
|
||||
if _ACTION >= "vs2015" and cfg.system == p.ANDROID and cfg.warnings and cfg.warnings ~= "Off" then
|
||||
@ -248,25 +291,37 @@
|
||||
end
|
||||
end)
|
||||
|
||||
premake.override(vc2010, "exceptionHandling", function(oldfn, cfg)
|
||||
if cfg.system == premake.ANDROID then
|
||||
-- Note: Android defaults to 'off'
|
||||
if not cfg.flags.NoExceptions then
|
||||
_p(3,'<GccExceptionHandling>true</GccExceptionHandling>')
|
||||
end
|
||||
premake.override(vc2010, "clCompilePreprocessorDefinitions", function(oldfn, cfg, condition)
|
||||
if cfg.system == p.ANDROID then
|
||||
vc2010.preprocessorDefinitions(cfg, cfg.defines, false, condition)
|
||||
else
|
||||
oldfn(cfg)
|
||||
oldfn(cfg, condition)
|
||||
end
|
||||
end)
|
||||
|
||||
premake.override(vc2010, "runtimeTypeInfo", function(oldfn, cfg)
|
||||
if cfg.system == premake.ANDROID then
|
||||
premake.override(vc2010, "exceptionHandling", function(oldfn, cfg, condition)
|
||||
if cfg.system == p.ANDROID then
|
||||
-- Note: Android defaults to 'off'
|
||||
if not cfg.flags.NoRTTI then
|
||||
_p(3,'<RuntimeTypeInfo>true</RuntimeTypeInfo>')
|
||||
if cfg.exceptionhandling then
|
||||
if _ACTION >= "vs2015" then
|
||||
vc2010.element("ExceptionHandling", condition, "Enabled")
|
||||
else
|
||||
vc2010.element("GccExceptionHandling", condition, "true")
|
||||
end
|
||||
end
|
||||
else
|
||||
oldfn(cfg)
|
||||
oldfn(cfg, condition)
|
||||
end
|
||||
end)
|
||||
|
||||
premake.override(vc2010, "runtimeTypeInfo", function(oldfn, cfg, condition)
|
||||
if cfg.system == premake.ANDROID then
|
||||
-- Note: Android defaults to 'off'
|
||||
if cfg.rtti then
|
||||
vc2010.element("RuntimeTypeInfo", condition, "true")
|
||||
end
|
||||
else
|
||||
oldfn(cfg, condition)
|
||||
end
|
||||
end)
|
||||
|
||||
@ -298,9 +353,13 @@
|
||||
end)
|
||||
|
||||
function android.antPackage(cfg)
|
||||
_p(2,'<AntPackage>')
|
||||
_p(3,'<AndroidAppLibName>$(RootNamespace)</AndroidAppLibName>')
|
||||
_p(2,'</AntPackage>')
|
||||
p.push('<AntPackage>')
|
||||
if cfg.androidapplibname ~= nil then
|
||||
vc2010.element("AndroidAppLibName", nil, cfg.androidapplibname)
|
||||
else
|
||||
vc2010.element("AndroidAppLibName", nil, "$(RootNamespace)")
|
||||
end
|
||||
p.pop('</AntPackage>')
|
||||
end
|
||||
|
||||
function android.antBuild(cfg)
|
||||
@ -425,3 +484,54 @@
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
--
|
||||
-- Disable subsystem.
|
||||
--
|
||||
|
||||
p.override(vc2010, "subSystem", function(oldfn, cfg)
|
||||
if cfg.system ~= p.ANDROID then
|
||||
return oldfn(cfg)
|
||||
end
|
||||
end)
|
||||
|
||||
--
|
||||
-- Remove .lib and list in LibraryDependencies instead of AdditionalDependencies.
|
||||
--
|
||||
|
||||
p.override(vc2010, "additionalDependencies", function(oldfn, cfg, explicit)
|
||||
if cfg.system == p.ANDROID then
|
||||
local links = {}
|
||||
|
||||
-- If we need sibling projects to be listed explicitly, grab them first
|
||||
if explicit then
|
||||
links = config.getlinks(cfg, "siblings", "fullpath")
|
||||
end
|
||||
|
||||
-- Then the system libraries, which come undecorated
|
||||
local system = config.getlinks(cfg, "system", "name")
|
||||
for i = 1, #system do
|
||||
local link = system[i]
|
||||
table.insert(links, link)
|
||||
end
|
||||
|
||||
-- TODO: When to use LibraryDependencies vs AdditionalDependencies
|
||||
|
||||
if #links > 0 then
|
||||
links = path.translate(table.concat(links, ";"))
|
||||
vc2010.element("LibraryDependencies", nil, "%%(LibraryDependencies);%s", links)
|
||||
end
|
||||
else
|
||||
return oldfn(cfg, explicit)
|
||||
end
|
||||
end)
|
||||
|
||||
--
|
||||
-- Disable override of OutDir. This is breaking deployment.
|
||||
--
|
||||
|
||||
p.override(vc2010, "outDir", function(oldfn, cfg)
|
||||
if cfg.system ~= p.ANDROID then
|
||||
return oldfn(cfg)
|
||||
end
|
||||
end)
|
||||
|
Reference in New Issue
Block a user