summaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
author Jeffrey Clark <h0tw1r3@users.noreply.github.com>2016-06-05 10:56:48 -0500
committer Jeffrey Clark <h0tw1r3@users.noreply.github.com>2016-06-05 22:24:25 -0500
commitbbda9d38b77c4171537c689b8b67151e3abfc138 (patch)
tree5aba8d2bd552a143d93844681c0607c888257a50
parent233949423adec60061245b739d7391cac8a64782 (diff)
android: 64bit strip, platform version support (nw)
cleanup make targets and configuration rules fix android_ndk_root env test
-rw-r--r--makefile79
-rw-r--r--scripts/toolchain.lua114
2 files changed, 48 insertions, 145 deletions
diff --git a/makefile b/makefile
index bd0f334876b..ca2b88c8495 100644
--- a/makefile
+++ b/makefile
@@ -1044,26 +1044,30 @@ ifdef FASTBUILD
endif
#-------------------------------------------------
+# android-ndk
+#-------------------------------------------------
+
+.PHONY: android-ndk
+android-ndk:
+ifndef ANDROID_NDK_LLVM
+ $(error ANDROID_NDK_LLVM is not set)
+endif
+ifndef ANDROID_NDK_ROOT
+ $(error ANDROID_NDK_ROOT is not set)
+endif
+
+#-------------------------------------------------
# android-arm
#-------------------------------------------------
-$(PROJECTDIR_SDL)/gmake-android-arm/Makefile: makefile $(SCRIPTS) $(GENIE)
+$(PROJECTDIR_SDL)/gmake-android-arm/Makefile: makefile android-ndk $(SCRIPTS) $(GENIE)
ifndef ANDROID_NDK_ARM
$(error ANDROID_NDK_ARM is not set)
endif
-ifndef ANDROID_NDK_LLVM
- $(error ANDROID_NDK_LLVM is not set)
-endif
$(SILENT) $(GENIE) $(PARAMS) --gcc=android-arm --gcc_version=3.8.0 --osd=sdl --targetos=android --PLATFORM=arm --NO_USE_MIDI=1 --NO_OPENGL=1 --USE_QTDEBUG=0 --NO_X11=1 --DONT_USE_NETWORK=1 --NOASM=1 gmake
.PHONY: android-arm
android-arm: generate $(PROJECTDIR_SDL)/gmake-android-arm/Makefile
-ifndef ANDROID_NDK_ARM
- $(error ANDROID_NDK_ARM is not set)
-endif
-ifndef ANDROID_NDK_LLVM
- $(error ANDROID_NDK_LLVM is not set)
-endif
$(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR_SDL)/gmake-android-arm config=$(CONFIG) precompile
$(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR_SDL)/gmake-android-arm config=$(CONFIG)
@@ -1071,23 +1075,14 @@ endif
# android-arm64
#-------------------------------------------------
-$(PROJECTDIR_SDL)/gmake-android-arm64/Makefile: makefile $(SCRIPTS) $(GENIE)
+$(PROJECTDIR_SDL)/gmake-android-arm64/Makefile: makefile android-ndk $(SCRIPTS) $(GENIE)
ifndef ANDROID_NDK_ARM64
$(error ANDROID_NDK_ARM64 is not set)
endif
-ifndef ANDROID_NDK_LLVM
- $(error ANDROID_NDK_LLVM is not set)
-endif
$(SILENT) $(GENIE) $(PARAMS) --gcc=android-arm64 --gcc_version=3.8.0 --osd=sdl --targetos=android --PLATFORM=arm64 --NO_USE_MIDI=1 --NO_OPENGL=1 --USE_QTDEBUG=0 --NO_X11=1 --DONT_USE_NETWORK=1 --NOASM=1 gmake
.PHONY: android-arm64
android-arm64: generate $(PROJECTDIR_SDL)/gmake-android-arm64/Makefile
-ifndef ANDROID_NDK_ARM64
- $(error ANDROID_NDK_ARM64 is not set)
-endif
-ifndef ANDROID_NDK_LLVM
- $(error ANDROID_NDK_LLVM is not set)
-endif
$(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR_SDL)/gmake-android-arm64 config=$(CONFIG) precompile
$(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR_SDL)/gmake-android-arm64 config=$(CONFIG)
@@ -1095,23 +1090,14 @@ endif
# android-mips
#-------------------------------------------------
-$(PROJECTDIR_SDL)/gmake-android-mips/Makefile: makefile $(SCRIPTS) $(GENIE)
+$(PROJECTDIR_SDL)/gmake-android-mips/Makefile: makefile android-ndk $(SCRIPTS) $(GENIE)
ifndef ANDROID_NDK_MIPS
$(error ANDROID_NDK_MIPS is not set)
endif
-ifndef ANDROID_NDK_LLVM
- $(error ANDROID_NDK_LLVM is not set)
-endif
$(SILENT) $(GENIE) $(PARAMS) --gcc=android-mips --gcc_version=3.8.0 --osd=sdl --targetos=android --PLATFORM=mips --NO_USE_MIDI=1 --NO_OPENGL=1 --USE_QTDEBUG=0 --NO_X11=1 --DONT_USE_NETWORK=1 --NOASM=1 gmake
.PHONY: android-mips
android-mips: generate $(PROJECTDIR_SDL)/gmake-android-mips/Makefile
-ifndef ANDROID_NDK_MIPS
- $(error ANDROID_NDK_MIPS is not set)
-endif
-ifndef ANDROID_NDK_LLVM
- $(error ANDROID_NDK_LLVM is not set)
-endif
$(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR_SDL)/gmake-android-mips config=$(CONFIG) precompile
$(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR_SDL)/gmake-android-mips config=$(CONFIG)
@@ -1119,23 +1105,14 @@ endif
# android-mips64
#-------------------------------------------------
-$(PROJECTDIR_SDL)/gmake-android-mips64/Makefile: makefile $(SCRIPTS) $(GENIE)
+$(PROJECTDIR_SDL)/gmake-android-mips64/Makefile: makefile android-ndk $(SCRIPTS) $(GENIE)
ifndef ANDROID_NDK_MIPS64
$(error ANDROID_NDK_MIPS64 is not set)
endif
-ifndef ANDROID_NDK_LLVM
- $(error ANDROID_NDK_LLVM is not set)
-endif
$(SILENT) $(GENIE) $(PARAMS) --gcc=android-mips64 --gcc_version=3.8.0 --osd=sdl --targetos=android --PLATFORM=mips64 --NO_USE_MIDI=1 --NO_OPENGL=1 --USE_QTDEBUG=0 --NO_X11=1 --DONT_USE_NETWORK=1 --NOASM=1 gmake
.PHONY: android-mips64
android-mips64: generate $(PROJECTDIR_SDL)/gmake-android-mips64/Makefile
-ifndef ANDROID_NDK_MIPS64
- $(error ANDROID_NDK_MIPS64 is not set)
-endif
-ifndef ANDROID_NDK_LLVM
- $(error ANDROID_NDK_LLVM is not set)
-endif
$(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR_SDL)/gmake-android-mips64 config=$(CONFIG) precompile
$(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR_SDL)/gmake-android-mips64 config=$(CONFIG)
@@ -1143,23 +1120,14 @@ endif
# android-x86
#-------------------------------------------------
-$(PROJECTDIR_SDL)/gmake-android-x86/Makefile: makefile $(SCRIPTS) $(GENIE)
+$(PROJECTDIR_SDL)/gmake-android-x86/Makefile: makefile android-ndk $(SCRIPTS) $(GENIE)
ifndef ANDROID_NDK_X86
$(error ANDROID_NDK_X86 is not set)
endif
-ifndef ANDROID_NDK_LLVM
- $(error ANDROID_NDK_LLVM is not set)
-endif
$(SILENT) $(GENIE) $(PARAMS) --gcc=android-x86 --gcc_version=3.8.0 --osd=sdl --targetos=android --PLATFORM=x86 --NO_USE_MIDI=1 --NO_OPENGL=1 --USE_QTDEBUG=0 --NO_X11=1 --DONT_USE_NETWORK=1 gmake
.PHONY: android-x86
android-x86: generate $(PROJECTDIR_SDL)/gmake-android-x86/Makefile
-ifndef ANDROID_NDK_X86
- $(error ANDROID_NDK_X86 is not set)
-endif
-ifndef ANDROID_NDK_LLVM
- $(error ANDROID_NDK_LLVM is not set)
-endif
$(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR_SDL)/gmake-android-x86 config=$(CONFIG) precompile
$(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR_SDL)/gmake-android-x86 config=$(CONFIG)
@@ -1167,23 +1135,14 @@ endif
# android-x64
#-------------------------------------------------
-$(PROJECTDIR_SDL)/gmake-android-x64/Makefile: makefile $(SCRIPTS) $(GENIE)
+$(PROJECTDIR_SDL)/gmake-android-x64/Makefile: makefile android-ndk $(SCRIPTS) $(GENIE)
ifndef ANDROID_NDK_X64
$(error ANDROID_NDK_X64 is not set)
endif
-ifndef ANDROID_NDK_LLVM
- $(error ANDROID_NDK_LLVM is not set)
-endif
$(SILENT) $(GENIE) $(PARAMS) --gcc=android-x64 --gcc_version=3.8.0 --osd=sdl --targetos=android --PLATFORM=x64 --NO_USE_MIDI=1 --NO_OPENGL=1 --USE_QTDEBUG=0 --NO_X11=1 --DONT_USE_NETWORK=1 gmake
.PHONY: android-x64
android-x64: generate $(PROJECTDIR_SDL)/gmake-android-x64/Makefile
-ifndef ANDROID_NDK_X64
- $(error ANDROID_NDK_X64 is not set)
-endif
-ifndef ANDROID_NDK_LLVM
- $(error ANDROID_NDK_LLVM is not set)
-endif
$(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR_SDL)/gmake-android-x64 config=$(CONFIG) precompile
$(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR_SDL)/gmake-android-x64 config=$(CONFIG)
diff --git a/scripts/toolchain.lua b/scripts/toolchain.lua
index d94b8abddec..8536845c266 100644
--- a/scripts/toolchain.lua
+++ b/scripts/toolchain.lua
@@ -95,6 +95,8 @@ function toolchain(_buildDir, _subDir)
local androidPlatform = "android-14"
if _OPTIONS["with-android"] then
androidPlatform = "android-" .. _OPTIONS["with-android"]
+ elseif _OPTIONS["PLATFORM"]:find("64", -2) then
+ androidPlatform = "android-21"
end
local iosPlatform = ""
@@ -115,73 +117,40 @@ function toolchain(_buildDir, _subDir)
end
if string.find(_OPTIONS["gcc"], "android") then
- if not os.getenv("ANDROID_NDK_LLVM") then
- print("Set ANDROID_NDK_LLVM envrionment variables.")
+ -- 64-bit android platform requires >= 21
+ if _OPTIONS["PLATFORM"]:find("64", -2) and tonumber(androidPlatform:sub(9)) < 21 then
+ error("64-bit android requires platform 21 or higher")
end
-
- premake.gcc.cc = "$(ANDROID_NDK_LLVM)/bin/clang"
- premake.gcc.cxx = "$(ANDROID_NDK_LLVM)/bin/clang++"
- premake.gcc.llvm = true
- end
-
- if "android-arm" == _OPTIONS["gcc"] then
- if not os.getenv("ANDROID_NDK_ARM") then
- print("Set ANDROID_NDK_ARM envrionment variables.")
+ if not os.getenv("ANDROID_NDK_ROOT") then
+ print("Set ANDROID_NDK_ROOT environment variable.")
end
-
- premake.gcc.ar = "$(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-ar"
- location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-android-arm")
- end
-
- if "android-arm64" == _OPTIONS["gcc"] then
- if not os.getenv("ANDROID_NDK_ARM64") then
- print("Set ANDROID_NDK_ARM64 envrionment variables.")
+ if not os.getenv("ANDROID_NDK_LLVM") then
+ print("Set ANDROID_NDK_LLVM envrionment variable.")
end
-
- premake.gcc.ar = "$(ANDROID_NDK_ARM64)/bin/aarch64-linux-android-ar"
- premake.gcc.llvm = true
- location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-android-arm64")
- end
-
- if "android-mips" == _OPTIONS["gcc"] then
- if not os.getenv("ANDROID_NDK_MIPS") then
- print("Set ANDROID_NDK_MIPS envrionment variables.")
+ platform_ndk_env = "ANDROID_NDK_" .. _OPTIONS["PLATFORM"]:upper()
+ if not os.getenv(platform_ndk_env) then
+ print("Set " .. platform_ndk_env .. " environment variable.")
end
- premake.gcc.ar = "$(ANDROID_NDK_MIPS)/bin/mipsel-linux-android-ar"
- premake.gcc.llvm = true
- location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-android-mips")
- end
+ local platformToolchainMap = {
+ ['arm'] = "arm-linux-androideabi",
+ ['arm64'] = "aarch64-linux-android",
+ ['mips64'] = "mips64el-linux-android",
+ ['mips'] = "mipsel-linux-android",
+ ['x86'] = "i686-linux-android",
+ ['x64'] = "x86_64-linux-android",
+ }
- if "android-mips64" == _OPTIONS["gcc"] then
- if not os.getenv("ANDROID_NDK_MIPS64") then
- print("Set ANDROID_NDK_MIPS64 envrionment variables.")
- end
+ toolchainPrefix = os.getenv(platform_ndk_env) .. "/bin/" .. platformToolchainMap[_OPTIONS["PLATFORM"]] .. "-"
- premake.gcc.ar = "$(ANDROID_NDK_MIPS64)/bin/mips64el-linux-android-ar"
+ premake.gcc.cc = "$(ANDROID_NDK_LLVM)/bin/clang"
+ premake.gcc.cxx = "$(ANDROID_NDK_LLVM)/bin/clang++"
+ premake.gcc.ar = toolchainPrefix .. "ar"
premake.gcc.llvm = true
- location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-android-mips64")
- end
-
- if "android-x86" == _OPTIONS["gcc"] then
- if not os.getenv("ANDROID_NDK_X86") then
- print("Set ANDROID_NDK_X86 envrionment variables.")
- end
- premake.gcc.ar = "$(ANDROID_NDK_X86)/bin/i686-linux-android-ar"
- premake.gcc.llvm = true
- location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-android-x86")
+ location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-android-" .. _OPTIONS["PLATFORM"])
end
- if "android-x64" == _OPTIONS["gcc"] then
- if not os.getenv("ANDROID_NDK_X64") then
- print("Set ANDROID_NDK_X64 envrionment variables.")
- end
-
- premake.gcc.ar = "$(ANDROID_NDK_X64)/bin/x86_64-linux-android-ar"
- premake.gcc.llvm = true
- location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-android-x64")
- end
if "asmjs" == _OPTIONS["gcc"] then
if not os.getenv("EMSCRIPTEN") then
@@ -804,6 +773,8 @@ function toolchain(_buildDir, _subDir)
targetdir (_buildDir .. "openbsd" .. "/bin/x64/Debug")
configuration { "android-*" }
+ targetdir (_buildDir .. "android-" .. _OPTIONS["PLATFORM"] .. "/bin")
+ objdir (_buildDir .. "android-" .. _OPTIONS["PLATFORM"] .. "/obj")
includedirs {
MAME_DIR .. "3rdparty/bgfx/3rdparty/khronos",
"$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libcxx/include",
@@ -848,8 +819,6 @@ function toolchain(_buildDir, _subDir)
configuration { "android-arm" }
- targetdir (_buildDir .. "android-arm" .. "/bin")
- objdir (_buildDir .. "android-arm" .. "/obj")
libdirs {
"$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a",
"$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-arm/usr/lib",
@@ -876,9 +845,6 @@ function toolchain(_buildDir, _subDir)
}
configuration { "android-arm64" }
- androidPlatform = "android-21" -- supported from API 21
- targetdir (_buildDir .. "android-arm64" .. "/bin")
- objdir (_buildDir .. "android-arm64" .. "/obj")
libdirs {
"$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/arm64-v8a",
"$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-arm64/usr/lib64",
@@ -899,8 +865,6 @@ function toolchain(_buildDir, _subDir)
}
configuration { "android-mips" }
- targetdir (_buildDir .. "android-mips" .. "/bin")
- objdir (_buildDir .. "android-mips" .. "/obj")
libdirs {
"$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/mips",
"$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-mips/usr/lib/",
@@ -921,9 +885,6 @@ function toolchain(_buildDir, _subDir)
}
configuration { "android-mips64" }
- androidPlatform = "android-21" -- supported from API 21
- targetdir (_buildDir .. "android-mips64" .. "/bin")
- objdir (_buildDir .. "android-mips64" .. "/obj")
libdirs {
"$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/mips64",
"$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-mips64/usr/lib64/",
@@ -944,8 +905,6 @@ function toolchain(_buildDir, _subDir)
}
configuration { "android-x86" }
- targetdir (_buildDir .. "android-x86" .. "/bin")
- objdir (_buildDir .. "android-x86" .. "/obj")
libdirs {
"$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/x86",
"$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-x86/usr/lib",
@@ -968,9 +927,6 @@ function toolchain(_buildDir, _subDir)
}
configuration { "android-x64" }
- androidPlatform = "android-21" -- supported from API 21
- targetdir (_buildDir .. "android-x64" .. "/bin")
- objdir (_buildDir .. "android-x64" .. "/obj")
libdirs {
"$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/x86_64",
"$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-x86_64/usr/lib64",
@@ -1092,22 +1048,10 @@ function strip()
"$(SILENT) " .. (_OPTIONS['TOOLCHAIN'] and toolchainPrefix) .. "strip \"$(TARGET)\"",
}
- configuration { "android-arm", "Release" }
- postbuildcommands {
- "$(SILENT) echo Stripping symbols.",
- "$(SILENT) $(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-strip -s \"$(TARGET)\""
- }
-
- configuration { "android-mips", "Release" }
- postbuildcommands {
- "$(SILENT) echo Stripping symbols.",
- "$(SILENT) $(ANDROID_NDK_MIPS)/bin/mipsel-linux-android-strip -s \"$(TARGET)\""
- }
-
- configuration { "android-x86", "Release" }
+ configuration { "android-*", "Release" }
postbuildcommands {
"$(SILENT) echo Stripping symbols.",
- "$(SILENT) $(ANDROID_NDK_X86)/bin/i686-linux-android-strip -s \"$(TARGET)\""
+ "$(SILENT) " .. toolchainPrefix .. "strip -s \"$(TARGET)\""
}
configuration { "linux-* or rpi", "Release" }