diff --git a/makefile b/makefile index 0422f8a03a7..10091cf9afe 100644 --- a/makefile +++ b/makefile @@ -955,6 +955,30 @@ endif $(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR_MINI)/gmake-android-arm config=$(CONFIG) precompile $(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR_MINI)/gmake-android-arm config=$(CONFIG) +#------------------------------------------------- +# android-arm64 +#------------------------------------------------- + +$(PROJECTDIR_MINI)/gmake-android-arm64/Makefile: makefile $(SCRIPTS) $(GENIE) +ifndef ANDROID_NDK_ARM64 + $(error ANDROID_NDK_ARM64 is not set) +endif +ifndef ANDROID_NDK_ROOT + $(error ANDROID_NDK_ROOT is not set) +endif + $(SILENT) $(GENIE) $(PARAMS) --gcc=android-arm64 --gcc_version=3.6.0 --osd=osdmini --targetos=android-arm64 --targetos=android --PLATFORM=arm64 --NOASM=1 gmake + +.PHONY: android-arm64 +android-arm64: generate $(PROJECTDIR_MINI)/gmake-android-arm64/Makefile +ifndef ANDROID_NDK_ARM64 + $(error ANDROID_NDK_ARM64 is not set) +endif +ifndef ANDROID_NDK_ROOT + $(error ANDROID_NDK_ROOT is not set) +endif + $(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR_MINI)/gmake-android-arm64 config=$(CONFIG) precompile + $(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR_MINI)/gmake-android-arm64 config=$(CONFIG) + #------------------------------------------------- # android-mips #------------------------------------------------- @@ -979,6 +1003,30 @@ endif $(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR_MINI)/gmake-android-mips config=$(CONFIG) precompile $(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR_MINI)/gmake-android-mips config=$(CONFIG) +#------------------------------------------------- +# android-mips64 +#------------------------------------------------- + +$(PROJECTDIR_MINI)/gmake-android-mips64/Makefile: makefile $(SCRIPTS) $(GENIE) +ifndef ANDROID_NDK_MIPS64 + $(error ANDROID_NDK_MIPS64 is not set) +endif +ifndef ANDROID_NDK_ROOT + $(error ANDROID_NDK_ROOT is not set) +endif + $(SILENT) $(GENIE) $(PARAMS) --gcc=android-mips64 --gcc_version=3.6.0 --osd=osdmini --targetos=android-mips64 --targetos=android --PLATFORM=mips64 --NOASM=1 gmake + +.PHONY: android-mips64 +android-mips64: generate $(PROJECTDIR_MINI)/gmake-android-mips64/Makefile +ifndef ANDROID_NDK_MIPS64 + $(error ANDROID_NDK_MIPS64 is not set) +endif +ifndef ANDROID_NDK_ROOT + $(error ANDROID_NDK_ROOT is not set) +endif + $(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR_MINI)/gmake-android-mips64 config=$(CONFIG) precompile + $(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR_MINI)/gmake-android-mips64 config=$(CONFIG) + #------------------------------------------------- # android-x86 #------------------------------------------------- @@ -1003,6 +1051,30 @@ endif $(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR_MINI)/gmake-android-x86 config=$(CONFIG) precompile $(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR_MINI)/gmake-android-x86 config=$(CONFIG) +#------------------------------------------------- +# android-x64 +#------------------------------------------------- + +$(PROJECTDIR_MINI)/gmake-android-x64/Makefile: makefile $(SCRIPTS) $(GENIE) +ifndef ANDROID_NDK_X64 + $(error ANDROID_NDK_X64 is not set) +endif +ifndef ANDROID_NDK_ROOT + $(error ANDROID_NDK_ROOT is not set) +endif + $(SILENT) $(GENIE) $(PARAMS) --gcc=android-x64 --gcc_version=3.6.0 --osd=osdmini --targetos=android-x64 --targetos=android --PLATFORM=x64 gmake + +.PHONY: android-x64 +android-x64: generate $(PROJECTDIR_MINI)/gmake-android-x64/Makefile +ifndef ANDROID_NDK_X64 + $(error ANDROID_NDK_X64 is not set) +endif +ifndef ANDROID_NDK_ROOT + $(error ANDROID_NDK_ROOT is not set) +endif + $(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR_MINI)/gmake-android-x64 config=$(CONFIG) precompile + $(SILENT) $(MAKE) $(MAKEPARAMS) -C $(PROJECTDIR_MINI)/gmake-android-x64 config=$(CONFIG) + #------------------------------------------------- # asmjs / Emscripten #------------------------------------------------- diff --git a/scripts/genie.lua b/scripts/genie.lua index 329efb08a0a..d17607bbdce 100644 --- a/scripts/genie.lua +++ b/scripts/genie.lua @@ -542,7 +542,7 @@ end if (_ACTION == nil) then return false end -- define PTR64 if we are a 64-bit target -configuration { "x64" } +configuration { "x64 or android-*64"} defines { "PTR64=1" } -- define MAME_DEBUG if we are a debugging build @@ -1043,6 +1043,11 @@ configuration { "android*" } } archivesplit_size "20" +configuration { "android-arm64" } + buildoptions { + "-Wno-asm-operand-widths", + } + configuration { "pnacl" } buildoptions { "-std=gnu89", diff --git a/scripts/toolchain.lua b/scripts/toolchain.lua index c98e233b255..ed7045244a0 100644 --- a/scripts/toolchain.lua +++ b/scripts/toolchain.lua @@ -16,8 +16,11 @@ newoption { description = "Choose GCC flavor", allowed = { { "android-arm", "Android - ARM" }, + { "android-arm64", "Android - ARM64" }, { "android-mips", "Android - MIPS" }, + { "android-mips64","Android - MIPS64" }, { "android-x86", "Android - x86" }, + { "android-x64", "Android - x64" }, { "asmjs", "Emscripten/asm.js" }, { "freebsd", "FreeBSD" }, { "linux-gcc", "Linux (GCC compiler)" }, @@ -111,6 +114,19 @@ function toolchain(_buildDir, _subDir) location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-android-arm") end + if "android-arm64" == _OPTIONS["gcc"] then + + if not os.getenv("ANDROID_NDK_ARM64") or not os.getenv("ANDROID_NDK_ROOT") then + print("Set ANDROID_NDK_ARM64 and ANDROID_NDK_ROOT envrionment variables.") + end + + premake.gcc.cc = "$(ANDROID_NDK_ROOT)/toolchains/llvm-3.6/prebuilt/windows-x86_64/bin/clang.exe" + premake.gcc.cxx = "$(ANDROID_NDK_ROOT)/toolchains/llvm-3.6/prebuilt/windows-x86_64/bin/clang++.exe" + premake.gcc.ar = "$(ANDROID_NDK_ARM64)/bin/aarch64-linux-android-ar.exe" + 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") or not os.getenv("ANDROID_NDK_ROOT") then @@ -123,7 +139,20 @@ function toolchain(_buildDir, _subDir) premake.gcc.llvm = true location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-android-mips") end + + if "android-mips64" == _OPTIONS["gcc"] then + if not os.getenv("ANDROID_NDK_MIPS64") or not os.getenv("ANDROID_NDK_ROOT") then + print("Set ANDROID_NDK_MIPS64 and ANDROID_NDK_ROOT envrionment variables.") + end + + premake.gcc.cc = "$(ANDROID_NDK_ROOT)/toolchains/llvm-3.6/prebuilt/windows-x86_64/bin/clang.exe" + premake.gcc.cxx = "$(ANDROID_NDK_ROOT)/toolchains/llvm-3.6/prebuilt/windows-x86_64/bin/clang++.exe" + premake.gcc.ar = "$(ANDROID_NDK_MIPS64)/bin/mips64el-linux-android-ar.exe" + 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") or not os.getenv("ANDROID_NDK_ROOT") then @@ -136,7 +165,19 @@ function toolchain(_buildDir, _subDir) premake.gcc.llvm = true location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-android-x86") end + + if "android-x64" == _OPTIONS["gcc"] then + if not os.getenv("ANDROID_NDK_X64") or not os.getenv("ANDROID_NDK_ROOT") then + print("Set ANDROID_NDK_X64 and ANDROID_NDK_ROOT envrionment variables.") + end + + premake.gcc.cc = "$(ANDROID_NDK_ROOT)/toolchains/llvm-3.6/prebuilt/windows-x86_64/bin/clang.exe" + premake.gcc.cxx = "$(ANDROID_NDK_ROOT)/toolchains/llvm-3.6/prebuilt/windows-x86_64/bin/clang++.exe" + premake.gcc.ar = "$(ANDROID_NDK_X64)/bin/x86_64-linux-android-ar.exe" + premake.gcc.llvm = true + location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-android-x64") + end if "asmjs" == _OPTIONS["gcc"] then if not os.getenv("EMSCRIPTEN") then @@ -683,6 +724,29 @@ function toolchain(_buildDir, _subDir) "-mthumb", } + 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", + } + includedirs { + "$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-arm64/usr/include", + } + buildoptions { + "-gcc-toolchain $(ANDROID_NDK_ARM64)", + "-target aarch64-none-linux-android", + } + linkoptions { + "-gcc-toolchain $(ANDROID_NDK_ARM64)", + "--sysroot=$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-arm64", + "$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-arm64/usr/lib/crtbegin_so.o", + "$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-arm64/usr/lib/crtend_so.o", + "-target aarch64-none-linux-android", + } + configuration { "android-mips" } targetdir (_buildDir .. "android-mips" .. "/bin") objdir (_buildDir .. "android-mips" .. "/obj") @@ -704,6 +768,29 @@ function toolchain(_buildDir, _subDir) "$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-mips/usr/lib/crtbegin_so.o", "$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-mips/usr/lib/crtend_so.o", } + + 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/", + } + includedirs { + "$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-mips64/usr/include", + } + buildoptions { + "-gcc-toolchain $(ANDROID_NDK_MIPS64)", + "-target mips64el-none-linux-android", + } + linkoptions { + "-gcc-toolchain $(ANDROID_NDK_MIPS64)", + "-target mips64el-none-linux-android", + "--sysroot=$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-mips64", + "$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-mips64/usr/lib64/crtbegin_so.o", + "$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-mips64/usr/lib64/crtend_so.o", + } configuration { "android-x86" } targetdir (_buildDir .. "android-x86" .. "/bin") @@ -729,7 +816,29 @@ function toolchain(_buildDir, _subDir) "$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-x86/usr/lib/crtend_so.o", } - + 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", + } + includedirs { + "$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-x86_64/usr/include", + } + buildoptions { + "-gcc-toolchain $(ANDROID_NDK_X64)", + "-target x86_64-none-linux-android", + } + linkoptions { + "-gcc-toolchain $(ANDROID_NDK_X64)", + "-target x86_64-none-linux-android", + "--sysroot=$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-x86_64", + "$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-x86_64/usr/lib64/crtbegin_so.o", + "$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-x86_64/usr/lib64/crtend_so.o", + } + configuration { "asmjs" } targetdir (_buildDir .. "asmjs" .. "/bin") objdir (_buildDir .. "asmjs" .. "/obj")