Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. #-------------------------------------------------------------------
  2. # This file is part of the CMake build system for OGRE
  3. # (Object-oriented Graphics Rendering Engine)
  4. # For the latest info, see http://www.ogre3d.org/
  5. #
  6. # The contents of this file are placed in the public domain. Feel
  7. # free to make use of it in any way you like.
  8. #-------------------------------------------------------------------
  9. # -----------------------------------------------------------------------------
  10. # Find DirectX SDK
  11. # Define:
  12. # DirectX_FOUND
  13. # DirectX_INCLUDE_DIR
  14. # DirectX_LIBRARY
  15. # DirectX_ROOT_DIR
  16. if(WIN32) # The only platform it makes sense to check for DirectX SDK
  17. include(FindPkgMacros)
  18. findpkg_begin(DirectX)
  19. # Get path, convert backslashes as ${ENV_DXSDK_DIR}
  20. getenv_path(DXSDK_DIR)
  21. getenv_path(DIRECTX_HOME)
  22. getenv_path(DIRECTX_ROOT)
  23. getenv_path(DIRECTX_BASE)
  24. # construct search paths
  25. set(DirectX_PREFIX_PATH
  26. "${DXSDK_DIR}" "${ENV_DXSDK_DIR}"
  27. "${DIRECTX_HOME}" "${ENV_DIRECTX_HOME}"
  28. "${DIRECTX_ROOT}" "${ENV_DIRECTX_ROOT}"
  29. "${DIRECTX_BASE}" "${ENV_DIRECTX_BASE}"
  30. "C:/apps_x86/Microsoft DirectX SDK*"
  31. "C:/Program Files (x86)/Microsoft DirectX SDK*"
  32. "C:/apps/Microsoft DirectX SDK*"
  33. "C:/Program Files/Microsoft DirectX SDK*"
  34. "$ENV{ProgramFiles}/Microsoft DirectX SDK*"
  35. )
  36. create_search_paths(DirectX)
  37. # redo search if prefix path changed
  38. clear_if_changed(DirectX_PREFIX_PATH
  39. DirectX_LIBRARY
  40. DirectX_INCLUDE_DIR
  41. )
  42. find_path(DirectX_INCLUDE_DIR NAMES d3d9.h HINTS ${DirectX_INC_SEARCH_PATH})
  43. # dlls are in DirectX_ROOT_DIR/Developer Runtime/x64|x86
  44. # lib files are in DirectX_ROOT_DIR/Lib/x64|x86
  45. if(CMAKE_CL_64)
  46. set(DirectX_LIBPATH_SUFFIX "x64")
  47. else(CMAKE_CL_64)
  48. set(DirectX_LIBPATH_SUFFIX "x86")
  49. endif(CMAKE_CL_64)
  50. find_library(DirectX_LIBRARY NAMES d3d9 HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
  51. find_library(DirectX_D3DX9_LIBRARY NAMES d3dx9 HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
  52. find_library(DirectX_DXERR_LIBRARY NAMES DxErr HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
  53. find_library(DirectX_DXGUID_LIBRARY NAMES dxguid HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
  54. # look for dxgi (needed by both 10 and 11)
  55. find_library(DirectX_DXGI_LIBRARY NAMES dxgi HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
  56. # look for d3dcompiler (needed by 11)
  57. find_library(DirectX_D3DCOMPILER_LIBRARY NAMES d3dcompiler HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
  58. findpkg_finish(DirectX)
  59. set(DirectX_LIBRARIES ${DirectX_LIBRARIES}
  60. ${DirectX_D3DX9_LIBRARY}
  61. ${DirectX_DXERR_LIBRARY}
  62. ${DirectX_DXGUID_LIBRARY}
  63. )
  64. mark_as_advanced(DirectX_D3DX9_LIBRARY DirectX_DXERR_LIBRARY DirectX_DXGUID_LIBRARY
  65. DirectX_DXGI_LIBRARY DirectX_D3DCOMPILER_LIBRARY)
  66. # look for D3D11 components
  67. if (DirectX_FOUND)
  68. find_path(DirectX_D3D11_INCLUDE_DIR NAMES D3D11Shader.h HINTS ${DirectX_INC_SEARCH_PATH})
  69. get_filename_component(DirectX_LIBRARY_DIR "${DirectX_LIBRARY}" PATH)
  70. message(STATUS "DX lib dir: ${DirectX_LIBRARY_DIR}")
  71. find_library(DirectX_D3D11_LIBRARY NAMES d3d11 HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
  72. find_library(DirectX_D3DX11_LIBRARY NAMES d3dx11 HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
  73. if (DirectX_D3D11_INCLUDE_DIR AND DirectX_D3D11_LIBRARY)
  74. set(DirectX_D3D11_FOUND TRUE)
  75. set(DirectX_D3D11_INCLUDE_DIR ${DirectX_D3D11_INCLUDE_DIR})
  76. set(DirectX_D3D11_LIBRARIES ${DirectX_D3D11_LIBRARIES}
  77. ${DirectX_D3D11_LIBRARY}
  78. ${DirectX_D3DX11_LIBRARY}
  79. ${DirectX_DXGI_LIBRARY}
  80. ${DirectX_DXERR_LIBRARY}
  81. ${DirectX_DXGUID_LIBRARY}
  82. ${DirectX_D3DCOMPILER_LIBRARY}
  83. )
  84. endif ()
  85. mark_as_advanced(DirectX_D3D11_INCLUDE_DIR DirectX_D3D11_LIBRARY DirectX_D3DX11_LIBRARY)
  86. endif ()
  87. endif(WIN32)