[Orxonox-commit 3383] r8070 - in code/branches/mac_osx: cmake src/external/ois src/external/ois/win32

rgrieder at orxonox.net rgrieder at orxonox.net
Sun Mar 13 23:30:29 CET 2011


Author: rgrieder
Date: 2011-03-13 23:30:29 +0100 (Sun, 13 Mar 2011)
New Revision: 8070

Modified:
   code/branches/mac_osx/cmake/PackageConfigMSVC.cmake
   code/branches/mac_osx/cmake/PackageConfigMinGW.cmake
   code/branches/mac_osx/src/external/ois/CMakeLists.txt
   code/branches/mac_osx/src/external/ois/changes_orxonox.diff
   code/branches/mac_osx/src/external/ois/win32/Win32JoyStick.cpp
Log:
Fixed OIS v1.3 build for MinGW 3.4 and hopefully also for the new versions.
This fix needs some additional files in the dependency package though.

Modified: code/branches/mac_osx/cmake/PackageConfigMSVC.cmake
===================================================================
--- code/branches/mac_osx/cmake/PackageConfigMSVC.cmake	2011-03-13 21:05:11 UTC (rev 8069)
+++ code/branches/mac_osx/cmake/PackageConfigMSVC.cmake	2011-03-13 22:30:29 UTC (rev 8070)
@@ -55,6 +55,8 @@
   # to specify the libraries ourselves.
   SET(TCL_LIBRARY  ${DEP_LIBRARY_DIR}/tcl85.lib CACHE FILEPATH "")
   SET(ZLIB_LIBRARY ${DEP_LIBRARY_DIR}/zdll.lib  CACHE FILEPATH "")
+  # Part of Platform SDK and usually gets linked automatically
+  SET(WMI_LIBRARY  wbemuuid.lib)
 
   # Visual Leak Detector
   SET(VLD_INCLUDE_DIR  ${DEP_INCLUDE_DIR}/vld   CACHE PATH "")

Modified: code/branches/mac_osx/cmake/PackageConfigMinGW.cmake
===================================================================
--- code/branches/mac_osx/cmake/PackageConfigMinGW.cmake	2011-03-13 21:05:11 UTC (rev 8069)
+++ code/branches/mac_osx/cmake/PackageConfigMinGW.cmake	2011-03-13 22:30:29 UTC (rev 8070)
@@ -49,4 +49,8 @@
   SET(TCL_LIBRARY  ${DEP_BINARY_DIR}/tcl85.dll CACHE FILEPATH "")
   SET(ZLIB_LIBRARY ${DEP_BINARY_DIR}/zlib1.dll CACHE FILEPATH "")
 
+  # Not included in MinGW, so we need to supply it for OIS
+  SET(WMI_INCLUDE_DIR ${DEP_INCLUDE_DIR}/wmi/include)
+  SET(WMI_LIBRARY     ${DEP_LIBRARY_DIR}/wbemuuid.lib)
+
 ENDIF(MINGW)

Modified: code/branches/mac_osx/src/external/ois/CMakeLists.txt
===================================================================
--- code/branches/mac_osx/src/external/ois/CMakeLists.txt	2011-03-13 21:05:11 UTC (rev 8069)
+++ code/branches/mac_osx/src/external/ois/CMakeLists.txt	2011-03-13 22:30:29 UTC (rev 8070)
@@ -55,6 +55,11 @@
 # Some unexplained hackery for Visual Studio 2005
 ADD_COMPILER_FLAGS("-D_WIN32_DCOM" MSVC8)
 
+# MinGW doesn't come with some required Windows headers
+IF(MINGW)
+  INCLUDE_DIRECTORIES(${WMI_INCLUDE_DIR})
+ENDIF()
+
 ORXONOX_ADD_LIBRARY(ois_orxonox
   ORXONOX_EXTERNAL
   DEFINE_SYMBOL
@@ -66,7 +71,7 @@
 )
 
 IF(WIN32)
-  TARGET_LINK_LIBRARIES(ois_orxonox ${DIRECTX_LIBRARIES})
+  TARGET_LINK_LIBRARIES(ois_orxonox ${DIRECTX_LIBRARIES} ${WMI_LIBRARY})
 ELSEIF(APPLE)
   TARGET_LINK_LIBRARIES(ois_orxonox "/System/Library/Frameworks/IOKit.framework" "/System/Library/Frameworks/Carbon.framework")
 ENDIF()

Modified: code/branches/mac_osx/src/external/ois/changes_orxonox.diff
===================================================================
--- code/branches/mac_osx/src/external/ois/changes_orxonox.diff	2011-03-13 21:05:11 UTC (rev 8069)
+++ code/branches/mac_osx/src/external/ois/changes_orxonox.diff	2011-03-13 22:30:29 UTC (rev 8070)
@@ -48,6 +48,49 @@
    #include <iostream>
 
 
+--- win32/Win32JoyStick.cpp
++++ win32/Win32JoyStick.cpp
+@@ -26,6 +26,14 @@
+ #include "OISEvents.h"
+ #include "OISException.h"
+ 
++// (Orxonox): Required for MinGW to compile properly
++#ifdef __MINGW32__
++#  include <oaidl.h>
++#  ifndef __MINGW_EXTENSION
++#    define __MINGW_EXTENSION __extension__
++#  endif
++#endif
++
+ #include <cassert>
+ #include <wbemidl.h>
+ #include <oleauto.h>
+@@ -39,6 +47,11 @@
+    }
+ #endif
+ 
++// (Orxonox): MinGW doesn't have swscanf_s
++#ifdef __MINGW32__
++#	define swscanf_s swscanf
++#endif
++
+ #ifdef OIS_WIN32_XINPUT_SUPPORT
+ #	pragma comment(lib, "xinput.lib")
+ #endif
+@@ -583,7 +596,12 @@
+     bool bCleanupCOM = SUCCEEDED(hr);
+ 
+     // Create WMI
++    // (Orxonox): Fix for MinGW
++#ifdef __MINGW32__
++    hr = CoCreateInstance(CLSID_WbemLocator, NULL, CLSCTX_INPROC_SERVER, IID_IWbemLocator, (LPVOID*)&pIWbemLocator);
++#else
+     hr = CoCreateInstance(__uuidof(WbemLocator), NULL, CLSCTX_INPROC_SERVER, __uuidof(IWbemLocator), (LPVOID*)&pIWbemLocator);
++#endif
+     if( FAILED(hr) || pIWbemLocator == NULL )
+         goto LCleanup;
+ 
+
 --- mac/MacHIDManager.cpp
 +++ mac/MacHIDManager.cpp
 @@ -406,6 +406,7 @@

Modified: code/branches/mac_osx/src/external/ois/win32/Win32JoyStick.cpp
===================================================================
--- code/branches/mac_osx/src/external/ois/win32/Win32JoyStick.cpp	2011-03-13 21:05:11 UTC (rev 8069)
+++ code/branches/mac_osx/src/external/ois/win32/Win32JoyStick.cpp	2011-03-13 22:30:29 UTC (rev 8070)
@@ -26,6 +26,14 @@
 #include "OISEvents.h"
 #include "OISException.h"
 
+// (Orxonox): Required for MinGW to compile properly
+#ifdef __MINGW32__
+#  include <oaidl.h>
+#  ifndef __MINGW_EXTENSION
+#    define __MINGW_EXTENSION __extension__
+#  endif
+#endif
+
 #include <cassert>
 #include <wbemidl.h>
 #include <oleauto.h>




More information about the Orxonox-commit mailing list