Mxgui qtsimulator on windows: Difference between revisions
Use templates |
No edit summary |
||
| Line 9: | Line 9: | ||
The recommended toolchain by the MSYS2 project at the current time is '''UCRT64''', which targets x86_64, uses the GCC compiler and the UCRT runtime. [https://learn.microsoft.com/en-us/cpp/windows/universal-crt-deployment?view=msvc-170 UCRT] is a modern C runtime for Windows, included with the OS since Windows 10, which removes the need to install the C runtime separately when distributing a program (as previously required). | The recommended toolchain by the MSYS2 project at the current time is '''UCRT64''', which targets x86_64, uses the GCC compiler and the UCRT runtime. [https://learn.microsoft.com/en-us/cpp/windows/universal-crt-deployment?view=msvc-170 UCRT] is a modern C runtime for Windows, included with the OS since Windows 10, which removes the need to install the C runtime separately when distributing a program (as previously required). | ||
{{Tip|Some trivia: before UCRT was introduced, the previous standard C runtime for MSYS2 was mingw. However, mingw was simply a wrapper augmenting an old Microsoft C runtime (''msvcrt.dll'') which for binary compatibility reasons is frozen in time since the release of Windows 95<ref>https://devblogs.microsoft.com/oldnewthing/20140411-00/?p=1273</ref>. As a result, mingw always had serious compatibility problems and bugs.}} | {{Tip|Some trivia: before UCRT was introduced, the previous standard C runtime for MSYS2 was mingw. However, mingw was simply a wrapper augmenting an old Microsoft C runtime (''msvcrt.dll'') which for binary compatibility reasons is frozen in time since the release of Windows 95<ref>https://devblogs.microsoft.com/oldnewthing/20140411-00/?p=1273</ref>. As a result, mingw always had serious compatibility problems and bugs.}} | ||
| Line 40: | Line 39: | ||
Install the dependencies for the simulator and the code generation tools: | Install the dependencies for the simulator and the code generation tools: | ||
{{Note|When installing qt5 type enter to install all packages.}} | {{Note|When installing qt5 type enter to install all packages.}} | ||
| Line 50: | Line 48: | ||
Let us assume you already cloned mxgui's repository somewhere on your filesystem. If you haven't, do it now. | Let us assume you already cloned mxgui's repository somewhere on your filesystem. If you haven't, do it now. | ||
{{Tip|For using git on Windows, we recommend the official distribution (Git for Windows: https://git-scm.com/install/windows) and TortoiseGit for shell integration and GUI support (https://tortoisegit.org). | {{Tip|For using git on Windows, we recommend the official distribution (Git for Windows: https://git-scm.com/install/windows) and TortoiseGit for shell integration and GUI support (https://tortoisegit.org). | ||
| Line 56: | Line 53: | ||
Then, change directory to the mxgui repository's root. | Then, change directory to the mxgui repository's root. | ||
{{Tip|Instead of typing the path manually, you can drag the directory on the terminal window to insert the path automatically.}} | {{Tip|Instead of typing the path manually, you can drag the directory on the terminal window to insert the path automatically.}} | ||
{{Warning|MSYS2 natively accepts only Unix-style paths with forward-slashes. Windows style paths with backslashes usually don't work.}} | {{Warning|MSYS2 natively accepts only Unix-style paths with forward-slashes. Windows style paths with backslashes usually don't work.}} | ||
| Line 105: | Line 101: | ||
[[File:Mxgui simulator on Windows 11.png|frame|center]] | [[File:Mxgui simulator on Windows 11.png|frame|center]] | ||
</div> | </div> | ||
{{Warning|If you double-click on the <code>qtsimulator.exe</code> executable in Windows Explorer, it probably won't work because of some missing DLLs. This is normal. The missing DLLs are located in <code>C:\msys64\ucrt64\bin</code>, a directory that the MSYS2 shell configuration adds to the PATH variable automatically, but is not normally included in PATH. | {{Warning|If you double-click on the <code>qtsimulator.exe</code> executable in Windows Explorer, it probably won't work because of some missing DLLs. This is normal. The missing DLLs are located in <code>C:\msys64\ucrt64\bin</code>, a directory that the MSYS2 shell configuration adds to the PATH variable automatically, but is not normally included in PATH. | ||
Latest revision as of 12:23, 23 July 2026
On windows, an easy way to compile the mxgui qtsimulator is to use the MSYS2 toolchain, which provides a Unix-like environment for Windows development.
1. Install MSYS2
Download the MSYS 2 toolchain by downloading the prebuilt packages from the official site https://www.msys2.org. Then, follow the instructions on the website to install it.
Different toolchains in MSYS2
MSYS2 itself is just a unix-like environment running on Windows, like its predecessor Cygwin. Within this environment, MSYS2 provides multiple toolchains which target different architectures (x86_64 or ARM), use different main compilers (GCC or clang), or a different C runtime library (UCRT or mingw).
The recommended toolchain by the MSYS2 project at the current time is UCRT64, which targets x86_64, uses the GCC compiler and the UCRT runtime. UCRT is a modern C runtime for Windows, included with the OS since Windows 10, which removes the need to install the C runtime separately when distributing a program (as previously required).
MSYS2 adds menu items to the Start menu which launch bash shells with pre-configured paths (environments) for each one of the toolchains.
All of the following steps are intended to be executed using the shell opened by clicking on MSYS2 UCRT64.
2. Install build tools and prerequisites
Open the MSYS2 UCRT64 shell and perform an upgrade:
pacman -Syuu
Answer Yes to all prompts. If a "base system upgrade" was needed, at this point the shell will close. In this case, just open it up again.
Install the toolchain (including gcc and binutils):
pacman -S mingw-w64-ucrt-x86_64-toolchain
Install build automation tools (note that only CMake has a special version depending on the toolchain here):
pacman -S make difftools mingw-w64-ucrt-x86_64-cmake
Install the dependencies for the simulator and the code generation tools:
pacman -S mingw-w64-ucrt-x86_64-qt5 mingw-w64-ucrt-x86_64-libpng mingw-w64-ucrt-x86_64-zlib mingw-w64-ucrt-x86_64-boost
3. Build the code generation tools
Let us assume you already cloned mxgui's repository somewhere on your filesystem. If you haven't, do it now.
Then, change directory to the mxgui repository's root.
cd /c/Users/me/Documents/mxgui
Change directory to _tools/code_generators:
cd _tools/code_generators
Build the code generators with CMake.
mkdir build cd build cmake .. make
4. Build the simulator
Now we only need to build the simulator. Change directory to the simulator's root:
cd ../../qtsimulator
Then build it like we did for the code generators:
mkdir build cd build cmake .. make
Now you should be able to run the simulator!
./qtsimulator.exe

