-
Notifications
You must be signed in to change notification settings - Fork 34
Home
- master: Branch of revised official code. Once a new version of SWAT source code available, I will create a new branch and merge it to the master branch! Revisions are only made in typos and cross-platform compilations.
-
<MAJOR>rev<MINOR>[.<PATCH>]: SWAT versions, i.e.,
2012rev670
,2012rev622.omp
, etc.
- CMake2.8+
- Windows:
- Microsoft Visual Studio 2010+ and Intel Fortran compiler (ifort) 12.0+
- or CLion and mingw64 (with gfortran 4.8+)
- Linux/macOS:
- GCC (with gfortran installed) 4.8+
- ifort 12.0+
-
common commands
cd <path to SWAT> mkdir build cd build cmake .. make && make install
Take VS2013 and Intel_Parallel_Studio_XE_2017 (Intel 17.0.4) as an example.
- Open "Intel compiler 17.0 Update 4 Intel(R) 64 Visual Studio 2013" from start menu.
- cd to the compile destination folder. e.g.,
cd D:/compile/SWAT_ifort
- Run
cmake <path to SWAT src path>
. e.g.,cmake C:\z_code\Hydro\SWAT
- Compile 64-bit version:
cmake -G "Visual Studio 12 2013 Win64" C:\z_code\Hydro\SWAT
- Compile 64-bit version:
- Open the project
SWAT<yyyy>rev<Num>.sln
, e.g.SWAT2012rev664.sln
, right-click the solution name and selectBuild Solution
. - After the compilation, right-click the
INSTALL
project and selectBuild
, the executable of SWAT namedswat<yyyy>Rev<Num><BuildType>
will be located in<path to SWAT src path>/bin
, e.g.,C:\z_code\Hydro\SWAT\swat2012Rev664Rel.exe
. In whichDbg
for Debug,Rel
for Release, etc.
If you prefer the command line, the common commands above should be OK. Note that if you want specify a Fortran compiler, please add the following command before cmake
command.
export FC=/path/to/your/own/Fortran/compiler
# e.g., ifort
export FC=/share/soft/intel/composer_xe_2011_sp1.6.233/bin/intel64/ifort
# e.g., gfortran
export FC=/home/zhulj/gcc4.8.4/bin/gfortran
However, if you want a user-friendly IDE for to learn and improve the SWAT model, I recommend the cross-platform IDE CLion with Fortran plugin.
CLion use CMake to manage projects. Under Windows, you may also install mingw64 (or mingw) for the gfortran compiler.
Using CLion is quite easy and intuitive. Just open the SWAT path from File -> Open...
. Then CLion will automatically load the project by CMakeLists.txt existed in SWAT directory. Now, you can build SWAT model by typing Ctrl+F9
or clicking the build button.
With the latest Fortran plugin with GDB support, we can debugging SWAT in the familiar JetBrains' way.