Bug 1374393 - Build OpenVR on macOS and Linux r=daoshengmu

- OpenVR was previously only being built for Windows builds
  it will now be built additionally on macOS and Linux.

MozReview-Commit-ID: 68ZUNmdybd1

--HG--
extra : rebase_source : 329c85c866f7c1c95566f77ccddb92c348563e4d
This commit is contained in:
Kearwood Gilbert 2017-05-31 11:14:55 -07:00
Родитель 71ef65cb4a
Коммит 391d83ccbc
6 изменённых файлов: 41 добавлений и 17 удалений

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

@ -17,9 +17,9 @@
#include "gfxVR.h"
#if defined(XP_WIN)
#include "gfxVROculus.h"
#include "gfxVROpenVR.h"
#endif
#if defined(XP_WIN) || defined(XP_MACOSX) || defined(XP_LINUX)
#if defined(XP_WIN) || defined(XP_MACOSX) || (defined(XP_LINUX) && !defined(MOZ_WIDGET_ANDROID))
#include "gfxVROpenVR.h"
#include "gfxVROSVR.h"
#endif
#include "gfxVRPuppet.h"
@ -75,14 +75,15 @@ VRManager::VRManager()
if (mgr) {
mManagers.AppendElement(mgr);
}
// OpenVR is cross platform compatible, but supported only on Windows for now
#endif
#if defined(XP_WIN) || defined(XP_MACOSX) || (defined(XP_LINUX) && !defined(MOZ_WIDGET_ANDROID))
// OpenVR is cross platform compatible
mgr = VRSystemManagerOpenVR::Create();
if (mgr) {
mManagers.AppendElement(mgr);
}
#endif
#if defined(XP_WIN) || defined(XP_MACOSX) || defined(XP_LINUX)
// OSVR is cross platform compatible
mgr = VRSystemManagerOSVR::Create();
if (mgr) {

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

@ -8,6 +8,7 @@
#include "nsTArray.h"
#include "nsIScreen.h"
#include "nsIThread.h"
#include "nsCOMPtr.h"
#include "mozilla/RefPtr.h"

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

@ -35,15 +35,20 @@ UNIFIED_SOURCES += [
'VRManager.cpp',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
# Build OpenVR on Windows, Linux, and macOS desktop targets
if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('cocoa', 'uikit', 'windows', 'gtk2', 'gtk3'):
DIRS += [
'openvr',
]
SOURCES += [
'gfxVROculus.cpp',
'gfxVROpenVR.cpp',
]
if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
SOURCES += [
'gfxVROculus.cpp',
]
IPDL_SOURCES = [
'ipc/PVRLayer.ipdl',
'ipc/PVRManager.ipdl',

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

@ -37,8 +37,11 @@ Steps to update the library:
- Update "gfx/vr/openvr/moz.build" when files are added or removed.
- Update the "strtools_public.h" and "strtools_public.cpp" files, commenting out
the "Uint64ToString" function. This function name conflicts with another used
in Gecko. Fortunately, the OpenVR SDK does not use this function either.
the "Uint64ToString", "wcsncpy_s", and "strncpy_s" functions.
The "Uint64ToString" function name conflicts with another used in Gecko and
the "errno_t" return type returned by the other functions is not defined in
Mozilla's macOS continuous integration build environments. Fortunately, the
OpenVR SDK does not use these functions.
- Replace the #define VR_INTERFACE in openvr.h to avoid extern'ing the functions.
Unlike the usual OpenVR API builds, we are not building a separate dll.

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

@ -14,13 +14,19 @@ if CONFIG['OS_ARCH'] == 'WINNT':
else:
DEFINES['WIN32'] = True
# When we support platforms other than Windows, we
# will also need to define these:
#
# LINUX64
# LINUX
# OSX
# POSIX
if CONFIG['OS_ARCH'] == 'Darwin':
DEFINES['POSIX'] = True
DEFINES['OSX'] = True
if CONFIG['GNU_CXX']:
CXXFLAGS += ['-xobjective-c++']
if CONFIG['OS_ARCH'] == 'Linux':
DEFINES['POSIX'] = True
DEFINES['LINUX'] = True
if CONFIG['HAVE_64BIT_BUILD']:
DEFINES['LINUX64'] = True
else:
DEFINES['LINUX32'] = True
LOCAL_INCLUDES += [
'/toolkit/components/jsoncpp/include',
@ -45,3 +51,9 @@ SOURCES += [
'src/vrpathregistry_public.cpp',
]
if CONFIG['CLANG_CXX'] or CONFIG['GNU_CXX']:
# Harmless warnings in 3rd party code
CXXFLAGS += [
'-Wno-error=parentheses',
'-Wno-error=unused-variable',
]

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

@ -52,6 +52,8 @@ inline int strnicmp( const char *pStr1, const char *pStr2, size_t unBufferLen )
#if defined( OSX )
// behaviors ensure NULL-termination at least as well as _TRUNCATE does, but
// wcsncpy_s/strncpy_s can non-NULL-terminate, wcslcpy/strlcpy can not.
/*
// Commented out by Mozilla, please see README.mozilla
inline errno_t wcsncpy_s(wchar_t *strDest, size_t numberOfElements, const wchar_t *strSource, size_t count)
{
return wcslcpy(strDest, strSource, numberOfElements);
@ -61,7 +63,7 @@ inline errno_t strncpy_s(char *strDest, size_t numberOfElements, const char *str
{
return strlcpy(strDest, strSource, numberOfElements);
}
*/
#endif
#if defined( LINUX )