Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add 'modules/android/' from premake-android #1034

Merged
merged 35 commits into from
Apr 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
8753128
Android extension WIP
TurkeyMan Oct 30, 2013
f29058d
Update description
TurkeyMan Oct 30, 2013
d3069fb
Added support for androidapilevel.
TurkeyMan Oct 31, 2013
22d0b2c
Various fixes
TurkeyMan Nov 5, 2013
ac8358c
Re-factored for new module layout.
TurkeyMan Mar 29, 2015
9c5dd76
Moved some shared logic to vs-tool.
TurkeyMan Apr 13, 2015
7d499b8
Added very basic vs2015 support
samsinsane Oct 15, 2015
ad66bbe
Added LICENSE.txt
TurkeyMan Dec 1, 2015
09275aa
Updated to latest Premake and fixed some issues.
samsinsane Nov 15, 2016
1426fb0
Fixed output directory for androidproj projects, requires absolute pa…
samsinsane Nov 25, 2016
e146dd4
Merge pull request #1 from LORgames/ssurtees/vs2015
TurkeyMan Feb 28, 2017
568a84b
Update to current conventions (#1)
pdoane-blizzard Jul 5, 2017
109f247
Add VS2017 support (#2)
pdoane-blizzard Jul 5, 2017
02e0e97
Fix linker issues (#3)
pdoane-blizzard Jul 5, 2017
f7605c2
Update RTTI override (#4)
pdoane-blizzard Jul 5, 2017
c30b1cd
Start of test cases (#5)
pdoane-blizzard Jul 5, 2017
aacdaac
Update Clang version for VS2015 (#6)
pdoane-blizzard Jul 10, 2017
091794f
Fix ApplicationTypeRevision for VS2015 (#7)
pdoane-blizzard Jul 10, 2017
dc3da06
Add configuration for AndroidAppLibName (#8)
pdoane-blizzard Jul 10, 2017
c1a247b
Disable override of OutDir to fix deployment (#9)
pdoane-blizzard Jul 11, 2017
92e512a
Add cppdialect support
pdoane-blizzard Jul 25, 2017
28305cc
Remove extra nil checks
pdoane-blizzard Jul 25, 2017
71c64b2
Merge pull request #10 from premake/cppdialect
Jul 25, 2017
ca9453c
Fix exception handling (#11)
pdoane-blizzard Jul 25, 2017
cc3b49f
Fix insertion of allows "os" options.
Jul 31, 2017
ab6cd20
add tags for android system.
Aug 4, 2017
4060958
os is reserved name :(
Aug 4, 2017
9ef5bfa
argument is the project, not a config.
Aug 8, 2017
d3ee9a4
fix nil dereference in _preload.lua, also unify some options.
Aug 10, 2017
c863674
flip default to clang and deal with platformToolset better.
Aug 29, 2017
0b479a5
Add linking support for externally referenced files.
Nov 1, 2017
ed6f8a4
Merge pull request #12 from premake/linking
Nov 1, 2017
4ef3fff
Fix for external files when using absolute paths on windows.
Nov 14, 2017
9b1a692
Merge pull request #3 from Blizzard/master
samsinsane Dec 8, 2017
f7626d4
Add 'modules/android/' from premake-android
samsinsane Apr 5, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions modules/android/LICENSE.txt
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.
9 changes: 9 additions & 0 deletions modules/android/README.md
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
8 changes: 8 additions & 0 deletions modules/android/_manifest.lua
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",
}
108 changes: 108 additions & 0 deletions modules/android/_preload.lua
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
25 changes: 25 additions & 0 deletions modules/android/android.lua
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
5 changes: 5 additions & 0 deletions modules/android/tests/_tests.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
require ("android")

return {
"test_android_project.lua"
}
114 changes: 114 additions & 0 deletions modules/android/tests/test_android_project.lua
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
Loading