On 2009-05-11 12:19-0700 Alan W. Irwin wrote:

> On 2009-05-11 10:19-0700 Alan W. Irwin wrote:
>
>> My attention was drawn to this possibility [of a CMake-based build of
> the installed examples] recently on the CMake list so I
>> thought I would share it here, but I know nothing more about this then what
>> I read in the cmake documentation.  I don't have plans to do this myself...
>
> Actually, I have been thinking about this some more, and I may try a
> proof-of-concept (build the installed C examples) this afternoon to see how
> it goes.  If anyone else is working on this interesting idea as well, please
> keep in touch with me.

It actually was incredibly straightforward.  See the proof of concept I have
put together for revision 9966 (the bulk of the changes) and revision 9968
(one minor bug fix).  The result is a CMake mini-project superimposed on the
installed examples tree.  For now it just builds the C examples.  (Note you
will clobber the ordinary Makefile approach if you use an in-source build
there so assuming you are in the top level of the installed examples tree do
something like

mkdir build_dir
cd build_dir
cmake ..
make

to build the installed C examples.  (Note I only allow CMake version 2.6.4
or later for this mini-project because of an essential CMake bug-fix for
that version.)

Here is what I have done to implement this.  For each dependent target of
libplplot add an EXPORT export_plplot stanza to the install command for the
target.  Add a similar stanza to the libplplot install command.  Then use
a unique INSTALL(EXPORT ...) command to install everything having to do
with PLplot and its dependencies.  To take advantage of this installed
information (in the top-level of the installed examples tree), I configure
CMakeLists.txt_installed_examples.in and install it as CMakeLists.txt in
the top-level of the installed examples tree.  I also install
examples/c/CMakeLists.txt_installed_examples_c as examples/c/CMakeLists.txt.

Werner and Arjen, will you please give this proof-of-concept a try on
Windows for whatever CMake generator you like there?

I am running out of time that I can spend on PLplot for the next two weeks
or so, so I hope someone takes this proof of concept and moves forward with
it.  For example, to add C++ examples, you would have to add an EXPORT
export_plplot stanza to the install command that installs the plplotcxxd
library and also add a unique INSTALL(EXPORT ...) command for that library
while using the FILE option to differentiate the resulting export file from
the one associated with libplplot.  Then tweak
CMakeLists.txt_installed_examples.in to include that file, and create
c++/CMakeLists.txt_installed_examples_c++ to build the C++ examples using
the plplotcxx${LIB_TAG} install tree target that is automatically imported
by this whole process.

And so on for each of our installed bindings libraries and associated built
examples subdirectories.  Finally add a "make test" custom target to
CMakeLists.txt_installed_examples.in, and you are already getting quite
close to the functionality we have now in the installed examples tree with
the combination of configured Makefiles and pkg-config.

Note, the export approach only keeps track of target linking and does not
keep track of special compile options (such as location of headers).  So I
had to configure and use INCLUDE_DIR to get access to the PLplot headers.
Because of that limitation I am sure you would have to configure any special
locations for headers (e.g., an attempt to build qt_example for a special Qt
install location). Despite such header location limitations, the CMake
export feature is actually pretty amazing, and from the already working C
examples build I think this is potentially a terrific way to configure the
build of the install-tree examples and also configure (Makefile or other
generator) rules to do the install tree testing.

Alan
__________________________
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__________________________

Linux-powered Science
__________________________

------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image 
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
Plplot-devel mailing list
Plplot-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-devel

Reply via email to