if (APPLE)
    if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm")
        SET (ONNXRUNTIME_PATH ${CMAKE_HOME_DIRECTORY}/third_party/onnxruntime/runtimes/osx.10.14-arm64/native/libonnxruntime_arm64.dylib)
    else (${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm")
        SET (ONNXRUNTIME_PATH ${CMAKE_HOME_DIRECTORY}/third_party/onnxruntime/runtimes/osx.10.14-x64/native/libonnxruntime_x64.dylib)
    endif (${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm")
elseif (MSVC)
    if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm")
        if (CMAKE_SIZEOF_VOID_P EQUAL 8)
            SET (ONNXRUNTIME_PATH ${CMAKE_HOME_DIRECTORY}/third_party/onnxruntime/runtimes/win-arm64/native/onnxruntime_arm64.dll)
        else (CMAKE_SIZEOF_VOID_P EQUAL 8)
            SET (ONNXRUNTIME_PATH ${CMAKE_HOME_DIRECTORY}/third_party/onnxruntime/runtimes/win-arm/native/onnxruntime_arm.dll)
        endif (CMAKE_SIZEOF_VOID_P EQUAL 8)
    else (${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm")
        if (CMAKE_SIZEOF_VOID_P EQUAL 8)
            SET (ONNXRUNTIME_PATH ${CMAKE_HOME_DIRECTORY}/third_party/onnxruntime/runtimes/win-x64/native/onnxruntime_x64.dll)
        else (CMAKE_SIZEOF_VOID_P EQUAL 8)
            SET (ONNXRUNTIME_PATH ${CMAKE_HOME_DIRECTORY}/third_party/onnxruntime/runtimes/win-x86/native/onnxruntime_x86.dll)
        endif (CMAKE_SIZEOF_VOID_P EQUAL 8)
    endif (${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm")
elseif (UNIX AND NOT ANDROID)
    if (${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm")
        SET (ONNXRUNTIME_PATH ${CMAKE_HOME_DIRECTORY}/third_party/onnxruntime/runtimes/linux-arm64/native/libonnxruntime_arm64.so)
    else (${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm")
        SET (ONNXRUNTIME_PATH ${CMAKE_HOME_DIRECTORY}/third_party/onnxruntime/runtimes/linux-x64/native/libonnxruntime_x64.so)
    endif (${CMAKE_SYSTEM_PROCESSOR} MATCHES "arm")
endif (APPLE)

if (NOT ANDROID)
    file (COPY ${ONNXRUNTIME_PATH} DESTINATION ${CMAKE_HOME_DIRECTORY}/csharp_package/brainflow/brainflow/lib/)
    file (COPY ${ONNXRUNTIME_PATH} DESTINATION ${CMAKE_HOME_DIRECTORY}/python_package/brainflow/lib/)
    file (COPY ${ONNXRUNTIME_PATH} DESTINATION ${CMAKE_HOME_DIRECTORY}/julia_package/brainflow/lib/)
    file (COPY ${ONNXRUNTIME_PATH} DESTINATION ${CMAKE_HOME_DIRECTORY}/java_package/brainflow/src/main/resources/)
    file (COPY ${ONNXRUNTIME_PATH} DESTINATION ${CMAKE_HOME_DIRECTORY}/matlab_package/brainflow/lib/)
    file (COPY ${ONNXRUNTIME_PATH} DESTINATION ${CMAKE_HOME_DIRECTORY}/rust_package/brainflow/lib/)
endif (NOT ANDROID)

install (
    FILES
    ${ONNXRUNTIME_PATH}
    DESTINATION lib
)