FindDirectX9.cmake 1.6 KB

123456789101112131415161718192021222324252627282930313233
  1. # Find the DirectX 9 includes and library
  2. # This module defines:
  3. # DIRECTX9_INCLUDE_DIRS, where to find d3d9.h, etc.
  4. # DIRECTX9_LIBRARIES, libraries to link against to use DirectX.
  5. # DIRECTX9_FOUND, If false, do not try to use DirectX.
  6. # DIRECTX9_ROOT_DIR, directory where DirectX was installed.
  7. set(DIRECTX9_INCLUDE_PATHS
  8. "$ENV{DXSDK_DIR}/Include"
  9. "$ENV{DIRECTX_ROOT}/Include"
  10. "C:/Program Files (x86)/Microsoft DirectX SDK (June 2010)/Include"
  11. "C:/Program Files/Microsoft DirectX SDK (June 2010)/Include"
  12. )
  13. find_path(DIRECTX9_INCLUDE_DIRS d3dx9.h ${DIRECTX9_INCLUDE_PATHS} NO_DEFAULT_PATH)
  14. get_filename_component(DIRECTX9_ROOT_DIR "${DIRECTX9_INCLUDE_DIRS}/.." ABSOLUTE)
  15. if (CMAKE_SIZEOF_VOID_P EQUAL 8)
  16. set(DIRECTX9_LIBRARY_PATHS "${DIRECTX9_ROOT_DIR}/Lib/x64")
  17. else ()
  18. set(DIRECTX9_LIBRARY_PATHS "${DIRECTX9_ROOT_DIR}/Lib/x86" "${DIRECTX9_ROOT_DIR}/Lib")
  19. endif ()
  20. find_library(DIRECTX9_D3D9_LIBRARY d3d9 ${DIRECTX9_LIBRARY_PATHS} NO_DEFAULT_PATH)
  21. find_library(DIRECTX9_D3DX9_LIBRARY d3dx9 ${DIRECTX9_LIBRARY_PATHS} NO_DEFAULT_PATH)
  22. find_library(DIRECTX9_DXERR_LIBRARY DxErr ${DIRECTX9_LIBRARY_PATHS} NO_DEFAULT_PATH)
  23. set(DIRECTX9_LIBRARIES ${DIRECTX9_D3D9_LIBRARY} ${DIRECTX9_D3DX9_LIBRARY} ${DIRECTX9_DXERR_LIBRARY})
  24. # handle the QUIETLY and REQUIRED arguments and set DIRECTX9_FOUND to TRUE if all listed variables are TRUE
  25. include(FindPackageHandleStandardArgs)
  26. FIND_PACKAGE_HANDLE_STANDARD_ARGS(DirectX9 DEFAULT_MSG DIRECTX9_ROOT_DIR DIRECTX9_LIBRARIES DIRECTX9_INCLUDE_DIRS)
  27. mark_as_advanced(DIRECTX9_INCLUDE_DIRS DIRECTX9_D3D9_LIBRARY DIRECTX9_D3DX9_LIBRARY DIRECTX9_DXERR_LIBRARY)