diff --git a/CMakeLists.txt b/CMakeLists.txt index f2be1d7..7740dd5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -304,17 +304,30 @@ if (${WIN32}) set (DXC "${PROJECT_SOURCE_DIR}/lib/rt64/src/contrib/dxc/bin/x64/dxc.exe") add_compile_definitions(NOMINMAX) else() - if(CMAKE_SIZEOF_VOID_P EQUAL 8 AND CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|amd64|AMD64") - if (APPLE) - set (DXC "DYLD_LIBRARY_PATH=${PROJECT_SOURCE_DIR}/lib/rt64/src/contrib/dxc/lib/x64" "${PROJECT_SOURCE_DIR}/lib/rt64/src/contrib/dxc/bin/x64/dxc") - else() - set (DXC "LD_LIBRARY_PATH=${PROJECT_SOURCE_DIR}/lib/rt64/src/contrib/dxc/lib/x64" "${PROJECT_SOURCE_DIR}/lib/rt64/src/contrib/dxc/bin/x64/dxc") + find_program(DXC dxc) + if (DXC) + execute_process(COMMAND ${DXC} --version OUTPUT_VARIABLE DXC_VERSION) + string(REGEX MATCH "([0-9]+)\\.([0-9]+)" DXC_VERSION "${DXC_VERSION}") + + if (NOT DXC_VERSION VERSION_GREATER_EQUAL "1.8") + message(STATUS "DXC version is less than 1.8, using bundled DXC") + set(DXC "") endif() - else() - if (APPLE) - set (DXC "DYLD_LIBRARY_PATH=${PROJECT_SOURCE_DIR}/lib/rt64/src/contrib/dxc/lib/arm64" "${PROJECT_SOURCE_DIR}/lib/rt64/src/contrib/dxc/bin/arm64/dxc-macos") + endif() + + if (NOT DXC) + if(CMAKE_SIZEOF_VOID_P EQUAL 8 AND CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|amd64|AMD64") + if (APPLE) + set (DXC "DYLD_LIBRARY_PATH=${PROJECT_SOURCE_DIR}/lib/rt64/src/contrib/dxc/lib/x64" "${PROJECT_SOURCE_DIR}/lib/rt64/src/contrib/dxc/bin/x64/dxc") + else() + set (DXC "LD_LIBRARY_PATH=${PROJECT_SOURCE_DIR}/lib/rt64/src/contrib/dxc/lib/x64" "${PROJECT_SOURCE_DIR}/lib/rt64/src/contrib/dxc/bin/x64/dxc") + endif() else() - set (DXC "LD_LIBRARY_PATH=${PROJECT_SOURCE_DIR}/lib/rt64/src/contrib/dxc/lib/arm64" "${PROJECT_SOURCE_DIR}/lib/rt64/src/contrib/dxc/bin/arm64/dxc-linux") + if (APPLE) + set (DXC "DYLD_LIBRARY_PATH=${PROJECT_SOURCE_DIR}/lib/rt64/src/contrib/dxc/lib/arm64" "${PROJECT_SOURCE_DIR}/lib/rt64/src/contrib/dxc/bin/arm64/dxc-macos") + else() + set (DXC "LD_LIBRARY_PATH=${PROJECT_SOURCE_DIR}/lib/rt64/src/contrib/dxc/lib/arm64" "${PROJECT_SOURCE_DIR}/lib/rt64/src/contrib/dxc/bin/arm64/dxc-linux") + endif() endif() endif() endif() diff --git a/lib/rt64 b/lib/rt64 index e106c18..fcca86d 160000 --- a/lib/rt64 +++ b/lib/rt64 @@ -1 +1 @@ -Subproject commit e106c18965a89b26197bde972d9a83dd2dea1691 +Subproject commit fcca86d77afebb391e4a8e404cad46ba3ae883e3