if(DEFINED ANDROID_ABI)
    message(FATAL_ERROR "[tensorflow] unsupported platform")
elseif(MSVC_VERSION)
    if(INFERENCE_HELPER_ENABLE_TENSORFLOW_GPU)
        set(TENSORFLOW_ROOTDIR "${CMAKE_CURRENT_LIST_DIR}/../tensorflow_prebuilt/win-x64-gpu")
    else()
        set(TENSORFLOW_ROOTDIR "${CMAKE_CURRENT_LIST_DIR}/../tensorflow_prebuilt/win-x64")
    endif()
else()
    if(${BUILD_SYSTEM} STREQUAL "armv7")
        message(FATAL_ERROR "[tensorflow] unsupported platform")
    elseif(${BUILD_SYSTEM} STREQUAL "aarch64")
        message(FATAL_ERROR "[tensorflow] unsupported platform")
    else()
        if(INFERENCE_HELPER_ENABLE_TENSORFLOW_GPU)
            set(TENSORFLOW_ROOTDIR "${CMAKE_CURRENT_LIST_DIR}/../tensorflow_prebuilt/linux-x64-gpu")
        else()
            set(TENSORFLOW_ROOTDIR "${CMAKE_CURRENT_LIST_DIR}/../tensorflow_prebuilt/linux-x64")
        endif()
    endif()
endif()

if(DEFINED ANDROID_ABI)
    message(FATAL_ERROR "[tensorflow] unsupported platform")
else()
    if(MSVC_VERSION)
        set(TENSORFLOW_LIB ${TENSORFLOW_ROOTDIR}/lib/tensorflow.lib)
        # Copy dll files into the binary directory
        file(GLOB DLL_FILES files "${TENSORFLOW_ROOTDIR}/lib/*.dll")
        file(COPY ${DLL_FILES} DESTINATION ${CMAKE_BINARY_DIR})
        # Ensure to use pre-built tensorflow.dll rather than that in system folder
        file(COPY ${DLL_FILES} DESTINATION ${CMAKE_BINARY_DIR}/Debug)
        file(COPY ${DLL_FILES} DESTINATION ${CMAKE_BINARY_DIR}/RelWithDebInfo)
        file(COPY ${DLL_FILES} DESTINATION ${CMAKE_BINARY_DIR}/Release)
    else()
        set(TENSORFLOW_LIB ${TENSORFLOW_ROOTDIR}/lib/libtensorflow.so)
    endif()

    set(TENSORFLOW_INC "${TENSORFLOW_ROOTDIR}/include")
endif()
