Skip to content

Windows Compilation

Requirements

  • Visual Studio 2019

  • ONNX runtime Git

  • CUDA v11.4 (Install with Custom Options and everything enabled)

  • CuDNN v8.2.2.6

  • GIT + GIT LFS

  • TensortRT v8.0.1.6

Package management for Windows development is done through Vcpkg

The following Vcpkg packages are currently required:

  • vcpkg install lua luasocket --triplet x64-windows
  • vcpkg install gstreamer gstreamer[plugins-good] gstreamer[plugins-ugly] --triplet x64-windows
  • vcpkg install opencv3[contrib] opencv3[cuda] opencv3[dnn] opencv3[world] opencv3[tbb] opencv3[ffmpeg] --triplet=x64-windows --recurse
  • vcpkg install paho-mqtt --triplet x64-windows
  • vcpkg install paho-mqttpp3 --triplet x64-windows
  • vcpkg install sdl2 --triplet x64-windows
  • vcpkg install gtest --triplet x64-windows
  • vcpkg install xtensor --triplet x64-windows
  • vcpkg install xsimd --triplet x64-windows

Currently we’re not able to use onnxruntime-gpu from vcpkg as it does not come with DirectML and TensorRT support.

ONNX Runtime

To properly build ONNXRuntime source, make sure you’ve installed CUDA drivers with the Custom Options instead of the Standard one, there is a feature (WinRT) that must be enabled and is not in the Standard option.

git clone https://github.com/microsoft/onnxruntime.git
git reset --hard c343f7cb43debe1d36aa745b79a18eed860dfa81

Replace the cmake/CMakeLists.txt file by this one: Link

Build script that can be used (inside onnxruntime git repo folder), exchange [?_FOLDER] with your machine real folders:

./build.bat --config RelWithDebInfo --build_shared_lib --parallel --use_cuda --cuda_version 11.4 --cuda_home "[CUDA_FOLDER]" --cudnn_home "[CUDNN_FOLDER]" --use_tensorrt --tensorrt_home "[TENSORRT_FOLDER] --use_dnnl --use_dml --cmake_generator "Visual Studio 16 2019" --skip_tests

If you’re still having problems, this link may help

See: Building ONNX Runtime with TensorRT, CUDA, DirectML

Visual Studio 2019

Modify CMakeSettings.json and set the path to your vcpkg install:

{
  "name": "CMAKE_TOOLCHAIN_FILE",
  "value": "F:/dev/vcpkg/scripts/buildsystems/vcpkg.cmake",
  "type": "STRING"
}

Some modules might have hardcoded paths due to the unavailability of a vcpkg or CMAKE FindPackage module. We should either create .cmake files for them or make the paths configurable in a global settings file.

C++ debugger extensions for Lua. Allows debugging Lua scripts, providing breakpoints and step by step code inside Lua files.

Link

Running the code

To properly run the code, a valid Assets folder must be copied to the generated application root folder.