You need Intelâs Visual Studio extension to support Fortran using that generator. You may want to use -GNinja instead which can use those compilers directly.
I would suggest using the Intel oneAPI âx64 Native Tools Command Promptâ so that the environment is set optimally for oneAPI. Itâs in the Windows start menu under Apps/Intel oneAPI typically.
In general instead of the three commands you typed above you can do
cmake -B build -G Ninja
If you donât have Ninja, you can get from file ninja-win.zip at Releases ¡ ninja-build/ninja ¡ GitHub
Put the file Ninja.exe somewhere and add its location to Path environment variable.
I use oneAPI for Fortran on Windows with CMake a lot and it generally works well.
-- Building for: Ninja
-- The Fortran compiler identification is IntelLLVM 2023.2.0 with MSVC-like command-line
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Check for working Fortran compiler: C:/Program Files (x86)/Intel/oneAPI/compiler/latest/windows/bin/ifx.exe - skipped
-- Configuring done (2.2s)
-- Generating done (0.0s)
-- Build files have been written to: electroporation/build
then I type
cmake --build build
which would create file âbin\electroporation.exeâ, except there is a mistake in the electroporation project. It works with Gfortran but not with Intel oneAPI, which is a stricter compiler. The oneAPI compilation error is:
electroporation\src\util_mod.f90(131): error #6404: This name does not have a type, and must have an explicit type. [RAND]
1 v1=2.0*rand()-1.0
-----------------------^
Then I do
cd bin
ecectroporoation.exe
which gives output
Global data:
_________________________________
sigma = 0.0000
gamma = 0.3120
epsilon = 0.2500
dt = 0.0010
dx = 0.5000
tmax = 100000
file_skip = 1000
Nx = 256
Ny = 256
Initil File = no
Initial = RANDOMSEED
Electric field = on
_________________________________
Electric data:
_________________________________
Interior Cond. = 0.0010
Exterior Cond. = 0.0010
Lipid Capcitance = 0.0100
Lipid Conductance = 0.0000
Electrod Length = 0.0010
Applied Potential = -1.0000
_________________________________
However I think youâre maybe not using the correct command prompt. Be sure youâre using from Windows Start menu âIntel oneAPI Command Prompt for Intel 64 for Visual Studio 2022â. Otherwise the compiler environment is incorrect and the compiler isnât found.
Then, we have to have the location to âninja.exeâ. Put in in your %USERPROFILE%\bin directory as a good practice. When you type
This script might help. Itâs designed to work with many simple CMake projects.
It works to find the oneAPI compiler, download and use Ninja if not available.
copy it into the electroporation directory and run from any Terminal or Command Prompt (it will load the oneAPI environment for you)
That script I linked above will download a local copy of ninja. That script builds the CMake project for you, first loading the compiler environment and downloading Ninja.