Browse Source

Find DirectX SDK to avoid needing it as a global Visual Studio directory.

Lasse Öörni 12 years ago
parent
commit
090eb3aafa
3 changed files with 39 additions and 4 deletions
  1. 37 0
      CMakeLists.txt
  2. 1 1
      Docs/GettingStarted.dox
  3. 1 3
      Readme.txt

+ 37 - 0
CMakeLists.txt

@@ -208,6 +208,43 @@ endmacro ()
 # Add SDL as a global include directory
 include_directories (ThirdParty/SDL/include)
 
+# If using Windows and not OpenGL, find DirectX SDK include & library directories
+# Based on realXtend Tundra CMake build system (https://github.com/realXtend/naali)
+if (WIN32 AND NOT USE_OPENGL)
+    find_path(DirectX_INCLUDE_DIR d3dx9.h
+        "$ENV{DIRECTX_ROOT}/Include"
+        "$ENV{DXSDK_DIR}/Include"
+        "C:/apps_x86/Microsoft DirectX SDK*/Include"
+        "C:/Program Files (x86)/Microsoft DirectX SDK*/Include"
+        "C:/apps/Microsoft DirectX SDK*/Include"
+        "C:/Program Files/Microsoft DirectX SDK*/Include")
+
+    if (CMAKE_CL_64)
+        set (DirectX_LIBRARY_PATHS
+            "$ENV{DIRECTX_ROOT}/Lib/x64"
+            "$ENV{DXSDK_DIR}/Lib/x64"
+            "C:/Program Files (x86)/Microsoft DirectX SDK*/Lib/x64"
+            "C:/Program Files/Microsoft DirectX SDK*/Lib/x64")
+    else ()
+        set (DirectX_LIBRARY_PATHS
+            "$ENV{DIRECTX_ROOT}/Lib"
+            "$ENV{DIRECTX_ROOT}/Lib/x86"
+            "$ENV{DXSDK_DIR}/Lib"
+            "$ENV{DXSDK_DIR}/Lib/x86"
+            "C:/Program Files (x86)/Microsoft DirectX SDK*/Lib"
+            "C:/Program Files (x86)/Microsoft DirectX SDK*/Lib/x86"
+            "C:/Program Files/Microsoft DirectX SDK*/Lib"
+            "C:/Program Files/Microsoft DirectX SDK*/Lib/x86")
+    endif ()
+        
+    find_path (DirectX_LIBRARY_DIR d3d9.lib ${DirectX_LIBRARY_PATHS})
+
+    if (DirectX_INCLUDE_DIR AND DirectX_LIBRARY_DIR)
+        include_directories (${DirectX_INCLUDE_DIR})
+        link_directories (${DirectX_LIBRARY_DIR})
+    endif ()
+endif ()
+
 # Add projects
 add_subdirectory (Engine/Audio)
 add_subdirectory (Engine/Container)

+ 1 - 1
Docs/GettingStarted.dox

@@ -8,7 +8,7 @@ namespace Urho3D
 
 Although all required third-party libraries are included as source code, there are system-level dependencies that must be satisfied before Urho3D can be built successfully:
 
-- For Windows, the June 2010 DirectX SDK needs to be installed and its include and library directories set as Visual Studio global directories (Tools -> Options -> Projects and Solutions -> VC++ Directories in VS2008.)
+- For Windows, the June 2010 DirectX SDK needs to be installed.
 
 - For Linux, the following development packages need to be installed: libx11-dev, libxrandr-dev, libasound2-dev. Also install the package libgl1-mesa-dev if your GPU driver does not include OpenGL headers & libs.  Building as 32-bit on a 64-bit system requires installing also the 32-bit versions of the development libraries.
 

+ 1 - 3
Readme.txt

@@ -102,9 +102,7 @@ Although all required third-party libraries are included as source code, there
 are system-level dependencies that must be satisfied before Urho3D can be built
 successfully:
 
-- For Windows, the June 2010 DirectX SDK needs to be installed and its include 
-  and library directories set as Visual Studio global directories (Tools -> 
-  Options -> Projects and Solutions -> VC++ Directories in VS2008.)
+- For Windows, the June 2010 DirectX SDK needs to be installed.
 
 - For Linux, the following development packages need to be installed:
   libx11-dev, libxrandr-dev, libasound2-dev. Also install the package