Initial community commit
This commit is contained in:
parent
537bcbc862
commit
fc06254474
16440 changed files with 4239995 additions and 2 deletions
27
Src/external_dependencies/openmpt-trunk/include/premake/modules/android/LICENSE.txt
vendored
Normal file
27
Src/external_dependencies/openmpt-trunk/include/premake/modules/android/LICENSE.txt
vendored
Normal file
|
@ -0,0 +1,27 @@
|
|||
Copyright (c) 2013-2015 Manu Evans and individual contributors.
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without modification,
|
||||
are permitted provided that the following conditions are met:
|
||||
|
||||
1. Redistributions of source code must retain the above copyright notice,
|
||||
this list of conditions and the following disclaimer.
|
||||
|
||||
2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
this list of conditions and the following disclaimer in the documentation
|
||||
and/or other materials provided with the distribution.
|
||||
|
||||
3. Neither the name of Premake nor the names of its contributors may be
|
||||
used to endorse or promote products derived from this software without
|
||||
specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
|
||||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
|
||||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
||||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
|
||||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
9
Src/external_dependencies/openmpt-trunk/include/premake/modules/android/README.md
vendored
Normal file
9
Src/external_dependencies/openmpt-trunk/include/premake/modules/android/README.md
vendored
Normal file
|
@ -0,0 +1,9 @@
|
|||
# Premake Extension to support Android NDK projects
|
||||
|
||||
Supported features:
|
||||
|
||||
* VisualStudio support through [vs-android](https://code.google.com/p/vs-android/)
|
||||
|
||||
Todo:
|
||||
|
||||
* gmake support
|
8
Src/external_dependencies/openmpt-trunk/include/premake/modules/android/_manifest.lua
vendored
Normal file
8
Src/external_dependencies/openmpt-trunk/include/premake/modules/android/_manifest.lua
vendored
Normal file
|
@ -0,0 +1,8 @@
|
|||
return {
|
||||
"_preload.lua",
|
||||
"android.lua",
|
||||
"vsandroid_vcxproj.lua",
|
||||
"vsandroid_sln2005.lua",
|
||||
"vsandroid_vstudio.lua",
|
||||
"vsandroid_androidproj.lua",
|
||||
}
|
104
Src/external_dependencies/openmpt-trunk/include/premake/modules/android/_preload.lua
vendored
Normal file
104
Src/external_dependencies/openmpt-trunk/include/premake/modules/android/_preload.lua
vendored
Normal file
|
@ -0,0 +1,104 @@
|
|||
--
|
||||
-- Name: android/_preload.lua
|
||||
-- Purpose: Define the Android API's.
|
||||
-- Author: Manu Evans
|
||||
-- Copyright: (c) 2013-2015 Manu Evans and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
local api = p.api
|
||||
|
||||
--
|
||||
-- Register the Android extension
|
||||
--
|
||||
|
||||
api.addAllowed("system", p.ANDROID)
|
||||
api.addAllowed("architecture", { "armv5", "armv7", "aarch64", "mips", "mips64", "arm" })
|
||||
api.addAllowed("vectorextensions", { "NEON", "MXU" })
|
||||
api.addAllowed("exceptionhandling", {"UnwindTables"})
|
||||
api.addAllowed("flags", { "Thumb" })
|
||||
api.addAllowed("kind", p.PACKAGING)
|
||||
|
||||
|
||||
premake.action._list["vs2015"].valid_kinds = table.join(premake.action._list["vs2015"].valid_kinds, { p.PACKAGING })
|
||||
premake.action._list["vs2017"].valid_kinds = table.join(premake.action._list["vs2017"].valid_kinds, { p.PACKAGING })
|
||||
premake.action._list["vs2019"].valid_kinds = table.join(premake.action._list["vs2019"].valid_kinds, { p.PACKAGING })
|
||||
|
||||
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
|
||||
--
|
||||
|
||||
api.register {
|
||||
name = "floatabi",
|
||||
scope = "config",
|
||||
kind = "string",
|
||||
allowed = {
|
||||
"soft",
|
||||
"softfp",
|
||||
"hard",
|
||||
},
|
||||
}
|
||||
|
||||
api.register {
|
||||
name = "androidapilevel",
|
||||
scope = "config",
|
||||
kind = "integer",
|
||||
}
|
||||
|
||||
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",
|
||||
"5.0",
|
||||
},
|
||||
}
|
||||
|
||||
api.register {
|
||||
name = "stl",
|
||||
scope = "config",
|
||||
kind = "string",
|
||||
allowed = {
|
||||
"none",
|
||||
"gabi++",
|
||||
"stlport",
|
||||
"gnu",
|
||||
"libc++",
|
||||
},
|
||||
}
|
||||
|
||||
api.register {
|
||||
name = "thumbmode",
|
||||
scope = "config",
|
||||
kind = "string",
|
||||
allowed = {
|
||||
"thumb",
|
||||
"arm",
|
||||
"disabled",
|
||||
},
|
||||
}
|
||||
|
||||
api.register {
|
||||
name = "androidapplibname",
|
||||
scope = "config",
|
||||
kind = "string"
|
||||
}
|
||||
|
||||
return function(cfg)
|
||||
return (cfg.system == p.ANDROID)
|
||||
end
|
25
Src/external_dependencies/openmpt-trunk/include/premake/modules/android/android.lua
vendored
Normal file
25
Src/external_dependencies/openmpt-trunk/include/premake/modules/android/android.lua
vendored
Normal file
|
@ -0,0 +1,25 @@
|
|||
|
||||
--
|
||||
-- Create an android namespace to isolate the additions
|
||||
--
|
||||
local p = premake
|
||||
|
||||
if not p.modules.android then
|
||||
require ("vstudio")
|
||||
p.modules.android = {}
|
||||
|
||||
if _ACTION < "vs2015" then
|
||||
configuration { "Android" }
|
||||
system "android"
|
||||
toolset "gcc"
|
||||
end
|
||||
|
||||
-- TODO: configure Android debug environment...
|
||||
|
||||
include("vsandroid_vcxproj.lua")
|
||||
include("vsandroid_sln2005.lua")
|
||||
include("vsandroid_vstudio.lua")
|
||||
include("vsandroid_androidproj.lua")
|
||||
end
|
||||
|
||||
return p.modules.android
|
6
Src/external_dependencies/openmpt-trunk/include/premake/modules/android/tests/_tests.lua
vendored
Normal file
6
Src/external_dependencies/openmpt-trunk/include/premake/modules/android/tests/_tests.lua
vendored
Normal file
|
@ -0,0 +1,6 @@
|
|||
require ("android")
|
||||
|
||||
return {
|
||||
"test_android_files.lua",
|
||||
"test_android_project.lua",
|
||||
}
|
|
@ -0,0 +1,47 @@
|
|||
local p = premake
|
||||
local suite = test.declare("test_android_files")
|
||||
local vc2010 = p.vstudio.vc2010
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2015")
|
||||
wks = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
prj = test.getproject(wks, 1)
|
||||
system "android"
|
||||
vc2010.files(prj)
|
||||
end
|
||||
|
||||
|
||||
--
|
||||
-- Test filtering of source files into the correct categories.
|
||||
--
|
||||
|
||||
function suite.none_onJavaFile()
|
||||
files { "hello.java" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<None Include="hello.java" />
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.javaCompile_onJavaFile()
|
||||
kind "Packaging"
|
||||
files { "hello.java" }
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ItemGroup>
|
||||
<JavaCompile Include="hello.java" />
|
||||
</ItemGroup>
|
||||
]]
|
||||
end
|
|
@ -0,0 +1,150 @@
|
|||
local p = premake
|
||||
local suite = test.declare("test_android_project")
|
||||
local vc2010 = p.vstudio.vc2010
|
||||
local android = p.modules.android
|
||||
|
||||
|
||||
--
|
||||
-- Setup
|
||||
--
|
||||
|
||||
local wks, prj
|
||||
|
||||
function suite.setup()
|
||||
p.action.set("vs2015")
|
||||
system "android"
|
||||
wks, prj = test.createWorkspace()
|
||||
end
|
||||
|
||||
local function prepare()
|
||||
local cfg = test.getconfig(prj, "Debug")
|
||||
vc2010.clCompile(cfg)
|
||||
end
|
||||
|
||||
local function prepareGlobals()
|
||||
prj = test.getproject(wks, 1)
|
||||
vc2010.globals(prj)
|
||||
end
|
||||
|
||||
function suite.minVisualStudioVersion_14()
|
||||
prepareGlobals()
|
||||
test.capture [[
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
|
||||
<Keyword>Android</Keyword>
|
||||
<RootNamespace>MyProject</RootNamespace>
|
||||
<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>
|
||||
<ApplicationType>Android</ApplicationType>
|
||||
<ApplicationTypeRevision>2.0</ApplicationTypeRevision>]]
|
||||
end
|
||||
|
||||
function suite.minVisualStudioVersion_15()
|
||||
p.action.set("vs2017")
|
||||
prepareGlobals()
|
||||
test.capture [[
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
|
||||
<LatestTargetPlatformVersion>$([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0'))</LatestTargetPlatformVersion>
|
||||
<Keyword>Android</Keyword>
|
||||
<RootNamespace>MyProject</RootNamespace>
|
||||
<MinimumVisualStudioVersion>15.0</MinimumVisualStudioVersion>
|
||||
<ApplicationType>Android</ApplicationType>
|
||||
<ApplicationTypeRevision>3.0</ApplicationTypeRevision>]]
|
||||
end
|
||||
|
||||
function suite.minVisualStudioVersion_16()
|
||||
p.action.set("vs2019")
|
||||
prepareGlobals()
|
||||
test.capture [[
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{42B5DBC6-AE1F-903D-F75D-41E363076E92}</ProjectGuid>
|
||||
<Keyword>Android</Keyword>
|
||||
<RootNamespace>MyProject</RootNamespace>
|
||||
<MinimumVisualStudioVersion>16.0</MinimumVisualStudioVersion>
|
||||
<ApplicationType>Android</ApplicationType>
|
||||
<ApplicationTypeRevision>3.0</ApplicationTypeRevision>]]
|
||||
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>
|
||||
</ClCompile>]]
|
||||
end
|
||||
|
||||
function suite.rttiOn()
|
||||
rtti "On"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<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>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.cppdialect_cpp11()
|
||||
cppdialect "C++11"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<CppLanguageStandard>c++11</CppLanguageStandard>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.cppdialect_cpp14()
|
||||
cppdialect "C++14"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<CppLanguageStandard>c++1y</CppLanguageStandard>
|
||||
]]
|
||||
end
|
||||
|
||||
function suite.cppdialect_cpp17()
|
||||
cppdialect "C++17"
|
||||
prepare()
|
||||
test.capture [[
|
||||
<ClCompile>
|
||||
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<CppLanguageStandard>c++1z</CppLanguageStandard>
|
||||
]]
|
||||
end
|
271
Src/external_dependencies/openmpt-trunk/include/premake/modules/android/vsandroid_androidproj.lua
vendored
Normal file
271
Src/external_dependencies/openmpt-trunk/include/premake/modules/android/vsandroid_androidproj.lua
vendored
Normal file
|
@ -0,0 +1,271 @@
|
|||
--
|
||||
-- android/vsandroid_androidproj.lua
|
||||
-- vs-android integration for vstudio.
|
||||
-- Copyright (c) 2012-2015 Manu Evans and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
|
||||
local android = p.modules.android
|
||||
local vsandroid = p.modules.vsandroid
|
||||
local vc2010 = p.vstudio.vc2010
|
||||
local vstudio = p.vstudio
|
||||
local project = p.project
|
||||
|
||||
|
||||
--
|
||||
-- Add android tools to vstudio actions.
|
||||
--
|
||||
|
||||
|
||||
premake.override(vstudio.vs2010, "generateProject", function(oldfn, prj)
|
||||
if prj.kind == p.PACKAGING then
|
||||
p.eol("\r\n")
|
||||
p.indent(" ")
|
||||
p.escaper(vstudio.vs2010.esc)
|
||||
|
||||
if project.iscpp(prj) then
|
||||
p.generate(prj, ".androidproj", vc2010.generate)
|
||||
|
||||
-- Skip generation of empty user files
|
||||
local user = p.capture(function() vc2010.generateUser(prj) end)
|
||||
if #user > 0 then
|
||||
p.generate(prj, ".androidproj.user", function() p.outln(user) end)
|
||||
end
|
||||
end
|
||||
else
|
||||
oldfn(prj)
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
premake.override(vstudio, "projectfile", function(oldfn, prj)
|
||||
if prj.kind == p.PACKAGING then
|
||||
return premake.filename(prj, ".androidproj")
|
||||
else
|
||||
return oldfn(prj)
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
premake.override(vstudio, "tool", function(oldfn, prj)
|
||||
if prj.kind == p.PACKAGING then
|
||||
return "39E2626F-3545-4960-A6E8-258AD8476CE5"
|
||||
else
|
||||
return oldfn(prj)
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
premake.override(vc2010.elements, "globals", function (oldfn, cfg)
|
||||
local elements = oldfn(cfg)
|
||||
|
||||
if cfg.kind == premake.PACKAGING then
|
||||
-- Remove "IgnoreWarnCompileDuplicatedFilename".
|
||||
local pos = table.indexof(elements, vc2010.ignoreWarnDuplicateFilename)
|
||||
table.remove(elements, pos)
|
||||
elements = table.join(elements, {
|
||||
android.projectVersion
|
||||
})
|
||||
end
|
||||
|
||||
return elements
|
||||
end)
|
||||
|
||||
|
||||
function android.projectVersion(cfg)
|
||||
_p(2, "<RootNamespace>%s</RootNamespace>", cfg.project.name)
|
||||
_p(2, "<MinimumVisualStudioVersion>14.0</MinimumVisualStudioVersion>")
|
||||
_p(2, "<ProjectVersion>1.0</ProjectVersion>")
|
||||
end
|
||||
|
||||
|
||||
premake.override(vc2010.elements, "configurationProperties", function(oldfn, cfg)
|
||||
local elements = oldfn(cfg)
|
||||
if cfg.kind == p.PACKAGING then
|
||||
elements = {
|
||||
android.androidAPILevel,
|
||||
vc2010.useDebugLibraries,
|
||||
}
|
||||
end
|
||||
return elements
|
||||
end)
|
||||
|
||||
|
||||
premake.override(vc2010.elements, "itemDefinitionGroup", function(oldfn, cfg)
|
||||
local elements = oldfn(cfg)
|
||||
if cfg.kind == p.PACKAGING then
|
||||
elements = {
|
||||
android.antPackage,
|
||||
}
|
||||
end
|
||||
return elements
|
||||
end)
|
||||
|
||||
|
||||
premake.override(vc2010, "importDefaultProps", function(oldfn, prj)
|
||||
if prj.kind == p.PACKAGING then
|
||||
p.w('<Import Project="$(AndroidTargetsPath)\\Android.Default.props" />')
|
||||
else
|
||||
oldfn(prj)
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
premake.override(vc2010, "importLanguageSettings", function(oldfn, prj)
|
||||
if prj.kind == p.PACKAGING then
|
||||
p.w('<Import Project="$(AndroidTargetsPath)\\Android.props" />')
|
||||
else
|
||||
oldfn(prj)
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
premake.override(vc2010, "propertySheets", function(oldfn, cfg)
|
||||
if cfg.kind ~= p.PACKAGING then
|
||||
oldfn(cfg)
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
premake.override(vc2010.elements, "outputProperties", function(oldfn, cfg)
|
||||
if cfg.kind == p.PACKAGING then
|
||||
return {
|
||||
android.outDir,
|
||||
vc2010.intDir,
|
||||
vc2010.targetName,
|
||||
}
|
||||
else
|
||||
return oldfn(cfg)
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
function android.outDir(cfg)
|
||||
vc2010.element("OutDir", nil, "%s\\", cfg.buildtarget.directory)
|
||||
end
|
||||
|
||||
|
||||
premake.override(vc2010, "importLanguageTargets", function(oldfn, prj)
|
||||
if prj.kind == p.PACKAGING then
|
||||
p.w('<Import Project="$(AndroidTargetsPath)\\Android.targets" />')
|
||||
else
|
||||
oldfn(prj)
|
||||
end
|
||||
end)
|
||||
|
||||
function android.link(cfg, file)
|
||||
-- default the seperator to '/' as that is what is searched for
|
||||
-- below. Otherwise the function will use target seperator which
|
||||
-- could be '\\' and result in failure to create links.
|
||||
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) or (file.vpath and file.vpath ~= file.relpath)
|
||||
|
||||
-- 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)
|
||||
vc2010.emitFiles(prj, group, "AndroidManifest", {vc2010.generatedFile, android.link, android.manifestSubType})
|
||||
end,
|
||||
|
||||
emitFilter = function(prj, group)
|
||||
vc2010.filterGroup(prj, group, "AndroidManifest")
|
||||
end
|
||||
}
|
||||
|
||||
function android.manifestSubType(cfg, file)
|
||||
vc2010.element("SubType", nil, "Designer")
|
||||
end
|
||||
|
||||
vc2010.categories.AntBuildXml = {
|
||||
name = "AntBuildXml",
|
||||
priority = 99,
|
||||
|
||||
emitFiles = function(prj, group)
|
||||
vc2010.emitFiles(prj, group, "AntBuildXml", {vc2010.generatedFile, android.link})
|
||||
end,
|
||||
|
||||
emitFilter = function(prj, group)
|
||||
vc2010.filterGroup(prj, group, "AntBuildXml")
|
||||
end
|
||||
}
|
||||
|
||||
vc2010.categories.AntProjectPropertiesFile = {
|
||||
name = "AntProjectPropertiesFile",
|
||||
priority = 99,
|
||||
|
||||
emitFiles = function(prj, group)
|
||||
vc2010.emitFiles(prj, group, "AntProjectPropertiesFile", {vc2010.generatedFile, android.link})
|
||||
end,
|
||||
|
||||
emitFilter = function(prj, group)
|
||||
vc2010.filterGroup(prj, group, "AntProjectPropertiesFile")
|
||||
end
|
||||
}
|
||||
|
||||
vc2010.categories.JavaCompile = {
|
||||
name = "JavaCompile",
|
||||
priority = 99,
|
||||
|
||||
emitFiles = function(prj, group)
|
||||
vc2010.emitFiles(prj, group, "JavaCompile", {vc2010.generatedFile, android.link})
|
||||
end,
|
||||
|
||||
emitFilter = function(prj, group)
|
||||
vc2010.filterGroup(prj, group, "JavaCompile")
|
||||
end
|
||||
}
|
||||
|
||||
vc2010.categories.Content = {
|
||||
name = "Content",
|
||||
priority = 99,
|
||||
|
||||
emitFiles = function(prj, group)
|
||||
vc2010.emitFiles(prj, group, "Content", {vc2010.generatedFile, android.link})
|
||||
end,
|
||||
|
||||
emitFilter = function(prj, group)
|
||||
vc2010.filterGroup(prj, group, "Content")
|
||||
end
|
||||
}
|
||||
|
||||
premake.override(vc2010, "categorizeFile", function(base, prj, file)
|
||||
if prj.kind ~= p.PACKAGING then
|
||||
return base(prj, file)
|
||||
end
|
||||
|
||||
local filename = path.getname(file.name):lower()
|
||||
local extension = path.getextension(filename)
|
||||
|
||||
if filename == "androidmanifest.xml" then
|
||||
return vc2010.categories.AndroidManifest
|
||||
elseif filename == "build.xml" then
|
||||
return vc2010.categories.AntBuildXml
|
||||
elseif filename == "project.properties" then
|
||||
return vc2010.categories.AntProjectPropertiesFile
|
||||
elseif extension == ".java" then
|
||||
return vc2010.categories.JavaCompile
|
||||
else
|
||||
return vc2010.categories.Content
|
||||
end
|
||||
end)
|
36
Src/external_dependencies/openmpt-trunk/include/premake/modules/android/vsandroid_sln2005.lua
vendored
Normal file
36
Src/external_dependencies/openmpt-trunk/include/premake/modules/android/vsandroid_sln2005.lua
vendored
Normal file
|
@ -0,0 +1,36 @@
|
|||
--
|
||||
-- android/vsandroid_sln2005.lua
|
||||
-- vs-android integration for vstudio.
|
||||
-- Copyright (c) 2012-2015 Manu Evans and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
|
||||
local android = p.modules.android
|
||||
local vsandroid = p.modules.vsandroid
|
||||
local sln2005 = p.vstudio.sln2005
|
||||
|
||||
|
||||
--
|
||||
-- Add android tools to vstudio actions.
|
||||
--
|
||||
|
||||
|
||||
premake.override(sln2005.elements, "projectConfigurationPlatforms", function(oldfn, cfg, context)
|
||||
local elements = oldfn(cfg, context)
|
||||
|
||||
if cfg.system == premake.ANDROID and _ACTION >= "vs2015" then
|
||||
elements = table.join(elements, {
|
||||
android.deployProject
|
||||
})
|
||||
end
|
||||
|
||||
return elements
|
||||
end)
|
||||
|
||||
|
||||
function android.deployProject(cfg, context)
|
||||
if context.prjCfg.kind == p.PACKAGING and _ACTION >= "vs2015" then
|
||||
p.w('{%s}.%s.Deploy.0 = %s|%s', context.prj.uuid, context.descriptor, context.platform, context.architecture)
|
||||
end
|
||||
end
|
642
Src/external_dependencies/openmpt-trunk/include/premake/modules/android/vsandroid_vcxproj.lua
vendored
Normal file
642
Src/external_dependencies/openmpt-trunk/include/premake/modules/android/vsandroid_vcxproj.lua
vendored
Normal file
|
@ -0,0 +1,642 @@
|
|||
--
|
||||
-- android/vsandroid_vcxproj.lua
|
||||
-- vs-android integration for vstudio.
|
||||
-- Copyright (c) 2012-2015 Manu Evans and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
|
||||
p.modules.vsandroid = { }
|
||||
|
||||
local android = p.modules.android
|
||||
local vsandroid = p.modules.vsandroid
|
||||
local vc2010 = p.vstudio.vc2010
|
||||
local vstudio = p.vstudio
|
||||
local project = p.project
|
||||
local config = p.config
|
||||
|
||||
|
||||
--
|
||||
-- Utility functions
|
||||
--
|
||||
local function setBoolOption(optionName, flag, value)
|
||||
if flag ~= nil then
|
||||
vc2010.element(optionName, nil, value)
|
||||
end
|
||||
end
|
||||
|
||||
--
|
||||
-- Add android tools to vstudio actions.
|
||||
--
|
||||
|
||||
if vstudio.vs2010_architectures ~= nil then
|
||||
if _ACTION >= "vs2015" then
|
||||
vstudio.vs2010_architectures.arm = "ARM"
|
||||
else
|
||||
vstudio.vs2010_architectures.android = "Android"
|
||||
end
|
||||
end
|
||||
|
||||
--
|
||||
-- Extend global properties
|
||||
--
|
||||
premake.override(vc2010.elements, "globals", function (oldfn, prj)
|
||||
local elements = oldfn(prj)
|
||||
|
||||
if prj.system == premake.ANDROID and prj.kind ~= premake.PACKAGING then
|
||||
-- Remove "IgnoreWarnCompileDuplicatedFilename".
|
||||
local pos = table.indexof(elements, vc2010.ignoreWarnDuplicateFilename)
|
||||
table.remove(elements, pos)
|
||||
elements = table.join(elements, {
|
||||
android.androidApplicationType
|
||||
})
|
||||
end
|
||||
|
||||
return elements
|
||||
end)
|
||||
|
||||
premake.override(vc2010.elements, "globalsCondition", function (oldfn, prj, cfg)
|
||||
local elements = oldfn(prj, cfg)
|
||||
|
||||
if cfg.system == premake.ANDROID and cfg.system ~= prj.system and cfg.kind ~= premake.PACKAGING then
|
||||
elements = table.join(elements, {
|
||||
android.androidApplicationType
|
||||
})
|
||||
end
|
||||
|
||||
return elements
|
||||
end)
|
||||
|
||||
function android.androidApplicationType(cfg)
|
||||
vc2010.element("Keyword", nil, "Android")
|
||||
vc2010.element("RootNamespace", nil, "%s", cfg.project.name)
|
||||
if _ACTION >= "vs2019" then
|
||||
vc2010.element("MinimumVisualStudioVersion", nil, "16.0")
|
||||
elseif _ACTION >= "vs2017" then
|
||||
vc2010.element("MinimumVisualStudioVersion", nil, "15.0")
|
||||
elseif _ACTION >= "vs2015" then
|
||||
vc2010.element("MinimumVisualStudioVersion", nil, "14.0")
|
||||
end
|
||||
vc2010.element("ApplicationType", nil, "Android")
|
||||
if _ACTION >= "vs2017" then
|
||||
vc2010.element("ApplicationTypeRevision", nil, "3.0")
|
||||
elseif _ACTION >= "vs2015" then
|
||||
vc2010.element("ApplicationTypeRevision", nil, "2.0")
|
||||
else
|
||||
vc2010.element("ApplicationTypeRevision", nil, "1.0")
|
||||
end
|
||||
end
|
||||
|
||||
--
|
||||
-- Extend configurationProperties.
|
||||
--
|
||||
|
||||
premake.override(vc2010.elements, "configurationProperties", function(oldfn, cfg)
|
||||
local elements = oldfn(cfg)
|
||||
|
||||
if cfg.kind ~= p.UTILITY and cfg.kind ~= p.PACKAGING and cfg.system == premake.ANDROID then
|
||||
table.remove(elements, table.indexof(elements, vc2010.characterSet))
|
||||
table.remove(elements, table.indexof(elements, vc2010.wholeProgramOptimization))
|
||||
table.remove(elements, table.indexof(elements, vc2010.windowsSDKDesktopARMSupport))
|
||||
|
||||
elements = table.join(elements, {
|
||||
android.androidAPILevel,
|
||||
android.androidStlType,
|
||||
})
|
||||
|
||||
if _ACTION >= "vs2015" then
|
||||
elements = table.join(elements, {
|
||||
android.thumbMode,
|
||||
})
|
||||
end
|
||||
end
|
||||
return elements
|
||||
end)
|
||||
|
||||
function android.androidAPILevel(cfg)
|
||||
if cfg.androidapilevel ~= nil then
|
||||
vc2010.element("AndroidAPILevel", nil, "android-" .. cfg.androidapilevel)
|
||||
end
|
||||
end
|
||||
|
||||
function android.androidStlType(cfg)
|
||||
if cfg.stl ~= nil then
|
||||
local stlType = {
|
||||
["none"] = "system",
|
||||
["gabi++"] = "gabi++",
|
||||
["stlport"] = "stlport",
|
||||
["gnu"] = "gnustl",
|
||||
["libc++"] = "c++",
|
||||
}
|
||||
|
||||
local postfix = iif(cfg.staticruntime == "On", "_static", "_shared")
|
||||
local runtimeLib = iif(cfg.stl == "none", "system", stlType[cfg.stl] .. postfix)
|
||||
|
||||
if _ACTION >= "vs2015" then
|
||||
vc2010.element("UseOfStl", nil, runtimeLib)
|
||||
else
|
||||
vc2010.element("AndroidStlType", nil, runtimeLib)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function android.thumbMode(cfg)
|
||||
if cfg.thumbmode ~= nil then
|
||||
local thumbMode =
|
||||
{
|
||||
thumb = "Thumb",
|
||||
arm = "ARM",
|
||||
disabled = "Disabled",
|
||||
}
|
||||
vc2010.element("ThumbMode", nil, thumbMode[cfg.thumbmode])
|
||||
end
|
||||
end
|
||||
|
||||
-- Note: this function is already patched in by vs2012...
|
||||
premake.override(vc2010, "platformToolset", function(oldfn, cfg)
|
||||
if cfg.system ~= premake.ANDROID then
|
||||
return oldfn(cfg)
|
||||
end
|
||||
|
||||
if _ACTION >= "vs2015" then
|
||||
local gcc_map = {
|
||||
["4.6"] = "GCC_4_6",
|
||||
["4.8"] = "GCC_4_8",
|
||||
["4.9"] = "GCC_4_9",
|
||||
}
|
||||
local clang_map = {
|
||||
["3.4"] = "Clang_3_4",
|
||||
["3.5"] = "Clang_3_5",
|
||||
["3.6"] = "Clang_3_6",
|
||||
["3.8"] = "Clang_3_8",
|
||||
["5.0"] = "Clang_5_0",
|
||||
}
|
||||
|
||||
if cfg.toolchainversion ~= nil then
|
||||
local map = iif(cfg.toolset == "gcc", gcc_map, clang_map)
|
||||
local ts = map[cfg.toolchainversion]
|
||||
if ts == nil then
|
||||
p.error('Invalid toolchainversion for the selected toolset (%s).', cfg.toolset or "clang")
|
||||
end
|
||||
|
||||
vc2010.element("PlatformToolset", nil, ts)
|
||||
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.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")
|
||||
|
||||
vc2010.element("PlatformToolset", nil, toolset .. version)
|
||||
vc2010.element("AndroidArch", nil, archMap[arch])
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
--
|
||||
-- Extend clCompile.
|
||||
--
|
||||
|
||||
premake.override(vc2010.elements, "clCompile", function(oldfn, cfg)
|
||||
local elements = oldfn(cfg)
|
||||
if cfg.system == premake.ANDROID then
|
||||
elements = table.join(elements, {
|
||||
android.debugInformation,
|
||||
android.strictAliasing,
|
||||
android.fpu,
|
||||
android.pic,
|
||||
android.shortEnums,
|
||||
android.cStandard,
|
||||
android.cppStandard,
|
||||
})
|
||||
if _ACTION >= "vs2015" then
|
||||
table.remove(elements, table.indexof(elements, vc2010.debugInformationFormat))
|
||||
|
||||
-- Android has C[pp]LanguageStandard instead.
|
||||
table.remove(elements, table.indexof(elements, vc2010.languageStandard))
|
||||
-- Ignore multiProcessorCompilation for android projects, they use UseMultiToolTask instead.
|
||||
table.remove(elements, table.indexof(elements, vc2010.multiProcessorCompilation))
|
||||
-- minimalRebuild also ends up in android projects somehow.
|
||||
table.remove(elements, table.indexof(elements, vc2010.minimalRebuild))
|
||||
|
||||
-- VS has NEON support through EnableNeonCodegen.
|
||||
table.replace(elements, vc2010.enableEnhancedInstructionSet, android.enableEnhancedInstructionSet)
|
||||
-- precompiledHeaderFile support.
|
||||
table.replace(elements, vc2010.precompiledHeaderFile, android.precompiledHeaderFile)
|
||||
end
|
||||
end
|
||||
return elements
|
||||
end)
|
||||
|
||||
function android.precompiledHeaderFile(fileName, cfg)
|
||||
-- Doesn't work for project-relative paths.
|
||||
vc2010.element("PrecompiledHeaderFile", nil, "%s", path.getabsolute(path.rebase(fileName, cfg.basedir, cfg.location)))
|
||||
end
|
||||
|
||||
function android.debugInformation(cfg)
|
||||
if cfg.flags.Symbols then
|
||||
_p(3,'<GenerateDebugInformation>true</GenerateDebugInformation>')
|
||||
end
|
||||
end
|
||||
|
||||
function android.strictAliasing(cfg)
|
||||
if cfg.strictaliasing ~= nil then
|
||||
vc2010.element("StrictAliasing", nil, iif(cfg.strictaliasing == "Off", "false", "true"))
|
||||
end
|
||||
end
|
||||
|
||||
function android.fpu(cfg)
|
||||
if cfg.fpu ~= nil then
|
||||
_p(3,'<SoftFloat>true</SoftFloat>', iif(cfg.fpu == "Software", "true", "false"))
|
||||
end
|
||||
end
|
||||
|
||||
function android.pic(cfg)
|
||||
if cfg.pic ~= nil then
|
||||
vc2010.element("PositionIndependentCode", nil, iif(cfg.pic == "On", "true", "false"))
|
||||
end
|
||||
end
|
||||
|
||||
function android.verboseCompiler(cfg)
|
||||
setBoolOption("Verbose", cfg.flags.VerboseCompiler, "true")
|
||||
end
|
||||
|
||||
function android.undefineAllPreprocessorDefinitions(cfg)
|
||||
setBoolOption("UndefineAllPreprocessorDefinitions", cfg.flags.UndefineAllPreprocessorDefinitions, "true")
|
||||
end
|
||||
|
||||
function android.showIncludes(cfg)
|
||||
setBoolOption("ShowIncludes", cfg.flags.ShowIncludes, "true")
|
||||
end
|
||||
|
||||
function android.dataLevelLinking(cfg)
|
||||
setBoolOption("DataLevelLinking", cfg.flags.DataLevelLinking, "true")
|
||||
end
|
||||
|
||||
function android.shortEnums(cfg)
|
||||
setBoolOption("UseShortEnums", cfg.flags.UseShortEnums, "true")
|
||||
end
|
||||
|
||||
function android.cStandard(cfg)
|
||||
local c_langmap = {
|
||||
["C98"] = "c98",
|
||||
["C99"] = "c99",
|
||||
["C11"] = "c11",
|
||||
["gnu99"] = "gnu99",
|
||||
["gnu11"] = "gnu11",
|
||||
}
|
||||
if c_langmap[cfg.cdialect] ~= nil then
|
||||
vc2010.element("CLanguageStandard", nil, c_langmap[cfg.cdialect])
|
||||
end
|
||||
end
|
||||
|
||||
function android.cppStandard(cfg)
|
||||
local cpp_langmap = {
|
||||
["C++98"] = "c++98",
|
||||
["C++11"] = "c++11",
|
||||
["C++14"] = "c++1y",
|
||||
["C++17"] = "c++1z",
|
||||
["C++latest"] = "c++1z",
|
||||
["gnu++98"] = "gnu++98",
|
||||
["gnu++11"] = "gnu++11",
|
||||
["gnu++14"] = "gnu++1y",
|
||||
["gnu++17"] = "gnu++1z",
|
||||
}
|
||||
if cpp_langmap[cfg.cppdialect] ~= nil then
|
||||
vc2010.element("CppLanguageStandard", nil, cpp_langmap[cfg.cppdialect])
|
||||
end
|
||||
end
|
||||
|
||||
p.override(vc2010, "additionalCompileOptions", function(oldfn, cfg, condition)
|
||||
if cfg.system == p.ANDROID then
|
||||
local opts = cfg.buildoptions
|
||||
|
||||
if cfg.disablewarnings and #cfg.disablewarnings > 0 then
|
||||
for _, warning in ipairs(cfg.disablewarnings) do
|
||||
table.insert(opts, '-Wno-' .. warning)
|
||||
end
|
||||
end
|
||||
|
||||
-- -fvisibility=<>
|
||||
if cfg.visibility ~= nil then
|
||||
table.insert(opts, p.tools.gcc.cxxflags.visibility[cfg.visibility])
|
||||
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(vc2010, "warningLevel", function(oldfn, cfg)
|
||||
if _ACTION >= "vs2015" and cfg.system == p.ANDROID and cfg.warnings and cfg.warnings ~= "Off" then
|
||||
vc2010.element("WarningLevel", nil, "EnableAllWarnings")
|
||||
elseif (_ACTION >= "vs2015" and cfg.system == p.ANDROID and cfg.warnings) or not (_ACTION >= "vs2015" and cfg.system == p.ANDROID) then
|
||||
oldfn(cfg)
|
||||
end
|
||||
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, condition)
|
||||
end
|
||||
end)
|
||||
|
||||
premake.override(vc2010, "exceptionHandling", function(oldfn, cfg, condition)
|
||||
if cfg.system == p.ANDROID then
|
||||
-- Note: Android defaults to 'off'
|
||||
local exceptions = {
|
||||
On = "Enabled",
|
||||
Off = "Disabled",
|
||||
UnwindTables = "UnwindTables",
|
||||
}
|
||||
if _ACTION >= "vs2015" then
|
||||
if exceptions[cfg.exceptionhandling] ~= nil then
|
||||
vc2010.element("ExceptionHandling", condition, exceptions[cfg.exceptionhandling])
|
||||
end
|
||||
else
|
||||
if cfg.exceptionhandling == premake.ON then
|
||||
vc2010.element("GccExceptionHandling", condition, "true")
|
||||
end
|
||||
end
|
||||
else
|
||||
oldfn(cfg, condition)
|
||||
end
|
||||
end)
|
||||
|
||||
function android.enableEnhancedInstructionSet(cfg)
|
||||
if cfg.vectorextensions == "NEON" then
|
||||
vc2010.element("EnableNeonCodegen", nil, "true")
|
||||
end
|
||||
end
|
||||
|
||||
premake.override(vc2010, "runtimeTypeInfo", function(oldfn, cfg, condition)
|
||||
if cfg.system == premake.ANDROID then
|
||||
-- Note: Android defaults to 'off'
|
||||
if cfg.rtti == premake.ON then
|
||||
vc2010.element("RuntimeTypeInfo", condition, "true")
|
||||
end
|
||||
else
|
||||
oldfn(cfg, condition)
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
--
|
||||
-- Extend Link.
|
||||
--
|
||||
|
||||
premake.override(vc2010, "generateDebugInformation", function(oldfn, cfg)
|
||||
-- Note: Android specifies the debug info in the clCompile section
|
||||
if cfg.system ~= premake.ANDROID then
|
||||
oldfn(cfg)
|
||||
end
|
||||
end)
|
||||
|
||||
|
||||
--
|
||||
-- Add android tools to vstudio actions.
|
||||
--
|
||||
|
||||
premake.override(vc2010.elements, "itemDefinitionGroup", function(oldfn, cfg)
|
||||
local elements = oldfn(cfg)
|
||||
if cfg.system == premake.ANDROID and _ACTION < "vs2015" then
|
||||
elements = table.join(elements, {
|
||||
android.antBuild,
|
||||
})
|
||||
end
|
||||
return elements
|
||||
end)
|
||||
|
||||
function android.antPackage(cfg)
|
||||
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)
|
||||
if cfg.kind == premake.STATICLIB or cfg.kind == premake.SHAREDLIB then
|
||||
return
|
||||
end
|
||||
|
||||
_p(2,'<AntBuild>')
|
||||
_p(3,'<AntBuildType>%s</AntBuildType>', iif(premake.config.isDebugBuild(cfg), "Debug", "Release"))
|
||||
_p(2,'</AntBuild>')
|
||||
end
|
||||
|
||||
premake.override(vc2010, "additionalCompileOptions", function(oldfn, cfg, condition)
|
||||
if cfg.system == premake.ANDROID then
|
||||
vsandroid.additionalOptions(cfg, condition)
|
||||
end
|
||||
return oldfn(cfg, condition)
|
||||
end)
|
||||
|
||||
premake.override(vc2010.elements, "user", function(oldfn, cfg)
|
||||
if cfg.system == p.ANDROID then
|
||||
return {}
|
||||
else
|
||||
return oldfn(cfg)
|
||||
end
|
||||
end)
|
||||
|
||||
--
|
||||
-- Add options unsupported by vs-android UI to <AdvancedOptions>.
|
||||
--
|
||||
function vsandroid.additionalOptions(cfg)
|
||||
if _ACTION >= "vs2015" then
|
||||
|
||||
else
|
||||
local function alreadyHas(t, key)
|
||||
for _, k in ipairs(t) do
|
||||
if string.find(k, key) then
|
||||
return true
|
||||
end
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
if not cfg.architecture or string.startswith(cfg.architecture, "arm") then
|
||||
-- we might want to define the arch to generate better code
|
||||
-- if not alreadyHas(cfg.buildoptions, "-march=") then
|
||||
-- if cfg.architecture == "armv6" then
|
||||
-- table.insert(cfg.buildoptions, "-march=armv6")
|
||||
-- elseif cfg.architecture == "armv7" then
|
||||
-- table.insert(cfg.buildoptions, "-march=armv7")
|
||||
-- end
|
||||
-- end
|
||||
|
||||
-- ARM has a comprehensive set of floating point options
|
||||
if cfg.fpu ~= "Software" and cfg.floatabi ~= "soft" then
|
||||
|
||||
if cfg.architecture == "armv7" then
|
||||
|
||||
-- armv7 always has VFP, may not have NEON
|
||||
|
||||
if not alreadyHas(cfg.buildoptions, "-mfpu=") then
|
||||
if cfg.vectorextensions == "NEON" then
|
||||
table.insert(cfg.buildoptions, "-mfpu=neon")
|
||||
elseif cfg.fpu == "Hardware" or cfg.floatabi == "softfp" or cfg.floatabi == "hard" then
|
||||
table.insert(cfg.buildoptions, "-mfpu=vfpv3-d16") -- d16 is the lowest common denominator
|
||||
end
|
||||
end
|
||||
|
||||
if not alreadyHas(cfg.buildoptions, "-mfloat-abi=") then
|
||||
if cfg.floatabi == "hard" then
|
||||
table.insert(cfg.buildoptions, "-mfloat-abi=hard")
|
||||
else
|
||||
-- Android should probably use softfp by default for compatibility
|
||||
table.insert(cfg.buildoptions, "-mfloat-abi=softfp")
|
||||
end
|
||||
end
|
||||
|
||||
else
|
||||
|
||||
-- armv5/6 may not have VFP
|
||||
|
||||
if not alreadyHas(cfg.buildoptions, "-mfpu=") then
|
||||
if cfg.fpu == "Hardware" or cfg.floatabi == "softfp" or cfg.floatabi == "hard" then
|
||||
table.insert(cfg.buildoptions, "-mfpu=vfp")
|
||||
end
|
||||
end
|
||||
|
||||
if not alreadyHas(cfg.buildoptions, "-mfloat-abi=") then
|
||||
if cfg.floatabi == "softfp" then
|
||||
table.insert(cfg.buildoptions, "-mfloat-abi=softfp")
|
||||
elseif cfg.floatabi == "hard" then
|
||||
table.insert(cfg.buildoptions, "-mfloat-abi=hard")
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
elseif cfg.floatabi == "soft" then
|
||||
|
||||
table.insert(cfg.buildoptions, "-mfloat-abi=soft")
|
||||
|
||||
end
|
||||
|
||||
if cfg.endian == "Little" then
|
||||
table.insert(cfg.buildoptions, "-mlittle-endian")
|
||||
elseif cfg.endian == "Big" then
|
||||
table.insert(cfg.buildoptions, "-mbig-endian")
|
||||
end
|
||||
|
||||
elseif cfg.architecture == "mips" then
|
||||
|
||||
-- TODO...
|
||||
|
||||
if cfg.vectorextensions == "MXU" then
|
||||
table.insert(cfg.buildoptions, "-mmxu")
|
||||
end
|
||||
|
||||
elseif cfg.architecture == "x86" then
|
||||
|
||||
-- TODO...
|
||||
|
||||
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)
|
||||
|
||||
function android.useMultiToolTask(cfg)
|
||||
-- Android equivalent of 'MultiProcessorCompilation'
|
||||
if cfg.flags.MultiProcessorCompile then
|
||||
vc2010.element("UseMultiToolTask", nil, "true")
|
||||
end
|
||||
end
|
||||
|
||||
premake.override(vc2010.elements, "outputProperties", function(oldfn, cfg)
|
||||
if cfg.system == p.ANDROID then
|
||||
return table.join(oldfn(cfg), {
|
||||
android.useMultiToolTask,
|
||||
})
|
||||
else
|
||||
return oldfn(cfg)
|
||||
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)
|
38
Src/external_dependencies/openmpt-trunk/include/premake/modules/android/vsandroid_vstudio.lua
vendored
Normal file
38
Src/external_dependencies/openmpt-trunk/include/premake/modules/android/vsandroid_vstudio.lua
vendored
Normal file
|
@ -0,0 +1,38 @@
|
|||
--
|
||||
-- android/vsandroid_vstudio.lua
|
||||
-- vs-android integration for vstudio.
|
||||
-- Copyright (c) 2012-2015 Manu Evans and the Premake project
|
||||
--
|
||||
|
||||
local p = premake
|
||||
|
||||
local android = p.modules.android
|
||||
local vsandroid = p.modules.vsandroid
|
||||
local vstudio = p.vstudio
|
||||
|
||||
--
|
||||
-- Add android tools to vstudio actions.
|
||||
--
|
||||
|
||||
|
||||
premake.override(vstudio, "solutionPlatform", function (oldfn, cfg)
|
||||
local platform = oldfn(cfg)
|
||||
|
||||
-- Bypass that pesky Win32 hack
|
||||
if cfg.system == premake.ANDROID and _ACTION >= "vs2015" then
|
||||
if cfg.platform == "x86" then
|
||||
platform = "x86"
|
||||
end
|
||||
end
|
||||
|
||||
return platform
|
||||
end)
|
||||
|
||||
|
||||
premake.override(vstudio, "archFromConfig", function (oldfn, cfg, win32)
|
||||
-- Bypass that pesky Win32 hack by not passing win32 down
|
||||
if cfg.system == premake.ANDROID and _ACTION >= "vs2015" then
|
||||
return oldfn(cfg)
|
||||
end
|
||||
return oldfn(cfg, win32)
|
||||
end)
|
Loading…
Add table
Add a link
Reference in a new issue