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

18
NetCDF-C for Windows NetCDF for New Users 2012 Friday, October 26, 12

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

Page 1: NetCDF-C for Windows - Unidata · 2012-10-26 · NetCDF-C for Windows NetCDF for New Users 2012 Friday, October 26, 12. Overview Focus of this discussion is on building and using

NetCDF-C for Windows

NetCDF for New Users2012

Friday, October 26, 12

Page 2: NetCDF-C for Windows - Unidata · 2012-10-26 · NetCDF-C for Windows NetCDF for New Users 2012 Friday, October 26, 12. Overview Focus of this discussion is on building and using

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

Page 3: NetCDF-C for Windows - Unidata · 2012-10-26 · NetCDF-C for Windows NetCDF for New Users 2012 Friday, October 26, 12. Overview Focus of this discussion is on building and using

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

Page 4: NetCDF-C for Windows - Unidata · 2012-10-26 · NetCDF-C for Windows NetCDF for New Users 2012 Friday, October 26, 12. Overview Focus of this discussion is on building and using

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

Page 5: NetCDF-C for Windows - Unidata · 2012-10-26 · NetCDF-C for Windows NetCDF for New Users 2012 Friday, October 26, 12. Overview Focus of this discussion is on building and using

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

Page 6: NetCDF-C for Windows - Unidata · 2012-10-26 · NetCDF-C for Windows NetCDF for New Users 2012 Friday, October 26, 12. Overview Focus of this discussion is on building and using

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

Page 7: NetCDF-C for Windows - Unidata · 2012-10-26 · NetCDF-C for Windows NetCDF for New Users 2012 Friday, October 26, 12. Overview Focus of this discussion is on building and using

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

Page 8: NetCDF-C for Windows - Unidata · 2012-10-26 · NetCDF-C for Windows NetCDF for New Users 2012 Friday, October 26, 12. Overview Focus of this discussion is on building and using

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

8Friday, October 26, 12

Page 9: NetCDF-C for Windows - Unidata · 2012-10-26 · NetCDF-C for Windows NetCDF for New Users 2012 Friday, October 26, 12. Overview Focus of this discussion is on building and using

Using the CMake GUIConfiguration was successful.

Next, we generate the project files.

9Friday, October 26, 12

Page 10: NetCDF-C for Windows - Unidata · 2012-10-26 · NetCDF-C for Windows NetCDF for New Users 2012 Friday, October 26, 12. Overview Focus of this discussion is on building and using

Compiling CMake-generated Visual Studio Projects

10Friday, October 26, 12

Page 11: NetCDF-C for Windows - Unidata · 2012-10-26 · NetCDF-C for Windows NetCDF for New Users 2012 Friday, October 26, 12. Overview Focus of this discussion is on building and using

Compiling CMake-generated Visual Studio Projects

11Friday, October 26, 12

Page 12: NetCDF-C for Windows - Unidata · 2012-10-26 · NetCDF-C for Windows NetCDF for New Users 2012 Friday, October 26, 12. Overview Focus of this discussion is on building and using

Compiling CMake-generated Visual Studio Projects

Friday, October 26, 12

Page 13: NetCDF-C for Windows - Unidata · 2012-10-26 · NetCDF-C for Windows NetCDF for New Users 2012 Friday, October 26, 12. Overview Focus of this discussion is on building and using

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

Page 14: NetCDF-C for Windows - Unidata · 2012-10-26 · NetCDF-C for Windows NetCDF for New Users 2012 Friday, October 26, 12. Overview Focus of this discussion is on building and using

Building netCDF-C in Windows via the Command Line

14

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

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

Friday, October 26, 12

Page 15: NetCDF-C for Windows - Unidata · 2012-10-26 · NetCDF-C for Windows NetCDF for New Users 2012 Friday, October 26, 12. Overview Focus of this discussion is on building and using

Building netCDF-C in Windows via the Command Line

15Friday, October 26, 12

Page 16: NetCDF-C for Windows - Unidata · 2012-10-26 · NetCDF-C for Windows NetCDF for New Users 2012 Friday, October 26, 12. Overview Focus of this discussion is on building and using

Running NetCDF Tests in Windows

16

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

C:\netcdf>  ctest  .

Friday, October 26, 12

Page 17: NetCDF-C for Windows - Unidata · 2012-10-26 · NetCDF-C for Windows NetCDF for New Users 2012 Friday, October 26, 12. Overview Focus of this discussion is on building and using

Running NetCDF Tests in Windows

17Friday, October 26, 12

Page 18: NetCDF-C for Windows - Unidata · 2012-10-26 · NetCDF-C for Windows NetCDF for New Users 2012 Friday, October 26, 12. Overview Focus of this discussion is on building and using

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