This repository was archived by the owner on Apr 19, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathcommon.lua
More file actions
59 lines (51 loc) · 1.44 KB
/
Copy pathcommon.lua
File metadata and controls
59 lines (51 loc) · 1.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
--
-- common.lua
-- Android exporter module for Premake - support code.
-- Copyright (c) 2014 Will Vale and the Premake project
--
local ndk = premake.modules.ndk
local project = premake.project
-- Constants
ndk.ANDROID = 'android'
ndk.JNI = 'jni'
ndk.MAKEFILE = 'Android.mk'
ndk.APPMAKEFILE = 'Application.mk'
ndk.MANIFEST = 'AndroidManifest.xml'
ndk.GLES31 = 'GLESv31'
ndk.GLES30 = 'GLESv3'
ndk.GLES20 = 'GLESv2'
ndk.GLES10 = 'GLESv1_CM'
ndk.JAVA = '.java'
-- Need to put makefiles in subdirectories by project configuration
function ndk.getProjectPath(this, cfg)
-- e.g. c:/root/myconfig/myproject
return path.join(this.location)--, cfg.buildcfg, this.name)
end
-- Is the given project valid for NDK builds?
function ndk.isValidProject(prj)
-- Console apps don't make sense
if prj.kind == premake.CONSOLEAPP then
return false
end
-- Otherwise valid if it contains a C or C++ file (under Visual Studio it's convenient to have non-compiling projects sometimes)
for cfg in project.eachconfig(prj) do
for _,f in ipairs(cfg.files) do
if path.iscppfile(f) or path.iscfile(f) then
return true
end
end
end
-- Otherwise invalid
return false
end
-- Extract API level from framework
function ndk.getApiLevel(cfg)
if cfg.framework then
local version, count = cfg.framework:gsub('android%-', '')
if count == 1 then
return tonumber(version)
end
end
-- Unknown API level
return 1
end