Repository navigation
Windows Build Terminal
This is a brief guiedeline to build Windows on command line using Intel oneAPI for the Fortran compiler and mkl.
You can drastically speed up building and testing, if you disable Windows Defender for your build directories.
- Install Microsoft Visual Studio Community Edition for C++ with build tools (nmake, cmake, ...). Note that we will use the original cmake
- Install Intel oneAPI Fortran and Math Kernel Library with all dependent packages, C++ is not necessary but will be also installed. From 2025.0 on, the oneAPI HPCKit is sufficient. Intel bloats the installation with unnecessary stuff, here you can see, what you can remove manually: https://github.com/openCFS/cfs/blob/master/.gitlab/ci/windows-shared-runner_install-build-tools.ps1
- Install git with options for command line
- Install CMake from Kitware
- Install a standard text editor like Notepad++ - one always needs a fast and good editor around :)
Compilers can be selected prior initial build generation by cmake by setting the environment variables CC, CXX and FC. E.g. set CC=ixc, set CXX=icx. Make sure, the compilers are in Path (e.g. call setvars). On Linux usually different executables are used for C and C++ compiler, e.g. icx and icdx. On Windows the compilers are combined C/C++ and the names change for Intel compilers - be careful and set double, e.g. CC=icx and CXX=icx
- cl - Microsoft Visual Studio C/C++ compiler. We use /openmp:llvm to have partially up to date OpenMP
- icx - Intel oneAPI combined C/C++ compiler based on LLVM with MSVC compatible command line interface. At time of writing cannot compile boost - use MSVC precompiled.
- ifx - Intel oneAPI Fortran compiler based on LLVM
- ifort - Intel oneAPI classic Fortran compiler, deprecated
- clang, clang++ - LLVM compiler distributed Microsoft Visual Studio (check with --version)
- (clang, clang++ - from Intel oneAPI in
windows\bin-llvm. Seems to be icx and icpx. check with --version)
- configure git and best is to add shh keys to the gitlab server (via ssh-keygen)
- add
C:\Program Files\Git\usr\binto your Path in environment settings. openCFS needs patch.exe from there. Make sure by callingpatch --helpon cmd that this worked. Otherwise, openCFS will fail to build it's cfsdeps. - activate MSVC environment and choose correct architecture (x86-32 does not work for ifort) by calling
vcvarsall.bat amd64(do not forget the argument, for details see the Microsoft Documentation) - add
C:\Program Files (x86)\Intel\oneAPIto your Path and always runsetvarsbefore creating a new openCFS build directory with cmake - prepare a
.cfs_platform_defaults.cmakeand place it in your home directory. You can use the following content as a template
set(BUILD_TESTING_DEFAULT ON)
set(TESTSUITE_PYTHON ON)
# add here your personal defaults for convenience
set(USE_ENSIGHT_DEFAULT OFF)
set(USE_EMBEDDED_PYTHON_DEFAULT OFF)
set(USER_HOME "$ENV{HOME}")
# setting CFS_DEPS_CACHE_DIR allows to share precompiled over builds
set(CFS_DEPS_CACHE_DIR_DEFAULT "${USER_HOME}/code/cfsdepscache")
# debug mode
if(CFS_BINARY_DIR MATCHES /debug)
set(DEBUG_DEFAULT ON)
set(USE_OPENMP_DEFAULT OFF)
endif()
- start cmd and make sure that
nmake /?,patch --helpandifxorifortare found. On problems found, you probably forgot to callsetvars - clone cfs e.g. to
code\cfsin your home. E.g.git clone ssh://git@gitlab.com/openCFS/CFS.git cfssee git-workflow - create there a build directory, e.g.
code\cfs\releaseand go there
- We assume to be in a created and empty (!) build directory within the cloned openCFS source. E.g.
mkdir releaseand thencd release. - One can either call
cmake-gui ..orcmake .. -G "NMake Makefiles. - After the initial configuration one can always call
cmake-gui .orcmake ., independent on what has been called before. - The
.can be optionally used instead of..after the initial call.
- With cmake-gui you can choose the Generator (e.g. NMake Makefiles) and choose the compilers before configuring openCFS.
- All options can be checked and changed graphically.
- On Windows there is no terminal based GUI
ccmakeas on other platforms.
- to work purely terminal based (e.g. via ssh and Windows's OpenSSH-Server) you can change settings in cmake like
cmake . -DUSE_EMBEDDED_PYTHON=ON. You can check current settings likegrep USE CMakeCache.txt. - for a terminal based access keep your
.cfs_platform_defaults.cmakein the home directory in shape.
cmake knows many generators. For Windows command line access, the two most common are "NMake Makefiles" which is the official Microsoft tool and "Ninja" which is also used on other platform.
- select by
cmake .. -G "NMake Makefiles" - nmake is very slow and cannot build in parallel, however it is the native solution and robust to use. It works similar to
makeon Linux, just withnmake. - default compilers are MSVC for C/C++ and ifx for Fortran.
- after
cmakejust runnmaketo build openCFS
- select by
cmake .. -G Ninja - fast and parallel build tool for all platforms. More for the experienced ones.
- Ninja comes with Visual Studio and does not need to be installed.
- selects as default compilers icx,icpx and ifx but icpx will fail. So you need to select your C++ compiler manually. E.g. via
set CC=clandset CXX=cl. - ninja builds by default in parallel. But openCFS needs its dependencies built in serial. So first build with
ninja -j 1 cfsdepsand then you can build the rest in parallel vianinjaorninja -j 5if you want to control the number of threads (here to 5). - not all dependencies can be build with ninja. It is best to have all dependencies build with nmake and then, for a ninja build, call
ninja cfsdeps -j 1and thenninja.
- for that it helps to have a fixed
CFS_DEPS_CACHE_DIRe.g. in your.cfs_patform_defaults.cmakeset via
set(USER_HOME "$ENV{HOME}")
set(CFS_DEPS_CACHE_DIR_DEFAULT "${USER_HOME}/code/cfsdepscache")