Make Android targets compile but not link, using clang compiler in NDK, since GCC will be removed in next one (nw)

This commit is contained in:
Miodrag Milanovic 2016-02-25 20:43:40 +01:00
parent 08d84121d4
commit add7a65f3f
6 changed files with 69 additions and 41 deletions

View File

@ -2211,9 +2211,9 @@ namespace bgfx
}
}
const Memory* imageAlloc(ImageContainer& _imageContainer, TextureFormat::Enum _format, uint16_t _width, uint16_t _height, uint16_t _depth, bool _cubeMap, bool _mips)
const Memory* imageAlloc(ImageContainer& _imageContainer, TextureFormat::Enum _format, uint16_t _width, uint16_t _height, uint16_t _depth, bool _cubeMap, bool _mipsActive)
{
const uint8_t numMips = _mips ? imageGetNumMips(_format, _width, _height) : 1;
const uint8_t numMips = _mipsActive ? imageGetNumMips(_format, _width, _height) : 1;
uint32_t size = imageGetSize(_format, _width, _height, 0, false, numMips);
const Memory* image = alloc(size);

View File

@ -121,7 +121,7 @@ namespace bgfx
bool imageConvert(void* _dst, TextureFormat::Enum _dstFormat, const void* _src, TextureFormat::Enum _srcFormat, uint32_t _width, uint32_t _height);
///
const Memory* imageAlloc(ImageContainer& _imageContainer, TextureFormat::Enum _format, uint16_t _width, uint16_t _height, uint16_t _depth = 0, bool _cubeMap = false, bool _mips = false);
const Memory* imageAlloc(ImageContainer& _imageContainer, TextureFormat::Enum _format, uint16_t _width, uint16_t _height, uint16_t _depth = 0, bool _cubeMap = false, bool _mipsActive = false);
///
void imageFree(const Memory* _memory);

View File

@ -1025,10 +1025,15 @@ configuration { "asmjs" }
configuration { "android*" }
buildoptions {
"-Wno-undef",
"-Wno-typedef-redefinition",
"-Wno-unknown-warning-option",
}
buildoptions_cpp {
"-x c++",
"-std=c++14",
"-Wno-extern-c-compat",
"-Wno-tautological-constant-out-of-range-compare",
"-Wno-tautological-pointer-compare",
}
archivesplit_size "20"

View File

@ -537,10 +537,14 @@ project "luv"
"-Wno-unused-function",
"-Wno-strict-prototypes",
"-Wno-unused-variable",
"-Wno-maybe-uninitialized",
"-Wno-undef",
}
configuration { "not android-*" }
buildoptions_c {
"-Wno-maybe-uninitialized",
}
configuration { "vs2015" }
buildoptions {
"/wd4701", -- warning C4701: potentially uninitialized local variable 'xxx' used
@ -749,6 +753,11 @@ end
MAME_DIR .. "3rdparty/bgfx/3rdparty/khronos",
}
configuration { "android-*"}
buildoptions {
"-Wno-macro-redefined",
}
configuration { "vs*" }
includedirs {
MAME_DIR .. "3rdparty/bx/include/compat/msvc",
@ -890,7 +899,7 @@ end
local version = str_to_version(_OPTIONS["gcc_version"])
if (_OPTIONS["gcc"]~=nil) then
if string.find(_OPTIONS["gcc"], "clang") then
if string.find(_OPTIONS["gcc"], "clang") or string.find(_OPTIONS["gcc"], "android") then
buildoptions_c {
"-Wno-unknown-warning-option",
"-Wno-absolute-value",
@ -1024,7 +1033,7 @@ project "uv"
local version = str_to_version(_OPTIONS["gcc_version"])
if (_OPTIONS["gcc"]~=nil) then
if string.find(_OPTIONS["gcc"], "clang") then
if string.find(_OPTIONS["gcc"], "clang") or string.find(_OPTIONS["gcc"], "android") then
buildoptions_c {
"-Wno-unknown-warning-option",
"-Wno-unknown-attributes",

View File

@ -25,6 +25,17 @@ else
end
uuid (os.uuid(_target .."_" .. _subtarget))
kind "ConsoleApp"
configuration { "android*" }
targetextension ".so"
linkoptions {
"-shared",
}
links {
"EGL",
"GLESv2",
}
configuration { }
addprojectflags()
flags {

View File

@ -106,9 +106,10 @@ function toolchain(_buildDir, _subDir)
print("Set ANDROID_NDK_ARM and ANDROID_NDK_ROOT envrionment variables.")
end
premake.gcc.cc = "$(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-gcc"
premake.gcc.cxx = "$(ANDROID_NDK_ARM)/bin/arm-linux-androideabi-g++"
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_ARM)/bin/arm-linux-androideabi-ar"
premake.gcc.llvm = true
location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-android-arm")
end
@ -118,9 +119,10 @@ function toolchain(_buildDir, _subDir)
print("Set ANDROID_NDK_MIPS and ANDROID_NDK_ROOT envrionment variables.")
end
premake.gcc.cc = "$(ANDROID_NDK_MIPS)/bin/mipsel-linux-android-gcc"
premake.gcc.cxx = "$(ANDROID_NDK_MIPS)/bin/mipsel-linux-android-g++"
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_MIPS)/bin/mipsel-linux-android-ar"
premake.gcc.llvm = true
location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-android-mips")
end
@ -130,9 +132,10 @@ function toolchain(_buildDir, _subDir)
print("Set ANDROID_NDK_X86 and ANDROID_NDK_ROOT envrionment variables.")
end
premake.gcc.cc = "$(ANDROID_NDK_X86)/bin/i686-linux-android-gcc"
premake.gcc.cxx = "$(ANDROID_NDK_X86)/bin/i686-linux-android-g++"
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_X86)/bin/i686-linux-android-ar"
premake.gcc.llvm = true
location (_buildDir .. "projects/" .. _subDir .. "/".. _ACTION .. "-android-x86")
end
@ -629,11 +632,12 @@ function toolchain(_buildDir, _subDir)
configuration { "android-*" }
includedirs {
"$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/include",
MAME_DIR .. "3rdparty/bgfx/3rdparty/khronos",
"$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libcxx/include",
"$(ANDROID_NDK_ROOT)/sources/android/support/include",
"$(ANDROID_NDK_ROOT)/sources/android/native_app_glue",
}
linkoptions {
"-nostdlib",
"-static-libgcc",
}
flags {
@ -645,19 +649,18 @@ function toolchain(_buildDir, _subDir)
"m",
"android",
"log",
"gnustl_static",
"gcc",
}
buildoptions {
"-fPIC",
"-no-canonical-prefixes",
"-Wa,--noexecstack",
"-fstack-protector",
"-fpic",
"-ffunction-sections",
"-Wno-cast-align",
"-Wno-psabi", -- note: the mangling of 'va_list' has changed in GCC 4.4.0
"-funwind-tables",
"-fstack-protector-strong",
"-no-canonical-prefixes",
"-fno-integrated-as",
"-Wunused-value",
"-Wundef",
"-Wno-cast-align",
}
linkoptions {
"-no-canonical-prefixes",
@ -672,44 +675,46 @@ function toolchain(_buildDir, _subDir)
targetdir (_buildDir .. "android-arm" .. "/bin")
objdir (_buildDir .. "android-arm" .. "/obj")
libdirs {
"$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a",
"$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/armeabi-v7a",
"$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-arm/usr/lib",
}
includedirs {
"$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/libs/armeabi-v7a/include",
"$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-arm/usr/include",
}
buildoptions {
"-mthumb",
"-gcc-toolchain $(ANDROID_NDK_ARM)",
"-target armv7-none-linux-androideabi",
"-march=armv7-a",
"-mfloat-abi=softfp",
"-mfpu=neon",
"-Wunused-value",
"-Wundef",
"-mfpu=vfpv3-d16",
"-mthumb",
}
linkoptions {
"-gcc-toolchain $(ANDROID_NDK_ARM)",
"$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-arm/usr/lib/crtbegin_so.o",
"$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-arm/usr/lib/crtend_so.o",
"-target armv7-none-linux-androideabi",
"-march=armv7-a",
"-Wl,--fix-cortex-a8",
"-mthumb",
}
configuration { "android-mips" }
targetdir (_buildDir .. "android-mips" .. "/bin")
objdir (_buildDir .. "android-mips" .. "/obj")
libdirs {
"$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/libs/mips",
"$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/mips",
"$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-mips/usr/lib/",
}
includedirs {
"$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/libs/mips/include",
"$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-mips/usr/include",
}
buildoptions {
"-Wunused-value",
"-Wundef",
"-gcc-toolchain $(ANDROID_NDK_MIPS)",
"-target mipsel-none-linux-android",
}
linkoptions {
"-gcc-toolchain $(ANDROID_NDK_MIPS)",
"-target mipsel-none-linux-android",
"$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-mips/usr/lib/crtbegin_so.o",
"$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-mips/usr/lib/crtend_so.o",
}
@ -718,23 +723,21 @@ function toolchain(_buildDir, _subDir)
targetdir (_buildDir .. "android-x86" .. "/bin")
objdir (_buildDir .. "android-x86" .. "/obj")
libdirs {
"$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86",
"$(ANDROID_NDK_ROOT)/sources/cxx-stl/llvm-libc++/libs/x86",
"$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-x86/usr/lib",
}
includedirs {
"$(ANDROID_NDK_ROOT)/sources/cxx-stl/gnu-libstdc++/4.9/libs/x86/include",
"$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-x86/usr/include",
}
buildoptions {
"-march=i686",
"-mtune=atom",
"-mstackrealign",
"-msse3",
"-mfpmath=sse",
"-Wunused-value",
"-Wundef",
"-gcc-toolchain $(ANDROID_NDK_X86)",
"-target i686-none-linux-android",
"-mssse3"
}
linkoptions {
"-gcc-toolchain $(ANDROID_NDK_X86)",
"-target i686-none-linux-android",
"-mssse3",
"$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-x86/usr/lib/crtbegin_so.o",
"$(ANDROID_NDK_ROOT)/platforms/" .. androidPlatform .. "/arch-x86/usr/lib/crtend_so.o",
}