Compile Met.3D from source code: Windows ======================================== This page describes how to setup a development environment to compile Met.3D from its source code on Windows. We are using `vcpkg`_ for package management. It will automatically build all third-party dependencies and save them in a dedicated folder. .. important:: The installation procedure described here only works for **Met.3D v2.0** and higher versions. Older versions are not natively supported on Windows. .. note:: A source build of Met.3D takes roughly **33 GB** of space for its dependencies and an additional **4GB** of space for each of its build directories. This is necessary for `vcpkg`_ to store the build artefacts of all dependencies of Met.3D. Prerequisites ------------- The following tools are required to build Met.3D on Windows. 1. `Visual Studio 2026`_, which installs MSVC, CMake and Ninja 2. A Fortran compiler such as the `Intel oneAPI Fortran Compiler`_ 3. `vcpkg`_ 4. `git`_ 1. Setup and install MSVC ------------------------- Met.3D currently only supports compilation with MSVC on Windows. Download and install it and `Visual Studio 2026`_. Select the *Desktop C++* and optionally *Cross-platform C++* support for cross-compiling. Deselect the *vcpkg package manager* under *individual components*. The bundled one behaves slightly differently than a bootstrapped vcpkg, and it might not compile Met.3D due to an issue with a dependency. 2. Setup and install a Fortran compiler --------------------------------------- Met.3D requires a fortran compiler to be installed. We used the `Intel oneAPI Fortran Compiler`_. Download the windows offline installer and install it. Choose the recommended installation and the Visual Studio integration. Once the installation is finished, a new start entry for the *Intel oneAPI command prompt* should appear. 3. Bootstrap vcpkg ------------------ You will also need a `vcpkg`_ installation. If you want another location you can bootstrap it as follows:: git clone https://github.com/microsoft/vcpkg.git cd vcpkg; .\bootstrap-vcpkg.bat Next you have to set the ``VCPKG_ROOT`` environment variable to your vcpkg installation. This is required, so that Met.3D can find the vcpkg installation. 4. Get the source code ---------------------- Next you can clone the Met.3D repository to a location of your choosing:: git clone https://gitlab.com/wxmetvis/met.3d.git 5. Building Met.3D from source in the terminal ---------------------------------------------- Finally, you can build Met.3D from source. Even though we recommend an IDE for development, this section will outline the steps necessary to build it from terminal. Open the Intel oneAPI command prompt from the start menu. If you haven't already, you can set ``VCPKG_ROOT`` for this terminal session via ``set VCPKG_ROOT=\Path\To\vcpkg``. Then, navigate to the Met.3D repository and execute the following commands:: cmake --preset win-x64-debug cmake --preset win-x64-release These two commands, will create two build folders, one for a release build and one for a debug build. .. note:: If your configuration step fails with an error, especially when the last build library in the output is ``qtdeclerative``, please check your ``VCPKG_ROOT`` with ``set VCPKG_ROOT`` and the vcpkg executable via ``where vcpkg``. The first should return your bootstrapped vcpkg, while the second command should return nothing. If you installed Visual Studio with the bundled vcpkg, remove it via the Visual Studio installer. Next, you can build Met.3D by navigating into the build folder and running:: cmake --build . 6. Running Met.3D from terminal ------------------------------- You might notice, that Met.3D will not run directly from its build folder. This is because it searches for Qt plugins when starting, which it cannot find. To fix this, you need to set an environment variable for release builds:: set QT_PLUGIN_PATH=PATH_TO_YOUR_BUILD_FOLDER/vcpkg_installed/x64-windows/Qt6/plugins For debug builds set it to the following:: set QT_PLUGIN_PATH=PATH_TO_YOUR_BUILD_FOLDER/vcpkg_installed/x64-windows/debug/Qt6/plugins You can then start Met.3D from this terminal:: .\Met3D.exe 7. Setting up an IDE -------------------- Since building directly from command line is a bit cumbersome, we will describe how to setup an IDE for Met.3D on Windows. Visual Studio ~~~~~~~~~~~~~ First, we will explain how to setup Visual Studio for Met.3D, since it was already installed when downloading the C++ compiler. To start it, you will have to open the Intel oneAPI command prompt and type:: devenv This will open the Visual Studio start window. There, click *Open a folder* and navigate to your Met.3D source directory. Visual Studio should now open with the Met.3D project active. You can run, or re-run cmake from the *Project* menu at the top. By default, cmake will also auto-run once the configuration changes. This will be shown in the output window at the bottom. You can select your build configuration at the top below the menu bar. To run it, select Met3D.exe as the startup item. You might need to build Met.3D at least once before though. To do that, go to the *Build* menu at the top and select *Build all*. The option is only available, if cmake configuration has finished. CLion ~~~~~ To use CLion with Met.3D, simply open the Met.3D source folder as a project in CLion. If this is the first time you open it, you should be greeted with the **Open Project Wizard**. On the toolchains page, remove the MinGW setup, as that is currently not supported. Instead, use the Visual Studio toolchain. You also need to add an environment file, to setup the Intel Fortran compiler. Click *Add environment* and select the ``setvars.bat`` file. It is usually located at ``C:\Program Files (x86)\Intel\oneAPI``. On the next page you will configure the cmake configurations. There will be one default configuration, and two disabled configurations called ``win-x64-debug`` and ``win-x64-release``. Remove the default configuration and enable the disabled configurations. Closing the wizard will configure cmake. Once that completes, you can select your build and run configuration in the menu bar. .. important:: You will not be able to start Met.3D just yet with CLion, as it will not find the Qt plugins. For that edit your run configuration, and add a new environment variable, ``QT_PLUGIN_PATH``. Set its value to ``PATH_TO_BUILD_DEBUG/vcpkg_installed/x64-windows/debugQt6/plugins;PATH_TO_BUILD_RELEASE/vcpkg_installed/x64-windows/Qt6/plugins`` 8. Packaging ------------ If you want to package Met.3D into a redistributable package, navigate to your build folder and run the following command:: cpack -G 7Z . which will package Met.3D into a portable 7Zip file. Alternatively, you can package an installer using:: cpack -G NSIS . The output package will be placed into the build folder you ran the command from. This requires `NSIS`_ to be installed on your system and added to your ``PATH``. .. note:: There are other generators available as well. Just run ``cpack -G`` to see a list of them. .. _git: https://git-scm.com/ .. _ninja: https://ninja-build.org/ .. _vcpkg: https://vcpkg.io/en/ .. _Visual Studio 2026: https://visualstudio.microsoft.com/de/downloads/ .. _Intel oneAPI Fortran Compiler: https://www.intel.com/content/www/us/en/developer/tools/oneapi/fortran-compiler-download.html .. _NSIS: https://nsis.sourceforge.io/Main_Page