MyGUI build error. Could not locate DirectX

 MyGUI 렌더시스템을 오우거3D가 아닌 DX로 해주고 빌드했더니 아래와 같은 에러가 발생했습니다.

c:\Users\wwforever.NOWCOM\Downloads\MyGUI_3.2.0>cmake -DMYGUI_RENDERSYSTEM=1 -G

"Visual Studio 7 .NET 2003"
-- Configuring MYGUI 3.2.0
-- Looking for FREETYPE...
-- Could NOT find PkgConfig (missing:  PKG_CONFIG_EXECUTABLE)
-- CMAKE_PREFIX_PATH: Dependencies;C:/Users/wwforever.NOWCOM/Downloads/MyGUI_3.2.0/Dependencies;C:/Users/wwforever.NOWCOM/Downloads/MyGUI_3.2.0/Dependencies;C:/Users/wwforever.NOWCOM/Downloads/MyGUI_3.2.0/../Dependencies;C:/Users/wwforever.NOWCOM/Downloads/MyGUI_3.2.0/../Dependencies
-- Could not locate FREETYPE
-- Looking for DirectX...
-- DirectX_PREFIX_PATH changed.
-- Could not locate DirectX
-- Looking for DirectX11...
-- DirectX_PREFIX_PATH changed.
-- Could not locate DirectX11
-- Could NOT find Doxygen (missing:  DOXYGEN_EXECUTABLE)
CMake Error at CMake/Utils/MacroLogFeature.cmake:91 (MESSAGE):



  -----------------------------------------------------------------------------


  -- The following REQUIRED packages could NOT be located on your system.

  -- Please install them before continuing this software installation.

  -- If you are in Windows, try passing -DMYGUI_DEPENDENCIES_DIR=<path to
  dependencies>

  -- Also check that you buildind with RenderSystem that you need or set
  another with -DMYGUI_RENDERSYSTEM=<1 2 or 3 for Direct3D_9 OGRE or OpenGL>


  -----------------------------------------------------------------------------


  + freetype: Portable font engine <http://www.freetype.org>

  + DirectX: Support for the DirectX render system
  <http://msdn.microsoft.com/en-us/directx/>


  -----------------------------------------------------------------------------
Call Stack (most recent call first):
  CMake/Dependencies.cmake:108 (MACRO_DISPLAY_FEATURE_LOG)
  CMakeLists.txt:232 (include)


-- Configuring incomplete, errors occurred!


 붉은색 부분을 보면 다이렉트X를 못 찾는다고 하는 에러입니다. 보통은 다이렉트X SDK를 설치했다면 환경변수에 추가가 되어있기때문에 잘 될듯 한데요, 저는 설치하지 않고 저희 프로젝트가 사용중인 설치된 DX를 SVN으로 받아서 사용하다보니 이런 에러가 발생한 듯합니다.

 해결하려면 MyGUI_3.2.0 설치 디렉터리/CMake/Packages/FindDirectX.cmake 파일을 수정해야합니다. 일달 파일의 내용은 아래와 같습니다.


# -----------------------------------------------------------------------------
# Find DirectX SDK
# Define:
# DirectX_FOUND
# DirectX_INCLUDE_DIR
# DirectX_LIBRARY

if (MYGUI_STANDALONE_BUILD)
SET(DirectX_INCLUDE_DIR "C:/MYGUIHACK DXSDK_DIR MYGUIBRACKETHACK/include" CACHE STRING "")
SET(DirectX_LIBRARIES "d3d9.lib d3dx9.lib DxErr.lib dxguid.lib" CACHE STRING "")
SET(DIRECTX_LIB_DIR "C:/MYGUIHACK DXSDK_DIR MYGUIBRACKETHACK/lib/x86" CACHE STRING "")
SET(DirectX_FOUND TRUE)
SET(DirectX11_INCLUDE_DIR "C:/MYGUIHACK DXSDK_DIR MYGUIBRACKETHACK/include" CACHE STRING "")
SET(DirectX11_LIBRARIES "d3d11.lib d3dx11.lib DxErr.lib dxguid.lib dxgi.lib d3dcompiler.lib" CACHE STRING "")
SET(DIRECTX11_LIB_DIR "C:/MYGUIHACK DXSDK_DIR MYGUIBRACKETHACK/lib/x86" CACHE STRING "")
SET(DirectX11_FOUND TRUE)
else()
IF (NOT DIRECTX_DIR)
set(DIRECTX_DIR "" CACHE PATH "Path to DirectX SDK (set it if you don't have DIrectX SDK properly installed or CMake can't find path to it)")
ENDIF ()

if(WIN32) # The only platform it makes sense to check for DirectX SDK
include(FindPkgMacros)
findpkg_begin(DirectX)

# Get path, convert backslashes as ${ENV_DXSDK_DIR}
getenv_path(DXSDK_DIR)

# construct search paths
set(DirectX_PREFIX_PATH
"${DIRECTX_DIR}"
"${DXSDK_DIR}"
"${ENV_DXSDK_DIR}"
"C:/apps_x86/Microsoft DirectX SDK*"
"C:/Program Files (x86)/Microsoft DirectX SDK*"
"C:/apps/Microsoft DirectX SDK*"
"C:/Program Files/Microsoft DirectX SDK*"
"$ENV{ProgramFiles}/Microsoft DirectX SDK*"
"D:/MyDXSDK/DirectX_Oct2005"
)
create_search_paths(DirectX)
# redo search if prefix path changed
clear_if_changed(DirectX_PREFIX_PATH
DirectX_LIBRARY
DirectX_INCLUDE_DIR
)

find_path(DirectX_INCLUDE_DIR NAMES d3d9.h HINTS ${DirectX_INC_SEARCH_PATH})
# dlls are in DIRECTX_DIR/Developer Runtime/x64|x86
# lib files are in DIRECTX_DIR/Lib/x64|x86
if(CMAKE_CL_64)
set(DirectX_LIBPATH_SUFFIX "x64")
else(CMAKE_CL_64)
set(DirectX_LIBPATH_SUFFIX "x86")
endif(CMAKE_CL_64)
find_library(DirectX_LIBRARY NAMES d3d9 HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
find_library(DirectX_D3DX9_LIBRARY NAMES d3dx9 HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
find_library(DirectX_DXERR9_LIBRARY NAMES dxerr HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
find_library(DirectX_DXGUID_LIBRARY NAMES dxguid HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})

if(DirectX_INCLUDE_DIR)
if (NOT DIRECTX_DIR)
set(DIRECTX_DIR ${DirectX_INCLUDE_DIR}/.. CACHE PATH "Path to DirectX SDK (set it if you don't have DIrectX SDK properly installed or CMake can't find path to it)" FORCE)
endif ()
endif(DirectX_INCLUDE_DIR)


findpkg_finish(DirectX)
set(DirectX_LIBRARIES ${DirectX_LIBRARIES}
${DirectX_D3DX9_LIBRARY}
${DirectX_DXERR9_LIBRARY}
${DirectX_DXGUID_LIBRARY}
)

endif(WIN32)


if(WIN32) # The only platform it makes sense to check for DirectX11 SDK
include(FindPkgMacros)
findpkg_begin(DirectX11)

# Get path, convert backslashes as ${ENV_DXSDK_DIR}
getenv_path(DXSDK_DIR)

# construct search paths
set(DirectX_PREFIX_PATH
"${DIRECTX_DIR}"
"${DXSDK_DIR}"
"${ENV_DXSDK_DIR}"
"C:/apps_x86/Microsoft DirectX SDK*"
"C:/Program Files (x86)/Microsoft DirectX SDK*"
"C:/apps/Microsoft DirectX SDK*"
"C:/Program Files/Microsoft DirectX SDK*"
"$ENV{ProgramFiles}/Microsoft DirectX SDK*"
)
create_search_paths(DirectX)
# redo search if prefix path changed
clear_if_changed(DirectX_PREFIX_PATH
DirectX11_LIBRARY
DirectX11_INCLUDE_DIR
)

find_path(DirectX11_INCLUDE_DIR NAMES d3d11.h HINTS ${DirectX_INC_SEARCH_PATH})
# dlls are in DIRECTX_DIR/Developer Runtime/x64|x86
# lib files are in DIRECTX_DIR/Lib/x64|x86
if(CMAKE_CL_64)
set(DirectX_LIBPATH_SUFFIX "x64")
else(CMAKE_CL_64)
set(DirectX_LIBPATH_SUFFIX "x86")
endif(CMAKE_CL_64)
find_library(DirectX11_D3D11_LIBRARY NAMES d3d11 HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
find_library(DirectX11_D3DX11_LIBRARY NAMES d3dx11 HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
find_library(DirectX11_DXGUID_LIBRARY NAMES dxguid HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
find_library(DirectX11_DXGI_LIBRARY NAMES dxgi HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
find_library(DirectX11_DXERR_LIBRARY NAMES dxerr HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})
find_library(DirectX11_COMPILER_LIBRARY NAMES d3dcompiler HINTS ${DirectX_LIB_SEARCH_PATH} PATH_SUFFIXES ${DirectX_LIBPATH_SUFFIX})

if(DirectX11_INCLUDE_DIR)
if (NOT DIRECTX_DIR)
set(DIRECTX_DIR ${DirectX11_INCLUDE_DIR}/.. CACHE PATH "Path to DirectX SDK (set it if you don't have DIrectX SDK properly installed or CMake can't find path to it)" FORCE)
endif ()
endif(DirectX11_INCLUDE_DIR)

findpkg_finish(DirectX11)
set(DirectX11_LIBRARIES ${DirectX11_LIBRARIES}
${DirectX11_D3D11_LIBRARY}
${DirectX11_D3DX11_LIBRARY}
${DirectX11_DXGI_LIBRARY}
${DirectX11_DXGUID_LIBRARY}
${DirectX11_DXERR_LIBRARY}
${DirectX11_COMPILER_LIBRARY}
)

endif(WIN32)
endif ()


 30라인쯤에 있는 set(DirectX_PREFIX_PATH 의 끝 부분에 위에 붉은색으로 추가한 것처럼 각자의 DXSDK 위치를 추가해줍니다. 여기서 보통 D:\MyDXSDK\DirectX_Oct2005 와 같이 \로 하게되면,


CMake Warning (dev) at CMake/Packages/FindDirectX.cmake:30 (set):
  Syntax error in cmake code at

    C:/Users/wwforever.NOWCOM/Downloads/MyGUI_3.2.0/CMake/Packages/FindDirectX.c
make:39

  when parsing string

    D:\MyDXSDK\DirectX_Oct2005

  Invalid escape sequence \M


 이런 파싱 에러가 발생하므로 \ 말고 / 로 해줘야 합니다. DirectX_Oct2005는 저희가 이걸 사용중이라 이런 구버전으로 한거구요 각자 설치한 SDK용으로 해주시면 됩니다.

이 블로그의 인기 게시물

CMake Windows에 설치하기

'xxx.exe' 프로그램을 시작할 수 없습니다. 지정된 파일을 찾을 수 없습니다.

Unity3D 안드로이드 Keystore 생성하기