aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2015-07-15 21:12:04 +0200
committerSven Gothel <[email protected]>2015-07-15 21:12:04 +0200
commit1f262ca2dbe00ba761e9b91994e93fee65d6efc1 (patch)
tree55c5b013ac5dd5e1edee5cc1ed09739a914de3e0
parenta352ecb7e63304034ac93332cf0c4d9183df867e (diff)
Fix build for Windows/MingW64 ...
-rwxr-xr-xLibOVR/Src/CAPI/CAPI_HMDState.cpp2
-rwxr-xr-xLibOVR/Src/Displays/OVR_Display.cpp19
-rw-r--r--LibOVR/Src/Net/OVR_BitStream.cpp4
-rw-r--r--LibOVR/Src/Net/OVR_BitStream.h5
-rw-r--r--LibOVR/Src/Net/OVR_Socket.h4
-rw-r--r--LibOVR/Src/Net/OVR_Win32_Socket.cpp4
-rw-r--r--LibOVR/Src/Net/OVR_Win32_Socket.h4
-rwxr-xr-xLibOVR/Src/OVR_CAPI.cpp2
-rw-r--r--LibOVRKernel/Src/Tracing/Tracing.h2
-rw-r--r--LibOVRKernel/Src/Util/Util_SystemInfo.cpp16
10 files changed, 58 insertions, 4 deletions
diff --git a/LibOVR/Src/CAPI/CAPI_HMDState.cpp b/LibOVR/Src/CAPI/CAPI_HMDState.cpp
index fede019..375fff9 100755
--- a/LibOVR/Src/CAPI/CAPI_HMDState.cpp
+++ b/LibOVR/Src/CAPI/CAPI_HMDState.cpp
@@ -371,10 +371,12 @@ ovrTrackingState HMDState::PredictedTrackingState(double absTime, void*)
ss.StatusFlags = 0;
}
+#if !defined(HEADLESS_APP)
#ifdef OVR_OS_WIN32
// Set up display code for Windows
Win32::DisplayShim::GetInstance().Active = (ss.StatusFlags & ovrStatus_HmdConnected) != 0;
#endif
+#endif /* !defined(HEADLESS_APP) */
return ss;
diff --git a/LibOVR/Src/Displays/OVR_Display.cpp b/LibOVR/Src/Displays/OVR_Display.cpp
index 7c74eee..2b899af 100755
--- a/LibOVR/Src/Displays/OVR_Display.cpp
+++ b/LibOVR/Src/Displays/OVR_Display.cpp
@@ -45,6 +45,25 @@ void Display::SetDirectDisplayInitialized(bool initialized)
DirectDisplayInitialized = initialized;
}
+#if defined(HEADLESS_APP)
+
+bool Display::Initialize()
+{
+ return true;
+}
+
+void Display::Shutdown()
+{
+}
+
+bool Display::InCompatibilityMode( bool displaySearch )
+{
+ OVR_UNUSED( displaySearch );
+ return true;
+}
+
+
+#endif /* defined(HEADLESS_APP) */
//-----------------------------------------------------------------------------
// EDID Parsing
diff --git a/LibOVR/Src/Net/OVR_BitStream.cpp b/LibOVR/Src/Net/OVR_BitStream.cpp
index 054f871..d7d5e73 100644
--- a/LibOVR/Src/Net/OVR_BitStream.cpp
+++ b/LibOVR/Src/Net/OVR_BitStream.cpp
@@ -27,6 +27,10 @@ limitations under the License.
#include "OVR_BitStream.h"
#ifdef OVR_OS_WIN32
+#if defined(_WINSOCKAPI_) && !defined(OVR_CC_MSVC) && !defined(_WINSOCK2API_)
+/** Silent warning using mingw64, _WINSOCKAPI_ is disabled in ./LibOVRKernel/Src/Kernel/OVR_Win32_IncludeWindows.h */
+#undef _WINSOCKAPI_
+#endif /* defined(_WINSOCKAPI_) && !defined(OVR_CC_MSVC) && !defined(_WINSOCK2API_) */
#include <WinSock2.h>
#else
#include <arpa/inet.h>
diff --git a/LibOVR/Src/Net/OVR_BitStream.h b/LibOVR/Src/Net/OVR_BitStream.h
index 4e2d2ef..83c4a32 100644
--- a/LibOVR/Src/Net/OVR_BitStream.h
+++ b/LibOVR/Src/Net/OVR_BitStream.h
@@ -28,6 +28,9 @@ limitations under the License.
#ifndef OVR_Bitstream_h
#define OVR_Bitstream_h
+#if defined(OVR_CC_MSVC)
+#include <float.h>
+#endif
#include <math.h>
#include "Kernel/OVR_Types.h"
#include "Kernel/OVR_Std.h"
@@ -1557,7 +1560,7 @@ void BitStream::WriteOrthMatrix(
if (qx < 0.0) qx=0.0;
if (qy < 0.0) qy=0.0;
if (qz < 0.0) qz=0.0;
-#ifdef OVR_OS_WIN32
+#if defined(OVR_OS_WIN32) && defined(OVR_CC_MSVC)
qx = _copysign( (double) qx, (double) (m21 - m12) );
qy = _copysign( (double) qy, (double) (m02 - m20) );
qz = _copysign( (double) qz, (double) (m10 - m01) );
diff --git a/LibOVR/Src/Net/OVR_Socket.h b/LibOVR/Src/Net/OVR_Socket.h
index df6407f..c1ea75c 100644
--- a/LibOVR/Src/Net/OVR_Socket.h
+++ b/LibOVR/Src/Net/OVR_Socket.h
@@ -36,6 +36,10 @@ limitations under the License.
// OS-specific socket headers
#if defined(OVR_OS_WIN32)
+#if defined(_WINSOCKAPI_) && !defined(OVR_CC_MSVC) && !defined(_WINSOCK2API_)
+/** Silent warning using mingw64, _WINSOCKAPI_ is disabled in ./LibOVRKernel/Src/Kernel/OVR_Win32_IncludeWindows.h */
+#undef _WINSOCKAPI_
+#endif /* defined(_WINSOCKAPI_) && !defined(OVR_CC_MSVC) && !defined(_WINSOCK2API_) */
#include <WinSock2.h>
#include <WS2tcpip.h>
#include "Kernel/OVR_Win32_IncludeWindows.h"
diff --git a/LibOVR/Src/Net/OVR_Win32_Socket.cpp b/LibOVR/Src/Net/OVR_Win32_Socket.cpp
index 3cd2ada..7daebd5 100644
--- a/LibOVR/Src/Net/OVR_Win32_Socket.cpp
+++ b/LibOVR/Src/Net/OVR_Win32_Socket.cpp
@@ -30,6 +30,10 @@ limitations under the License.
#include "Kernel/OVR_Threads.h" // Thread::MSleep
#include "Kernel/OVR_Log.h"
+#if defined(_WINSOCKAPI_) && !defined(OVR_CC_MSVC) && !defined(_WINSOCK2API_)
+/** Silent warning using mingw64, _WINSOCKAPI_ is disabled in ./LibOVRKernel/Src/Kernel/OVR_Win32_IncludeWindows.h */
+#undef _WINSOCKAPI_
+#endif /* defined(_WINSOCKAPI_) && !defined(OVR_CC_MSVC) && !defined(_WINSOCK2API_) */
#include <Winsock2.h>
#pragma comment(lib, "ws2_32.lib")
diff --git a/LibOVR/Src/Net/OVR_Win32_Socket.h b/LibOVR/Src/Net/OVR_Win32_Socket.h
index ed0a624..94c34ef 100644
--- a/LibOVR/Src/Net/OVR_Win32_Socket.h
+++ b/LibOVR/Src/Net/OVR_Win32_Socket.h
@@ -31,6 +31,10 @@ limitations under the License.
#include "OVR_Socket.h"
#include "OVR_BitStream.h"
+#if defined(_WINSOCKAPI_) && !defined(OVR_CC_MSVC) && !defined(_WINSOCK2API_)
+/** Silent warning using mingw64, _WINSOCKAPI_ is disabled in ./LibOVRKernel/Src/Kernel/OVR_Win32_IncludeWindows.h */
+#undef _WINSOCKAPI_
+#endif /* defined(_WINSOCKAPI_) && !defined(OVR_CC_MSVC) && !defined(_WINSOCK2API_) */
#include <WinSock2.h>
#include <WS2tcpip.h>
#include "Kernel/OVR_Win32_IncludeWindows.h"
diff --git a/LibOVR/Src/OVR_CAPI.cpp b/LibOVR/Src/OVR_CAPI.cpp
index e02151a..d06c885 100755
--- a/LibOVR/Src/OVR_CAPI.cpp
+++ b/LibOVR/Src/OVR_CAPI.cpp
@@ -272,7 +272,7 @@ OVR_PUBLIC_FUNCTION(ovrBool) ovr_Initialize(ovrInitParams const* params)
goto Abort;
}
-#if defined(OVR_OS_WIN32)
+#if defined(OVR_OS_WIN32) && !defined(HEADLESS_APP)
// Older than Windows 7 SP1?
if (!IsWindows7SP1OrGreater())
{
diff --git a/LibOVRKernel/Src/Tracing/Tracing.h b/LibOVRKernel/Src/Tracing/Tracing.h
index c14dc4a..1591a2c 100644
--- a/LibOVRKernel/Src/Tracing/Tracing.h
+++ b/LibOVRKernel/Src/Tracing/Tracing.h
@@ -32,7 +32,7 @@ limitations under the License.
// ***** OVR_ENABLE_ETW_TRACING definition (XXX default to on for windows builds?)
//
-#ifdef OVR_OS_WIN32
+#if defined(OVR_OS_WIN32) && defined(OVR_CC_MSVC)
#define OVR_ENABLE_ETW_TRACING
#endif
diff --git a/LibOVRKernel/Src/Util/Util_SystemInfo.cpp b/LibOVRKernel/Src/Util/Util_SystemInfo.cpp
index 5ebdf65..06fd4c7 100644
--- a/LibOVRKernel/Src/Util/Util_SystemInfo.cpp
+++ b/LibOVRKernel/Src/Util/Util_SystemInfo.cpp
@@ -34,6 +34,11 @@ limitations under the License.
#include <sys/utsname.h>
#endif
+#if defined(OVR_OS_WIN32) && !defined(OVR_CC_MSVC)
+// mingw64 .. for __cpuid(..)
+#include <intrin.h>
+#endif /* defined(OVR_OS_WIN32) && !defined(OVR_CC_MSVC) */
+
/*
// Disabled, can't link RiftConfigUtil
#ifdef OVR_OS_WIN32
@@ -149,7 +154,6 @@ const char * GetProcessInfo()
}
#ifdef OVR_OS_WIN32
-
String OSVersionAsString()
{
return GetSystemFileVersionString("\\kernel32.dll");
@@ -257,12 +261,22 @@ String GetProcessorInfo()
char brand[0x40] = {};
int cpui[4] = { -1 };
+#if defined(OVR_CC_MSVC)
__cpuidex(cpui, 0x80000002, 0);
+#else
+ // mingw64 ..
+ __cpuid(cpui, 0x80000002);
+#endif
//unsigned int blocks = cpui[0];
for (int i = 0; i <= 2; ++i)
{
+#if defined(OVR_CC_MSVC)
__cpuidex(cpui, 0x80000002 + i, 0);
+#else
+ // mingw64 ..
+ __cpuid(cpui, 0x80000002 + i);
+#endif
*reinterpret_cast<int*>(brand + i * 16) = cpui[0];
*reinterpret_cast<int*>(brand + 4 + i * 16) = cpui[1];
*reinterpret_cast<int*>(brand + 8 + i * 16) = cpui[2];