Bug 1413362 - part 3: Add support to build system for GoogleVR based WebVR on Android r=froydnj,nalexander

MozReview-Commit-ID: 8BHBnvor5VT
This commit is contained in:
Randall Barker 2017-11-02 17:16:11 -07:00
Родитель b2e368e0ca
Коммит 8cb9ab66e9
4 изменённых файлов: 60 добавлений и 0 удалений

Просмотреть файл

@ -11,6 +11,9 @@ js_option('--with-android-ndk', nargs=1,
js_option('--with-android-toolchain', nargs=1,
help='location of the Android toolchain')
option('--with-android-googlevr-sdk', nargs=1,
help='location of the Android GoogleVR SDK')
@depends(target)
def min_android_version(target):
@ -300,3 +303,45 @@ def android_clang_compiler(host, ndk):
die("Couln't find clang in LLVM toolchain at %s" % clang)
return clang
@depends('--with-android-googlevr-sdk', target)
@checking('for GoogleVR SDK', lambda x: x.result)
@imports(_from='os.path', _import='exists')
@imports(_from='os.path', _import='abspath')
def googlevr_sdk(value, target):
if not value:
return namespace(
result='Not specified'
)
path = abspath(value[0])
if not exists(path):
die('Could not find GoogleVR SDK %s', path)
include = '%s/libraries/headers/' % path
if 'arm' == target.cpu:
arch = 'armeabi-v7a'
elif 'aarch64' == target.cpu:
arch = 'arm64-v8a'
elif 'x86' == target.cpu:
arch = 'x86'
else:
die('Unsupported GoogleVR cpu architecture %s' % target.cpu)
libs = '{0}/libraries/jni/{1}/'.format(path, arch)
if not exists(libs):
die('Could not find GoogleVR NDK at %s. Did you try running '
'\'./gradlew :extractNdk\' in %s?', libs, path)
return namespace(
result=path,
include=include,
libs=libs,
enabled=True,
)
set_define('MOZ_ANDROID_GOOGLE_VR', googlevr_sdk.enabled)
set_config('MOZ_ANDROID_GOOGLE_VR', googlevr_sdk.enabled)
set_config('MOZ_ANDROID_GOOGLE_VR_INCLUDE', googlevr_sdk.include)
set_config('MOZ_ANDROID_GOOGLE_VR_LIBS', googlevr_sdk.libs)

Просмотреть файл

@ -55,3 +55,8 @@ JS_PREFERENCE_PP_FILES += [
FINAL_TARGET_PP_FILES += [
'ua-update.json.in',
]
if CONFIG['MOZ_ANDROID_GOOGLE_VR']:
FINAL_TARGET_FILES += [
'/' + CONFIG['MOZ_ANDROID_GOOGLE_VR_LIBS'] + 'libgvr.so',
]

Просмотреть файл

@ -76,6 +76,10 @@
@BINPATH@/@MOZ_CHILD_PROCESS_NAME@
@BINPATH@/@MOZ_CHILD_PROCESS_NAME_PIE@
#ifdef MOZ_ANDROID_GOOGLE_VR
@BINPATH@/@DLL_PREFIX@gvr@DLL_SUFFIX@
#endif
[xpcom]
@BINPATH@/package-name.txt
@BINPATH@/classes.dex

Просмотреть файл

@ -210,6 +210,12 @@ if CONFIG['OS_ARCH'] == 'Linux' and CONFIG['OS_TARGET'] != 'Android':
'rt',
]
if CONFIG['MOZ_ANDROID_GOOGLE_VR']:
OS_LIBS += [
'-L%s' % CONFIG['MOZ_ANDROID_GOOGLE_VR_LIBS'],
'-lgvr',
]
OS_LIBS += CONFIG['MOZ_CAIRO_OSLIBS']
OS_LIBS += CONFIG['MOZ_WEBRTC_X11_LIBS']