[Ncep.list.fv3-announce] cmake fv3

Samuel Trahan - NOAA Affiliate samuel.trahan at noaa.gov
Mon May 15 16:58:28 UTC 2017


Dusan,

Thank you for doing this.  It will be useful during the information
gathering process of the NCEP Unified Workflow.

To answer some of your questions:

1. Shell process execution is done via the execute_process command.  Is
this what you were looking for?

https://cmake.org/cmake/help/v3.0/command/execute_process.html

2. Obtaining variables from include-style makefiles (like esmf.mk) can be
accomplished in a variety of ways.  In essence, you make a temporary
Makefile that "include esmf.mk" and then sends the variable to stdout.

I don't know how one would connect cmake to "module load" commands.  My
preference is not to do that.  The modules should be loaded before cmake.
Cmake's job is to adapt to the environment and build the program.  Creating
the environment should happen outside.

Mark Potts may be able to comment further, if he is on the FV3 list.

Sincerely,
Sam Trahan

On Mon, May 15, 2017 at 10:48 AM, Dusan Jovic <dusan.jovic at noaa.gov> wrote:

> FV3 developers,
>
> I have created a cmake based build system for the standalone fv3.
> Several people mentioned and/or suggested on more then one occasion that
> we switch from hand-written makefiles to some "modern" build system, so
> I created this as a proof-of-concept to see if it offers any real
> advantages compared to what we currently use.
>
> My working copy of the trunk is:
>
> /scratch4/NCEPDEV/meso/save/Dusan.Jovic/fv3/trunk_cmake
>
> Please feel free to take a look and try it. Either run cmake directly or
> use compile script in the top-level directory. After going through this
> exercise I can say that I see, so far, only two maybe three advantages.
> Keep in mind that I have much more experience in gnu make then in cmake.
> I might be missing something very important here. As always, suggestions
> and constructive criticism are welcome. I'm sure some of you who are
> already using cmake can suggest many improvements.
>
> First, cmake based build is usually done out-of-source which means you
> can run more then one build at the same time using different build
> options (for example 32-bit vs 64-bit build, or whatever). The second
> one is that cmake is using it's own Fortran module dependency resolution
> and does not rely on external tool, like mkDepends.pl. Some people might
> find that cmake configuration files (CMakeLists.txt) are cleaner then
> makefiles.
>
> There are also some disadvantages. Cmake was designed to be cross
> platform makefile generation tool, and by cross platform I mean Linux,
> Windows, macOS, not wcoss, theia, jet or whatever linux platform we are
> building our code on. It provides many modules which help you find
> location of libraries not provided by operating system, like some gui
> libraries or networking libraries. There no available modules which will
> help you find and configure nceplibs or esmf. Which basically means that
> exactly the same information ( for example location of w3emc) must be
> provided in both gnumake and cmake system. ESMF provides only make
> snippet which can be included in gnu makefile but not in CMakeLists.txt.
> I had to manually specify location of include and module directories for
> esmf. Specifying location and names of all required esmf libraries is
> going to be even more difficult. I'm not sure how easy it's going to be
> to integrate cmake based build with the nems app builder or whatever we
> use currently. Then, the Fortran module dependency generation is not
> perfect. For example, it could not discover that fms/fft/fft.F90 depends
> on fft99.F90. Finally in the standard make I can do pretty much anything
> I want while in cmake if something is not supported by the cmake
> language it can be very difficult if not impossible to do something very
> specific. Maybe there are methods to run arbitrary shell scripts. If all
> you need is provided by cmake then you are fine, but if it's not it can
> be very challenging to implement. That's the main concern I have about
> cmake.
>
> Dusan
>
> _______________________________________________
> Ncep.list.fv3-announce mailing list
> Ncep.list.fv3-announce at lstsrv.ncep.noaa.gov
> https://www.lstsrv.ncep.noaa.gov/mailman/listinfo/ncep.list.fv3-announce
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www.lstsrv.ncep.noaa.gov/pipermail/ncep.list.fv3-announce/attachments/20170515/051d25fb/attachment.html 


More information about the Ncep.list.fv3-announce mailing list