Skip to content

Instantly share code, notes, and snippets.

@stofte
Last active November 5, 2018 19:31
Show Gist options
  • Save stofte/91942f124dfebb875038ad2131fe25e7 to your computer and use it in GitHub Desktop.
Save stofte/91942f124dfebb875038ad2131fe25e7 to your computer and use it in GitHub Desktop.

How to build todo application in rust_qt_bindings_generator on Windows 10 x64

Versions tested

  • Windows 10 (17134.345)
  • Qt 5.11.2
  • cmake 3.12.2
  • rust 1.30.0
  • VS 2017 x64 native devtools (eg Windows SDK and MSVC)

Build steps

  • git clone repository locally. For the example C:\src\rust-qt-binding-generator
  • cargo build --release
    • Add the binary folder to the $PATH variable
  • open the todos example folder and open CMakeLists.txt
  • Change librust.a to rust.lib in line 40
  • Add WS2_32.LIB Userenv.lib in line 64
  • cmake -G "Visual Studio 15 2017 Win64" -DCMAKE_PREFIX_PATH=C:\Qt\5.11.2\msvc2017_64\lib\cmake
  • Open a VS prompt (eg "Develop Command Prompt for VS2017")
    • Build the cmake generated solution msbuild /p:Configuration=Release ALL_BUILD.vcxproj
    • This is the only command which requires the dev prompt. Rest should work in normal cmd.exe.
  • Add the required Qt libs. Open C:\Qt\5.11.2\msvc2017_64\bin and execute windeployqt.exe C:\src\rust-qt-binding-generator\examples\todos\Release\todos.exe --qmldir C:\src\rust-qt-binding-generator\examples\todos
  • Start todos.exe! You might want to set the following variables so the app looks as intended
    • set QT_QUICK_CONTROLS_MATERIAL_THEME=Dark
    • set QT_QUICK_CONTROLS_STYLE=Material

If the app crashes on startup, your OpenGL driver might be misbehaving. Set these variables to workaround

  • set QT_OPENGL=software
  • set QT_ANGLE_PLATFORM=

Result

todo app

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment