diff --git a/_preload.lua b/_preload.lua
index 63f22d3..1041f5e 100644
--- a/_preload.lua
+++ b/_preload.lua
@@ -5,6 +5,8 @@
-- Copyright: (c) 2013-2015 Manu Evans and the Premake project
--
+ require "vstudio"
+
local p = premake
local api = p.api
@@ -16,12 +18,13 @@
p.ANDROIDPROJ = "androidproj"
api.addAllowed("system", p.ANDROID)
- api.addAllowed("architecture", { "armv5", "armv7", "aarach64", "mips", "mips64", "arm" })
+ api.addAllowed("architecture", { "armv5", "armv7", "aarach64", "mips", "mips64", "arm", "arm64" })
api.addAllowed("vectorextensions", { "NEON", "MXU" })
api.addAllowed("flags", { "Thumb" })
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"];
@@ -51,62 +54,52 @@
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",
- },
+ api.register {
+ name = "androidprojectversion",
+ scope = "config",
+ kind = "string",
+ allowed = {
+ "1.0",
+ "2.0",
+ "3.0",
}
- end
+ }
- 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 = "toolchainversion",
+ scope = "config",
+ kind = "string",
+ allowed = function (value)
+ -- Warn the user of a known invalid option
+ if _ACTION < "vs2015" then
+ if (value >= "4.6" and value <= "4.9") or (value >= "3.4" and value <= "3.6") then
+ p.warn("The provided value might not be supported!")
+ end
+ end
+
+ -- Don't limit the value arbitrarily as the available options
+ -- change between implementations
+ return value
+ end,
+ }
+
+ api.register {
+ name = "stl",
+ scope = "config",
+ kind = "string",
+ allowed = {
+ "none",
+ "minimal",
+ "c++",
+ "stlport",
+ "gnu stl",
+ "stdc++",
+ "llvm libc++",
+ },
+ aliases = {
+ ["stdc++"] = "gnu stl",
+ },
+ }
api.register {
name = "thumbmode",
diff --git a/vsandroid_vcxproj.lua b/vsandroid_vcxproj.lua
index e48e2de..6516262 100644
--- a/vsandroid_vcxproj.lua
+++ b/vsandroid_vcxproj.lua
@@ -23,6 +23,7 @@
if vstudio.vs2010_architectures ~= nil then
if _ACTION >= "vs2015" then
vstudio.vs2010_architectures.arm = "ARM"
+ vstudio.vs2010_architectures.arm64 = "ARM64"
else
vstudio.vs2010_architectures.android = "Android"
end
@@ -51,7 +52,7 @@
_p(2, "%s", cfg.project.name)
_p(2, "14.0")
_p(2, "Android")
- _p(2, "1.0")
+ _p(2, "%s", cfg.androidprojectversion or iif(_ACTION == "vs2017", "3.0", "1.0"))
end
--
@@ -84,30 +85,44 @@
function android.androidStlType(cfg)
if cfg.stl ~= nil then
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",
+ local static = {
+ ["none"] = nil,
+ ["minimal"] = "system",
+ ["c++"] = "gabi++_static",
+ ["stlport"] = "stlport_static",
+ ["gnu stl"] = "gnustl_static",
+ ["llvm libc++"] = "c++_static",
+ }
+ local dynamic = {
+ ["none"] = nil,
+ ["minimal"] = "system",
+ ["c++"] = "gabi++_shared",
+ ["stlport"] = "stlport_shared",
+ ["gnu stl"] = "gnustl_shared",
+ ["llvm libc++"] = "c++_shared",
}
- _p(2,'%s', stlType[cfg.stl])
+ local stl = iif(cfg.flags.StaticRuntime, static, dynamic);
+ _p(2,'%s', stl[cfg.stl])
else
local static = {
- none = "none",
- minimal = "system",
- ["stdc++"] = "gnustl_static",
- stlport = "stlport_static",
+ ["none"] = "none",
+ ["minimal"] = "system",
+ ["gnu stl"] = "gnustl_static",
+ ["stlport"] = "stlport_static",
+
+ -- Translate others to something else
+ ["c++"] = "gnustl_static",
+ ["llvm libc++"] = "gnustl_static",
}
local dynamic = {
- none = "none",
- minimal = "system",
- ["stdc++"] = "gnustl_dynamic",
- stlport = "stlport_dynamic",
+ ["none"] = "none",
+ ["minimal"] = "system",
+ ["gnu stl"] = "gnustl_dynamic",
+ ["stlport"] = "stlport_dynamic",
+
+ -- Translate others to something else
+ ["c++"] = "gnustl_dynamic",
+ ["llvm libc++"] = "gnustl_dynamic",
}
local stl = iif(cfg.flags.StaticRuntime, static, dynamic);
_p(2,'%s', stl[cfg.stl])
@@ -195,6 +210,7 @@
table.remove(elements, table.indexof(elements, vc2010.debugInformationFormat))
table.remove(elements, table.indexof(elements, android.thumbMode))
elements = table.join(elements, {
+ android.cStandard,
android.cppStandard,
})
end
@@ -234,9 +250,33 @@
-- end
end
+ function android.cStandard(cfg)
+ if cfg.cppdialect == "C89" then
+ _p(3, 'c89')
+ elseif cfg.cppdialect == "C99" then
+ _p(3, 'c99')
+ elseif cfg.cppdialect == "C11" then
+ _p(3, 'c11')
+ elseif cfg.cppdialect == "gnu99" then
+ _p(3, 'gnu99')
+ elseif cfg.cppdialect == "gnu11" then
+ _p(3, 'gnu11')
+ end
+ end
+
function android.cppStandard(cfg)
- if cfg.flags["C++11"] then
+ if cfg.cppdialect == "C++98" then
+ _p(3, 'c++98')
+ elseif cfg.cppdialect == "C++11" then
_p(3, 'c++11')
+ elseif cfg.cppdialect == "C++14" then
+ _p(3, 'c++1y')
+ elseif cfg.cppdialect == "gnu++98" then
+ _p(3, 'gnu++98')
+ elseif cfg.cppdialect == "gnu++11" then
+ _p(3, 'gnu++11')
+ elseif cfg.cppdialect == "gnu++14" then
+ _p(3, 'gnu++1y')
end
end