diff --git a/makefile b/makefile index d232ce2..985c94b 100644 --- a/makefile +++ b/makefile @@ -8,6 +8,7 @@ GENIE=../bx/tools/bin/$(OS)/genie all: $(GENIE) vs2017 $(GENIE) --gcc=android-arm gmake + $(GENIE) --gcc=android-arm64 gmake $(GENIE) --gcc=android-mips gmake $(GENIE) --gcc=android-x86 gmake $(GENIE) --gcc=mingw-gcc gmake @@ -27,6 +28,14 @@ android-arm-release: .build/projects/gmake-android-arm make -R -C .build/projects/gmake-android-arm config=release android-arm: android-arm-debug android-arm-release +.build/projects/gmake-android-arm64: + $(GENIE) --gcc=android-arm64 gmake +android-arm64-debug: .build/projects/gmake-android-arm64 + make -R -C .build/projects/gmake-android-arm64 config=debug +android-arm64-release: .build/projects/gmake-android-arm64 + make -R -C .build/projects/gmake-android-arm64 config=release +android-arm64: android-arm64-debug android-arm64-release + .build/projects/gmake-android-mips: $(GENIE) --gcc=android-mips gmake android-mips-debug: .build/projects/gmake-android-mips diff --git a/scripts/toolchain.lua b/scripts/toolchain.lua index 89a5b1b..e92fd69 100644 --- a/scripts/toolchain.lua +++ b/scripts/toolchain.lua @@ -50,6 +50,7 @@ function toolchain(_buildDir, _libDir) description = "Choose GCC flavor", allowed = { { "android-arm", "Android - ARM" }, + { "android-arm64", "Android - ARM64" }, { "android-x86", "Android - x86" }, { "asmjs", "Emscripten/asm.js" }, { "freebsd", "FreeBSD" }, @@ -221,6 +222,21 @@ function toolchain(_buildDir, _libDir) premake.gcc.llvm = true location (path.join(_buildDir, "projects", _ACTION .. "-android-arm")) + elseif "android-arm64" == _OPTIONS["gcc"] then + + if not os.getenv("ANDROID_NDK_ARM64") + or not os.getenv("ANDROID_NDK_CLANG") + or not os.getenv("ANDROID_NDK_ROOT") then + print("Set ANDROID_NDK_CLANG, ANDROID_NDK_ARM64, and ANDROID_NDK_ROOT environment variables.") + end + + premake.gcc.cc = "$(ANDROID_NDK_CLANG)/bin/clang" + premake.gcc.cxx = "$(ANDROID_NDK_CLANG)/bin/clang++" + premake.gcc.ar = "$(ANDROID_NDK_ARM64)/bin/aarch64-linux-android-ar" + + premake.gcc.llvm = true + location (path.join(_buildDir, "projects", _ACTION .. "-android-arm64")) + elseif "android-x86" == _OPTIONS["gcc"] then if not os.getenv("ANDROID_NDK_X86") @@ -893,6 +909,33 @@ function toolchain(_buildDir, _libDir) "-Wl,--fix-cortex-a8", } + configuration { "android-arm64" } + targetdir (path.join(_buildDir, "android-arm64/bin")) + objdir (path.join(_buildDir, "android-arm64/obj")) + libdirs { + "$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/arm64-v8a", + } + includedirs { + "$(ANDROID_NDK_ROOT)/sysroot/usr/include/aarch64-linux-android", + } + buildoptions { + "-gcc-toolchain $(ANDROID_NDK_ARM64)", + "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm64"), + "-target aarch64-none-linux-androideabi", + "-march=armv8-a", + "-Wunused-value", + "-Wundef", + } + linkoptions { + "-gcc-toolchain $(ANDROID_NDK_ARM64)", + "--sysroot=" .. path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm64"), + path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm64/usr/lib/crtbegin_so.o"), + path.join("$(ANDROID_NDK_ROOT)/platforms", androidPlatform, "arch-arm64/usr/lib/crtend_so.o"), + "-target aarch64-none-linux-androideabi", + "-march=armv8-a", + "-Wl,--fix-cortex-a8", + } + configuration { "android-x86" } targetdir (path.join(_buildDir, "android-x86/bin")) objdir (path.join(_buildDir, "android-x86/obj")) @@ -1202,6 +1245,12 @@ function strip() "$(SILENT) $(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-strip -s \"$(TARGET)\"" } + configuration { "android-arm64", "Release" } + postbuildcommands { + "$(SILENT) echo Stripping symbols.", + "$(SILENT) $(ANDROID_NDK_ARM64)/bin/aarch64-linux-android-strip -s \"$(TARGET)\"" + } + configuration { "android-x86", "Release" } postbuildcommands { "$(SILENT) echo Stripping symbols.",