Browse Source

Only find the DirectX SDK when compiling with Visual Studio, as the headers are incompatible with MinGW. Fixed export statements for MinGW. Closes #142.

Lasse Öörni 12 years ago
parent
commit
1c92bc3a09

+ 3 - 2
Source/CMake/Modules/Urho3D-CMake-magic.cmake

@@ -134,10 +134,11 @@ if (NOT URHO3D_LIB_TYPE STREQUAL SHARED)
     add_definitions (-DURHO3D_STATIC_DEFINE)
 endif ()
 
-# If using Windows, find DirectX SDK include & library directories.
+# Find DirectX SDK include & library directories if applicable. The headers in the SDK will
+# be incompatible with MinGW, so only search when using Visual Studio.
 # Note: if a recent Windows SDK is installed instead, it will be possible to compile without;
 # therefore do not log a fatal error in that case
-if (WIN32)
+if (MSVC)
     find_package (Direct3D)
     if (DIRECT3D_FOUND)
         include_directories (${DIRECT3D_INCLUDE_DIR})

+ 1 - 1
Source/Engine/Graphics/Direct3D9/D3D9Graphics.cpp

@@ -61,7 +61,7 @@
 
 // On Intel / NVIDIA setups prefer the NVIDIA GPU
 extern "C" {
-    _declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
+    __declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
 }
 
 namespace Urho3D

+ 1 - 1
Source/Engine/Graphics/OpenGL/OGLGraphics.cpp

@@ -80,7 +80,7 @@
 // On Intel / NVIDIA setups prefer the NVIDIA GPU
 #include <windows.h>
 extern "C" {
-    _declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
+    __declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
 }
 #endif