-
Notifications
You must be signed in to change notification settings - Fork 37
Build Process in Windows using Visual Studio
Don Robinson, ESSA Technologies, March 2026
UPDATE
This page is being updated to reflect the development of Visual Studio to build, develop and debug FVS variants using Visual Studio 2022, Intel OneAPI and Cmake; all of which are free. The content on this page is currently in DRAFT format. We expect to have a finalized update available by the end of March, 2026, at which point this note will be removed.
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 2022 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 2022 (VS22), 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 possible to have different versions of a tool installed (e.g. Visual Studio 2017 and 2022). 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 2022 (Version 17) (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 (Version 2025.3.0) (Official Download; Alternative Download Click on the filename to begin installation. During the installation you will need to check the box verifying that you have VS22 installed. This will ensure that the IDE linkages are provided by Intel to Visual Studio. Next ensure that you are installing both the Base Toolkit and the HPC Toolkit. The Base Toolkit is a prerequisite for most other Intel components and includes the necessary core libraries. The HPC Toolkit is needed to include the Fortran and C++ compilers.
Cmake (Version 4.2.1) (Official Download; Alternative Download) Click on the filename to begin installation. This Cmake release supports the most recent versions of VS22 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 VS22 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 22 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 22 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:
-
20 # --- 2. VARIANT PROCESSING LOGIC ---
21 # Define which variant to build (e.g., FVSie, FVSpn)
22 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 VS22/OneAPI environment:
"C:\Program Files (x86)\Intel\oneAPI\setvars.bat" intel64 vs2022
The batch file will then set up the build environment and tools that further integrate Intel OneAPI and VS22. 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 17.14.29 environment configured.
"C:\Program Files\Microsoft Visual Studio\2022\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 VS22/OneAPI environment integration has completed, type the following at the command line (including the '.' at the end):
cmake -G"Visual Studio 17 2022" .
Cmake will then begin to build the environment and tools for VS22 for the chosen variant. If this does not happen automatically, please post the problem so that it can be resolved. As Cmake runs the VS22 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.2.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.44.35225.0
-- The CXX compiler identification is MSVC 19.44.35225.0
-- The Fortran compiler identification is IntelLLVM 2025.3.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/2022/...
-- 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/2022/...
-- 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/...
-- Checking for critical include file collisions (.F77, .inc, .h)...
-- SUCCESS: No critical include collisions detected.
-- Configuring done (40.1s)
-- Generating done (0.4s)
-- Build files have been written to: C:/code-repositories/ForestVegetationSimulator/bin...
In Visual Studio parlance a "solution" (file suffix: 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-IE variant SLN is created and placed here:
- C:/code-repositories/ForestVegetationSimulator/bin/FVSie_CmakeDir
Using Windows Explorer, navigate to the directory containing the variant directory SLN file you wish to work with.
- C:/code-repositories/ForestVegetationSimulator/bin/FVSie_CmakeDir/FVS.sln
Double-click on FVS.sln 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_ie | FORTRAN | FVS_ie.dll |
| FVSie | FORTRAN | FVSie.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_ie 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 FVSie project is different from the FVS_ie 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 you can customize your Visual Studio environment for development and debugging. After building the variant with Visual Studio (from the VS22 menu: Build > Build Solution) it is easy to speed up the coding and debugging process by automatically providing a command line argument. To set this up, right-click the FVSie 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 /bin then 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 VS22 solutions. Removing them allows Cmake to create other kinds of build systems.