Hi Alan,

I have made some progress concerning PLplot & gtk-fortran:

Le 04/03/2019 à 22:05, Alan W. Irwin a écrit :
This is just a comment in passing about the installation prefix you
have chosen by default here.  Instead, I suggest you specify the cmake
option -DCMAKE_INSTALL_PREFIX=<whatever install prefix you like>.  The
prefix you chose instead by default was /usr/local.  That is under
control by the root account which is why you had to install as root.
But if you use a unique install prefix under user account control
instead, you don't have to install as the root account, and removing
that entire prefix directory again for further installation tries is
so easy compared to removing all the PLplot bits and pieces in
/usr/local.

I have reverted my virtual machine to the state before building PLplot and built it with a -DCMAKE_INSTALL_PREFIX:

osboxes@osboxes:~$ mkdir build_pl && cd build_pl
osboxes@osboxes:~/build_pl$ cmake -D CMAKE_INSTALL_PREFIX=/home/osboxes/myplplot 
../plplot-5.14.0 >& cmake.out
osboxes@osboxes:~/build_pl$ make VERBOSE=1 >& make.out
osboxes@osboxes:~/build_pl$ make VERBOSE=1 install >& make_install.out
osboxes@osboxes:~/build_pl$ cd 
/home/osboxes/myplplot/share/plplot5.14.0/examples/fortran/
osboxes@osboxes:~/myplplot/share/plplot5.14.0/examples/fortran$ make
osboxes@osboxes:~/myplplot/share/plplot5.14.0/examples/fortran$ ./x08f

find_package(plplot) (which you use below) just works for me here when
I use it to build the installed examples that are linked with the
installed PLplot libraries.  Did you forget to set the environment
variable CMAKE_PREFIX_PATH to your PLplot prefix (/usr/local for now,
see above) so that the installed version of PLplot can be found?

First I tried this which had the advantage to give me some interesting messages:

osboxes@osboxes:~/gtk-fortran/build$ cmake -D CMAKE_BUILD_TYPE=debug ..
-- Compiler: GNU 8.3.0 /usr/bin/f95
-- Build type is: debug
-- Compilation flags: -g -pthread -Wall -pedantic -std=f2008 -Wtabs -fcheck=all -fbacktrace -Wno-unused-dummy-argument
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
CMake Warning at CMakeLists.txt:143 (find_package):
By not providing "Findplplot.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "plplot", but
CMake did not find one.

Could not find a package configuration file provided by "plplot" with any
of the following names:

plplotConfig.cmake
plplot-config.cmake

Add the installation prefix of "plplot" to CMAKE_PREFIX_PATH or set
"plplot_DIR" to a directory containing one of the above files. If "plplot"
provides a separate development package or SDK, be sure it has been
installed.

-- PLPLOT not found: PLPLOT integration and examples will not be built
-- Configuring done
-- Generating done
-- Build files have been written to: /home/osboxes/gtk-fortran/build
osboxes@osboxes:~/gtk-fortran/build$

Then I tried, as you suggested:

osboxes@osboxes:~/gtk-fortran/build$ cmake -D CMAKE_BUILD_TYPE=debug -D CMAKE_PREFIX_PATH=/home/osboxes/myplplot ..
-- Compiler: GNU 8.3.0 /usr/bin/f95
-- Build type is: debug
-- Compilation flags: -g -pthread -Wall -pedantic -std=f2008 -Wtabs -fcheck=all -fbacktrace -Wno-unused-dummy-argument
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
-- PLPLOT not found: PLPLOT integration and examples will not be built
-- Configuring done
-- Generating done
-- Build files have been written to: /home/osboxes/gtk-fortran/build
osboxes@osboxes:~/gtk-fortran/build$

I have also tried without success:

osboxes@osboxes:~/gtk-fortran/build$ cmake -D CMAKE_BUILD_TYPE=debug -D plplot_DIR=/home/osboxes/myplplot/lib/cmake/plplot ..

After some hard fighting, I have just realized that CMake variables are case sensitive (but not CMake commands) ! With PLplot<=5.10 we were using in gtk-fortran the PLPLOT_FOUND variable. So I have written that piece of code:

  find_package(plplot)

  message(STATUS "PLPLOT_FOUND : ${PLPLOT_FOUND}")
  message(STATUS "PLplot_FOUND : ${PLplot_FOUND}")
  message(STATUS "plplot_FOUND : ${plplot_FOUND}")

if(plplot_FOUND)
    message(STATUS "plplot_LIBRARIES : ${plplot_LIBRARIES}")
    message(STATUS "plplot_INCLUDE_DIR : ${plplot_INCLUDE_DIR}")
    message(STATUS "plplot_MODULE_DIR : ${plplot_MODULE_DIR}")
    message(STATUS "PLPLOT_LIBRARIES : ${PLPLOT_LIBRARIES}")
    message(STATUS "PLPLOT_INCLUDE_DIR : ${PLPLOT_INCLUDE_DIR}")
    message(STATUS "PLPLOT_MODULE_DIR : ${PLPLOT_MODULE_DIR}")
    message(STATUS "PLplot_LIBRARIES : ${PLplot_LIBRARIES}")
    message(STATUS "PLplot_INCLUDE_DIR : ${PLplot_INCLUDE_DIR}")
    message(STATUS "PLplot_MODULE_DIR : ${PLplot_MODULE_DIR}")

Which yields:

osboxes@osboxes:~/gtk-fortran/build$ cmake -D CMAKE_BUILD_TYPE=debug -D CMAKE_PREFIX_PATH=/home/osboxes/myplplot ..

....

-- PLPLOT_FOUND :
-- PLplot_FOUND :
-- plplot_FOUND : 1
-- plplot_LIBRARIES :
-- plplot_INCLUDE_DIR :
-- plplot_MODULE_DIR :
-- PLPLOT_LIBRARIES :
-- PLPLOT_INCLUDE_DIR :
-- PLPLOT_MODULE_DIR :
-- PLplot_LIBRARIES :
-- PLplot_INCLUDE_DIR : PLplot_INCLUDE_DIR-NOTFOUND
-- PLplot_MODULE_DIR :

....
osboxes@osboxes:~/gtk-fortran/build$

Once you have found the installed PLplot (see comment above), I am not
sure the above method will work anymore.
By now, I obtain the following errors when building our gtk-fortran PLplot examples:

[ 95%] Building Fortran object plplot/CMakeFiles/hl_plplot30e.dir/hl_plplot30e.f90.o
/home/osboxes/gtk-fortran/plplot/hl_plplot30e.f90:49:6:

   use plplot, PI => PL_PI
      1
Fatal Error: Can't open module file ‘plplot.mod’ for reading at (1): No such file or directory
compilation terminated.
Error copying Fortran module "plplot/handlers_ex30.mod". Tried "plplot/HANDLERS_EX30.mod" and "plplot/handlers_ex30.mod". Error copying Fortran module "plplot/plplot_code_ex30.mod".  Tried "plplot/PLPLOT_CODE_EX30.mod" and "plplot/plplot_code_ex30.mod".
[ 95%] Linking Fortran executable hl_plplot30e
f95: error: CMakeFiles/hl_plplot30e.dir/hl_plplot30e.f90.o: No such file or directory
[ 95%] Built target hl_plplot30e

Instead, I suggest you
follow the CMake logic (for the case when CORE_BUILD is false) in
$PLPLOT_PREFIX/share/plplot5.14.0/examples/CMakeLists.txt (our
principal CMakeLists.txt file for the installed examples);
$PLPLOT_PREFIX/share/plplot5.14.0/examples/cmake/modules/plplot_configure.cmake
(a configured file that contains definitions for many useful CMake
variables); and primarily
$PLPLOT_PREFIX/share/plplot5.14.0/examples/fortran/CMakeLists.txt
(which is used to build our fortran examples that are linked against
the installed PLplot) to build your Fortran source against PLplot.

Of course, if you have any trouble following the CMake logic in the above 3 files,
please ask again here.

OK, I will read those files.

Just a question: could it be helpful to copy plplot-5.14.0/cmake/FindPLplot.cmake into our gtk-fortran/cmake directory ? For the previous PLplot versions, there was a FindPlplotF95.cmake file in it.

Thanks for your help,

Vincent




_______________________________________________
Plplot-general mailing list
Plplot-general@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/plplot-general

Reply via email to