-
-
Notifications
You must be signed in to change notification settings - Fork 621
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1034 from LORgames/ssurtees/android
Add 'modules/android/' from premake-android
- Loading branch information
Showing
12 changed files
with
1,157 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
return { | ||
"_preload.lua", | ||
"android.lua", | ||
"vsandroid_vcxproj.lua", | ||
"vsandroid_sln2005.lua", | ||
"vsandroid_vstudio.lua", | ||
"vsandroid_androidproj.lua", | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
-- | ||
-- 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 | ||
-- | ||
|
||
p.ANDROID = "android" | ||
p.ANDROIDPROJ = "androidproj" | ||
|
||
api.addAllowed("system", p.ANDROID) | ||
api.addAllowed("architecture", { "armv5", "armv7", "aarach64", "mips", "mips64", "arm" }) | ||
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 }) | ||
|
||
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", | ||
}, | ||
} | ||
|
||
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", | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
require ("android") | ||
|
||
return { | ||
"test_android_project.lua" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
Oops, something went wrong.