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+ # -----------------------------------------------------------------------------
11+ # Find DirectX9 SDK
12+ # Define:
13+ # DirectX9_FOUND
14+ # DirectX9_INCLUDE_DIR
15+ # DirectX9_LIBRARY
16+ # DirectX9_ROOT_DIR
17+
18+ if (WIN32 ) # The only platform it makes sense to check for DirectX9 SDK
19+ include (FindPkgMacros )
20+ findpkg_begin (DirectX9 )
21+
22+ # Get path, convert backslashes as ${ENV_DXSDK_DIR}
23+ getenv_path (DXSDK_DIR )
24+ getenv_path (DirectX_HOME )
25+ getenv_path (DirectX_ROOT )
26+ getenv_path (DirectX_BASE )
27+
28+ # construct search paths
29+ set (DirectX9_PREFIX_PATH
30+ "${DXSDK_DIR} " "${ENV_DXSDK_DIR} "
31+ "${DIRECTX_HOME} " "${ENV_DIRECTX_HOME} "
32+ "${DIRECTX_ROOT} " "${ENV_DIRECTX_ROOT} "
33+ "${DIRECTX_BASE} " "${ENV_DIRECTX_BASE} "
34+ "C:/apps_x86/Microsoft DirectX SDK*"
35+ "C:/Program Files (x86)/Microsoft DirectX SDK*"
36+ "C:/apps/Microsoft DirectX SDK*"
37+ "C:/Program Files/Microsoft DirectX SDK*"
38+ "$ENV{ProgramFiles} /Microsoft DirectX SDK*"
39+ )
40+
41+ create_search_paths (DirectX9 )
42+
43+ # redo search if prefix path changed
44+ clear_if_changed (DirectX9_PREFIX_PATH
45+ DirectX9_LIBRARY
46+ DirectX9_INCLUDE_DIR
47+ )
48+
49+ find_path (DirectX9_INCLUDE_DIR NAMES d3dx9.h DxErr.h HINTS ${DirectX9_INC_SEARCH_PATH} )
50+ # dlls are in DirectX9_ROOT_DIR/Developer Runtime/x64|x86
51+ # lib files are in DirectX9_ROOT_DIR/Lib/x64|x86
52+ if (CMAKE_CL_64 )
53+ set (DirectX9_LIBPATH_SUFFIX "x64" )
54+ else (CMAKE_CL_64 )
55+ set (DirectX9_LIBPATH_SUFFIX "x86" )
56+ endif (CMAKE_CL_64 )
57+ find_library (DirectX9_LIBRARY NAMES d3d9 HINTS ${DirectX9_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX9_LIBPATH_SUFFIX} )
58+ find_library (DirectX9_D3DX9_LIBRARY NAMES d3dx9 HINTS ${DirectX9_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX9_LIBPATH_SUFFIX} )
59+ find_library (DirectX9_DXERR_LIBRARY NAMES DxErr dxerr9 HINTS ${DirectX9_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX9_LIBPATH_SUFFIX} )
60+ find_library (DirectX9_DXGUID_LIBRARY NAMES dxguid HINTS ${DirectX9_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX9_LIBPATH_SUFFIX} )
61+
62+ findpkg_finish (DirectX9 )
63+ set (DirectX9_LIBRARIES ${DirectX9_LIBRARIES}
64+ ${DirectX9_D3DX9_LIBRARY}
65+ ${DirectX9_DXERR_LIBRARY}
66+ ${DirectX9_DXGUID_LIBRARY}
67+ )
68+
69+ mark_as_advanced (DirectX9_D3DX9_LIBRARY DirectX9_DXERR_LIBRARY DirectX9_DXGUID_LIBRARY
70+ DirectX9_DXGI_LIBRARY DirectX9_D3DCOMPILER_LIBRARY )
71+
72+ endif (WIN32 )
0 commit comments