当前位置: 首页 > 工具软件 > KlayGE > 使用案例 >

编译KlayGE,UniversalDXSDK项目报错

金嘉
2023-12-01

错误原因

路径设置问题

代码块

PROJECT(UniversalDXSDK)

CMAKE_MINIMUM_REQUIRED(VERSION 2.8.6)

IF(COMMAND cmake_policy)
    CMAKE_POLICY(SET CMP0003 NEW)
ENDIF(COMMAND cmake_policy)

SET(DXSDK_DIR "../..")
SET(KLAYGE_ROOT_DIR "${DXSDK_DIR}/../..")

INCLUDE(${KLAYGE_ROOT_DIR}/cmake/Common.cmake)
INCLUDE(${KLAYGE_ROOT_DIR}/cmake/Platform.cmake)
INCLUDE(${KLAYGE_ROOT_DIR}/cmake/Compiler.cmake)
INCLUDE(${KLAYGE_ROOT_DIR}/External/Build/CMake/ExternalCommon.cmake)

SET(KLAYGE_BIN_DIR "${DXSDK_DIR}/../../KlayGE/bin/${KLAYGE_PLATFORM_NAME}")
SET(D3DCOMPILER_NAME "d3dcompiler_47.dll")
SET(REL_PATH "External/Downloads/UniversalDXSDK.7z")
SET(SEVENZIP_PATH "${KLAYGE_ROOT_DIR}/External/Downloads/${KLAYGE_HOST_PLATFORM_NAME}/7z")
SET(PACKAGE_COMMIT_ID "ad787fbcbe77410ea25ebfe8b17644d8b1f38480")
SET(PACKAGE_FILE_ID "318ee1572dcd89b165eeb11297fda36a5d9cb035")

DOWNLOAD_PACKAGE("UniversalDXSDK" ${REL_PATH} ${PACKAGE_COMMIT_ID} ${PACKAGE_FILE_ID} "README.md")

IF(KLAYGE_PLATFORM_WINDOWS)
    SET(D3DCOMPILER_ARCH_NAME ${KLAYGE_ARCH_NAME})
ELSE()
    SET(D3DCOMPILER_ARCH_NAME "x86")
ENDIF()
SET(SRC_PATH "${DXSDK_DIR}/Redist/${D3DCOMPILER_ARCH_NAME}/${D3DCOMPILER_NAME}")
SET(REDIST_PATH "${KLAYGE_BIN_DIR}/${D3DCOMPILER_NAME}")
ADD_CUSTOM_COMMAND(OUTPUT ${REDIST_PATH}
    COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SRC_PATH} ${REDIST_PATH})
ADD_CUSTOM_TARGET(Redist ALL DEPENDS ${REDIST_PATH})

解决办法

修改 DXSDK_DIR,如上代码。

 类似资料: