NetCDF-C for Windows - Unidata · 2012-10-26 · NetCDF-C for Windows NetCDF for New Users 2012...

Post on 05-Apr-2020

49 views 0 download

Transcript of NetCDF-C for Windows - Unidata · 2012-10-26 · NetCDF-C for Windows NetCDF for New Users 2012...

NetCDF-C for Windows

NetCDF for New Users2012

Friday, October 26, 12

OverviewFocus of this discussion is on building and using netCDF-C on Windows.

Multiple Windows development environments:

Cygwin

MSYS/MinGW

Visual Studio

We will focus on using CMake to build Visual-Studio compatible netCDF-C libraries.

2

Development Environments on

Windows

Unix/Unix-like environmentsunder Windows. Uses a GCC

compiler.

Cygwin MSYS/MinGW

Visual Studio

Friday, October 26, 12

Getting netCDF-CLatest Stable release (4.2.1.1):

http://www.unidata.ucar.edu/downloads/netcdf

Latest Developer Snapshot:

svn co http://svn.unidata.ucar.edu/repos/netcdf/trunk

3Friday, October 26, 12

Getting CMakehttp://www.cmake.org

Current version is 2.8.9.

netCDF-C requires at least CMake 2.8.8

The CMake download comes with both command line and GUI tools.

4Friday, October 26, 12

Using the CMake GUIThe source directory and the build directory are typically two distinct locations.

Step 1) Set locations.

Step 2) Configure

5Friday, October 26, 12

Using the CMake GUICMake will ask you to specify which ‘Generator’ to use.

Different makefile-based builds.

Visual Studio builds, specific to desired architecture.

6Friday, October 26, 12

Using the CMake GUIHere we see an error; DAP is enabled by default, but the required curl libraries couldn’t be located.

7Friday, October 26, 12

Using the CMake GUIUnder ‘enable’ options, we uncheck ‘ENABLE_DAP’, then re-run ‘configure’.

8Friday, October 26, 12

Using the CMake GUIConfiguration was successful.

Next, we generate the project files.

9Friday, October 26, 12

Compiling CMake-generated Visual Studio Projects

10Friday, October 26, 12

Compiling CMake-generated Visual Studio Projects

11Friday, October 26, 12

Compiling CMake-generated Visual Studio Projects

Friday, October 26, 12

Compiling CMake-generated Visual Studio ProjectsOn Windows, shared libraries are not linked against directly.

‘Import Libraries’ are instead used.

What if we wanted to do this from the command line?

13Friday, October 26, 12

Building netCDF-C in Windows via the Command Line

14

C:\netcdf>  cmake  -­‐-­‐build  .  -­‐-­‐target  netcdf

C:\netcdf>  cmake  -­‐-­‐build  .

Friday, October 26, 12

Building netCDF-C in Windows via the Command Line

15Friday, October 26, 12

Running NetCDF Tests in Windows

16

C:\netcdf>  cmake  -­‐-­‐build  .  -­‐-­‐target  RUN_TESTS

C:\netcdf>  ctest  .

Friday, October 26, 12

Running NetCDF Tests in Windows

17Friday, October 26, 12

SummaryWe have discussed

The motivation for including CMake support in netCDF-C.

Configuring, building and testing netCDF-C on Windows using CMake & Visual Studio.

GUI

Command Line

18Friday, October 26, 12