Mxgui qtsimulator on windows
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

