-
Notifications
You must be signed in to change notification settings - Fork 42
Build Process in Windows using Visual Studio
Don Robinson, ESSA Technologies, May 2026
This page documents the process of using Microsoft Visual Studio and related software to build, develop and debug FVS executables from the source files. The installation and configuration of the Visual Studio environment and related tools are described below, and create 64-bit FVS variants under Windows 11. Other software configurations may be possible, but only 64-bit builds made with Visual Studio 2026 under Windows 11 have been tested. For more information on the other supported build process please refer to make.
- Getting the Necessary Tools
- Getting the Source Files
- Building the Visual Studio Solution with Cmake
- Building the Executable for Development & Debugging
- Redistributables
- Switching Between Cmake Build Systems
You will need Administrator privileges to install the necessary tools, so ensure you have that before proceeding. You will also need about 5gb of storage for the install packs and installed software. Finally, the install packs listed below are stored on a Google drive and you may see virus-related precautionary warnings before downloading.
Visual Studio provides an intuitive environment for developing and debugging FVS. Three free software tools are required: Microsoft Visual Studio 2026 (VS26), Intel OneAPI and Cmake. Because these tools depend on one another and because each is under quasi-independent development, there is no guarantee that arbitrary combinations of all releases of all tools - past present and future - will work together. For this reason we recommend using the Alternative Download links provided on this page. The executable install packs found at the Official Download hyperlinks below provide a link to the official download. However, since developers may remove or hide earlier versions of their software when they update, the Official Download versions may change without notice, resulting in incompatible and untested tool combinations. To address this we have copied the tested versions to our private Alternative Download location hosted by ESSA Technologies on a shared Google Drive. If you choose the Alternative Download you may receive a warning that the file cannot be scanned for viruses by Google. This message can be ignored, but you are welcome to scan the download with any tools you prefer. Finally, it is sometimes permissible to have different versions of a tool installed (e.g. Visual Studio 2022 and 2026). We caution that this adds complexity to the configuration of your computer, and this page does not describe those situations or problems that may occur.
To ensure the smooth integration of Visual Studio, Intel OneAPI and Cmake, you should follow the installation sequence shown below. Installing Visual Studio before the Intel toolkit is critical because the Intel installer detects existing Visual Studio versions as it installs the necessary IDE plug-ins and compiler integrations. Installation of Cmake does not depend on either Visual Studio or Intel products being installed beforehand.
Visual Studio 2026 (Version 18) (Official Download; Alternative Download) Click on the filename to begin installation. During installation you will be presented with options to include a variety of components. You should select the option “Desktop Development with C++”, which ensures that the underlying C/C++ compiler tools and other components are installed. This selection is required so that the subsequent installation of Intel OneAPI will work with Windows.
Intel OneAPI Toolkit (Version 2026.0.0) (Official Download; Alternative Download Click on the filename to begin installation of the OneAPI Toolkit. During the installation you will need to check the box verifying that you have VS26 installed. This will ensure that the IDE linkages are provided by Intel to Visual Studio.
Cmake (Version 4.3.1) (Official Download; Alternative Download) Click on the filename to begin installation. This Cmake release supports the most recent versions of VS26 and Intel OneAPI. During installation select the option “C++ Cmake tools for Windows” to enable integration with Visual Studio. If requested, select the option the “Add Cmake to the system PATH”.
Your development work may mean that you will eventually merge your work into the trunk code. Please see the Testing wiki to learn about the requirements for testing model behavior prior to integrating code.
Also note that FVS builds made with make remain the gold standard for FVS users and integration with FVSonline. Builds made with Visual Studio must therefore provide the same responses as the test cases built with 'make'.
Please visit Downloading Source Code to find out about Git clients and the FVS code base. For consistency, the examples on this page assume that you have downloaded and placed the source code in this directory:
- C:/code-repositories/ForestVegetationSimulator
Unlike the other FVS build-systems the Cmake build-chain does not currently build the entire suite of FVS variants: only one variant is built at a time, with the Inland Empire (FVS-IE) variant as the default. The steps below show how to customize and run Cmake, creating a VS26 solution for any variant.
With Windows Explorer navigate to the directory holding your downloaded code base. Assuming you downloaded as shown above, open an Explorer window in the /bin directory:
- C:/code-repositories/ForestVegetationSimulator/bin
There are two steps to follow next: (a) selecting a variant to build, and (b) running Cmake.
To change the variant from the default FVS-IE (Inland Empire) variant you will edit the master Cmake script (CMakeLists.txt) changing Line 20 of that file to specify the variant you wish to build. There are over 20 variants that can be built, each with a corresponding FVS**_sourceList.txt file in the /bin directory, where '**' is the two-letter variant code. Using this set of available files as your guide, change the default FVSie_sourceList.txt to the variant you want to build. For example, use a text editor and change Line 20 of CMakeLists.txt from FVSie_sourceList.txt to FVSpn_sourceList.txt to build the FVS-PN (Pacific Northwest) variant. Then save and close the file. It will then look like this:
-
18 # --- 2. VARIANT PROCESSING LOGIC ---
19 # Define which variant to build (e.g., FVSie, FVSpn)
20 file(GLOB tobuild FVSpn_sourceList.txt)
Next open a command-line session in the /bin directory by right-clicking anywhere in the Explorer window and selecting "Open in Terminal". If this opens a PowerTools command-line session, type 'cmd.exe' to open a DOS-type command-line session. Then type the following to initialize the VS26/OneAPI environment:
"C:\Program Files (x86)\Intel\oneAPI\setvars.bat" intel64 vs2026
The batch file will then set up the build environment and tools that further integrate Intel OneAPI and VS26. The command-line environment will echo a number of actions and internal checks:
-
:: initializing oneAPI environment...
Initializing Visual Studio command-line environment...
Visual Studio version 18.5.2 environment configured.
"C:\Program Files\Microsoft Visual Studio\18\Community\"
Visual Studio command-line environment initialized for: 'x64'
: advisor -- latest
: compiler -- latest
: dal -- latest
: dev-utilities -- latest
: dnnl -- latest
: dpcpp-ct -- latest
: dpl -- latest
: ipp -- latest
: ippcp -- latest
: mkl -- latest
: ocloc -- latest
: tbb -- latest
: umf -- latest
: vtune -- latest
:: oneAPI environment initialized ::
Once the VS26/OneAPI environment integration has completed, type the following at the command line (including the '.' at the end):
cmake -G"Visual Studio 18 2026" .
Cmake will then begin to build the environment and tools for VS26 for the chosen variant. If this does not happen automatically, please post the problem so that it can be resolved. As Cmake runs the VS26 solution is created and the command-line environment will echo a number of actions and internal checks. (Long lines below have been truncated.)
-
-- CMake version: 4.3.1
-- Building FVS for Windows (Visual Studio/Intel)
-- Selecting Windows SDK version 10.0.26100.0 to target Windows 10.0.26200.
-- The C compiler identification is MSVC 19.50.35730.0
-- The CXX compiler identification is MSVC 19.50.35730.0
-- The Fortran compiler identification is IntelLLVM 2026.0.0 with MSVC-like command-line
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: C:/Program Files/Microsoft Visual Studio/18/Community/VC/Tools...
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files/Microsoft Visual Studio/18/Community/VC/Tools...
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Determine Intel Fortran Compiler Implicit Link Path
-- Determine Intel Fortran Compiler Implicit Link Path - done
-- Check for working Fortran compiler: C:/Program Files (x86)/Intel/oneAPI/compiler/2026.0/bin...
-- Configuring done (31.8s)
-- Generating done (0.4s)
-- Build files have been written to: C:/code-repositories/ForestVegetationSimulator/bin/FVSpn_CmakeDir
-- Configuring done (32.2s)
-- Generating done (0.1s)
-- Build files have been written to: C:/code-repositories/ForestVegetationSimulator/bin
In Visual Studio parlance a "solution" (file suffix: SLNX or SLN) is a master file that orchestrates the compiling of the FVS source files into component DLLs, ultimately creating an executable program. In this example the FVS-PN variant SLN is created and placed here:
- C:/code-repositories/ForestVegetationSimulator/bin/FVSpn_CmakeDir
Using Windows Explorer, navigate to the directory containing the variant directory SLN file you wish to work with.
- C:/code-repositories/ForestVegetationSimulator/bin/FVSpn_CmakeDir/FVS.slnx
Double-click on FVS.slnx to start Visual Studio. After it starts you will see that the Solution contains the sub-projects shown below. The table shows the project name, programming language and output file after building:
| Project Name | Language | Output |
|---|---|---|
| CMakePredefinedTargets | - | - |
| FVS_pn | FORTRAN | FVS_pn.dll |
| FVSpn | FORTRAN | FVSpn.exe |
| FVSfofem | C/C++ | FVSfofem.dll |
| FVSsql | C | FVSsql.dll |
The first listed project is CMakePredefinedTargets. It is used by Visual Studio and Cmake to perform internal checks and should be left as-is. The four 4 projects beginning with ‘FVS’ contain the source code for the variant. The Visual Studio Solution Explorer tree control lets you see and interact with the source code in each project component. The bulk of the FVS code is in the FVS_pn project, with FVSfofem holding many parts of the FFE and FVSsql holding code that controls low-level connections for SQLite database connectivity. Note that the FVSpn project is different from the FVS_pn project. The first builds the final executable; the second builds the DLL which contains most of the model code and is linked to the executable, along with other DLL components.
Once the SLN has been created there are three steps you should follow to ensure that Visual Studio provides a functional development and debugging environment.
- Begin by building your FVS variant, verifying that it builds from the source code without error. With Visual Studio open, select _Build > Build Solution _to compile and build the entire model. Visual Studio should report something like:
-
========== Build: 5 succeeded, 0 failed, 0 up-to-date, 1 skipped ==========
- Visual Studio provides a "Marketplace" of many 3rd-party tools that support code development and debugging. In this Marketplace Intel provides the Fortran Expression Evaluator (FEE) to support watching and changing Fortran arrays, strings and complex derived types. Check that the FEE is present and installed. Search for "Fortran" and then install it if is not yet installed.
- You can optionally configure your Solution to speed up the coding and debugging process by automatically providing a command line argument. To set this up, right-click the FVSpn project in the Solution Explorer tree and select Properties at the bottom of the list. From the Properties window choose Debugging and modify the Command Argument to provide a command line. For example if you have an FVS keyword file called mytest.key in the
/binthen the command line argument is:
- --keywordfile="mytest.key"
FVS executables created with Visual Studio can be distributed to others, but the complexity of the environment and under-the-hood Intel libraries make it challenging. For sharing development tasks the best approach is to work with common source code and testing files. For sharing executables the recommended approach is to build the variant using the recommended make build system, which results in the simplest output: one EXE and one DLL.
Most of the time you will probably want to build Visual Studio Solution (SLN) files with the configuration described here. However, developers may sometimes need to modify the configuration of Visual Studio environment. If you need to do this, you should remove these files and directories before attempting to use Cmake to build with modified configuration:
-
directory: CMakeFiles
file: cmake_install.cmake
file: CMakeCache.txt
These files and directories contain information that is stored by Cmake the first time it is run, and will "lock" Cmake into always creating VS26 solutions. Removing them allows Cmake to create other kinds of build systems.