4.4. Building OpenFAST on Windows with CMake and Cygwin 64-bit¶
4.4.1. Installing prerequisites¶
Download and install Cygwin 64-bit. You will need to
Run as Administratorto complete the installation process.- Choose
Install from internet - Choose the default install location
- Choose the default package download location
- Choose
Direct connection - Choose
http://www.gtlib.gatech.eduas the download site - See next step for
select packages. Alternately, you can skip this step and runsetup-x86_64.exeanytime later to select and install required software.
- Choose
Select packages necessary for compiling
OpenFAST. Choosebinarypackages and not the source option.Choose
Categoryview, we will be installing packages fromDevelandMathFrom
Develmark the following packages for installationcmakecmake-doccmake-guicygwin-develgcc-coregcc-fortrangcc-g++gitmakemakedepend
From
Mathmark the following packages for installationliblapack-devellibopenblas
Click
Nextand accept all additional packages that the setup process requests to install to satisfy dependencies
It is recommended that you reboot the machine after installing
Cygwinand all the necessary packages.
4.4.2. Compiling OpenFAST¶
- Open
Cygwin64 Terminalfrom theStartmenu - Create a directory where you will clone OpenFAST repository (change
codeto your preferred name)
mkdir code
cd code
- Clone the OpenFAST repository
git clone https://github.com/OpenFAST/OpenFAST.git
This will create a directory called OpenFAST within the code
directory.
- Create a build directory
cd OpenFAST
mkdir build
cd build
- Run
cmake. Note that this step is necessary only if you change compiler settings, or add new files to any of theCMakeLists.txt. Modification of.f90files do not require you to runcmakeagain, just re-runmakecommand (see next item) to recompile with latest source code modifications.
FC=gfortran cmake ../
Sample output is shown below:
$ FC=gfortran cmake ../
-- The Fortran compiler identification is GNU 5.4.0
-- The C compiler identification is GNU 5.4.0
-- Check for working Fortran compiler: /usr/bin/gfortran.exe
-- Check for working Fortran compiler: /usr/bin/gfortran.exe -- works
-- Detecting Fortran compiler ABI info
-- Detecting Fortran compiler ABI info - done
-- Checking whether /usr/bin/gfortran.exe supports Fortran 90
-- Checking whether /usr/bin/gfortran.exe supports Fortran 90 -- yes
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Looking for Fortran sgemm
-- Looking for Fortran sgemm - found
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE
-- A library with BLAS API found.
-- A library with BLAS API found.
-- Looking for Fortran cheev
-- Looking for Fortran cheev - found
-- A library with LAPACK API found.
-- Setting system file as: src/SysGnuLinux.f90
-- Configuring done
-- Generating done
-- Build files have been written to: /home/sanantha/code/OpenFAST/build
- Compile
OpenFAST
make
Grab a cup of coffee as this takes a while on Cygwin. Once the
compilation is completed, the OpenFAST executable is present in
OpenFAST/build/glue-codes/fast/openfast.exe
- Test the executable
$ glue-codes/fast/openfast.exe -h
**************************************************************************************************
FAST (v8.17.00a-bjj, 27-Aug-2016)
Copyright (C) 2016 National Renewable Energy Laboratory
This program comes with ABSOLUTELY NO WARRANTY. See the "license.txt" file distributed with this
software for details.
**************************************************************************************************
Running FAST (v8.17.00a-bjj, 27-Aug-2016), compiled as a 64-bit application using double
precision
linked with NWTC Subroutine Library (v2.11.00, 12-Nov-2016)
Syntax is:
FAST_x64.exe [-h] <InputFile>
where:
-h generates this help message.
<InputFile> is the name of the required primary input file.
Note: values enclosed in square brackets [] are optional. Do not enter the brackets.
FAST_InitializeAll:The required input file was not specified on the command line.
FAST encountered an error during module initialization.
Simulation error level: FATAL ERROR
Aborting FAST.
```
4.4.3. Other tips¶
- You can specify an installation location during your
cmakeprocess so that the executable, libraries, and headers (e.g.,MAPandOpenFOAMheaders) are installed in a common location that you can use to update your environment variables.
# 1. Create an installation location mkdir -p ~/software
# 2. Instruct CMake to use the custom install location FC=gfortran cmake
-DCMAKE\_INSTALL\_PREFIX:PATH=$HOME/software ../
# 3. Compile OpenFAST executable make
# 4. Install OpenFAST to custom install location make install \`\`\`
With this step, you can execute make install after make (see
step 6 above). Now the openfast.exe and other executables (e.g.,
aerodyn.exe) are available in ~/software/bin/ directory.
- If you desire to be able to run
openfast.exefrom thecmdwindow, then you must add theC:\cygwin64\lib\lapackandC:\cygwin64\home\<USERNAME>\software\binto your%PATH%variable in environment setting. Replace<USERNAME>with your account name on windows system. - In addition to
openfast.exe, the current CMake setup also allows the user to compile other executables or libraries without compiling the entire codebase. Usemake helpto see what targets are available and then domake <TARGET>to choose your desired target. For example,make aerodynwill compile only theaerodyn.exeexecutable and its dependencies without compiling the remaining targets.